drm/i915: Disable semaphore on vGPU for now
diff mbox series

Message ID 20190327090636.3547-1-zhenyuw@linux.intel.com
State New
Headers show
Series
  • drm/i915: Disable semaphore on vGPU for now
Related show

Commit Message

Zhenyu Wang March 27, 2019, 9:06 a.m. UTC
This is to disable semaphore usage when on vGPU for now. Unfortunately
GVT-g hasn't fully enabled semaphore usage yet, so current guest with
semaphore use would cause vGPU failure.

Although current semaphore failure with vGPU can be simply resolved by
allowing cmd parser to accept MI_SEMAPHORE_WAIT command with address
audit, we're checking general usage of semaphore and how we should
handle it properly for virtualization in consider of function and
security concern. So we decide to request to disable it for now in
guest driver. Once GVT could support it, we would add new compat bit
to turn it on.

Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
Note this needs to queue for -next otherwise next kernel i915 as guest
would be broken for GVT.

 drivers/gpu/drm/i915/intel_lrc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Chris Wilson March 27, 2019, 9:15 a.m. UTC | #1
Quoting Zhenyu Wang (2019-03-27 09:06:36)
> This is to disable semaphore usage when on vGPU for now. Unfortunately
> GVT-g hasn't fully enabled semaphore usage yet, so current guest with
> semaphore use would cause vGPU failure.
> 
> Although current semaphore failure with vGPU can be simply resolved by
> allowing cmd parser to accept MI_SEMAPHORE_WAIT command with address
> audit, we're checking general usage of semaphore and how we should
> handle it properly for virtualization in consider of function and
> security concern. So we decide to request to disable it for now in
> guest driver. Once GVT could support it, we would add new compat bit
> to turn it on.

MI_WAIT_SEMAPHORE are used by Vulkan (anvil) as well for VkEvents.
-Chris
Chris Wilson March 27, 2019, 9:50 a.m. UTC | #2
Quoting Zhenyu Wang (2019-03-27 09:06:36)
> This is to disable semaphore usage when on vGPU for now. Unfortunately
> GVT-g hasn't fully enabled semaphore usage yet, so current guest with
> semaphore use would cause vGPU failure.
> 
> Although current semaphore failure with vGPU can be simply resolved by
> allowing cmd parser to accept MI_SEMAPHORE_WAIT command with address
> audit, we're checking general usage of semaphore and how we should
> handle it properly for virtualization in consider of function and
> security concern. So we decide to request to disable it for now in
> guest driver. Once GVT could support it, we would add new compat bit
> to turn it on.
> 
> Cc: Kevin Tian <kevin.tian@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> ---
> Note this needs to queue for -next otherwise next kernel i915 as guest
> would be broken for GVT.
> 
>  drivers/gpu/drm/i915/intel_lrc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 66bc3cd4e166..50075e24ae03 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -2315,7 +2315,8 @@ void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
>         engine->park = NULL;
>         engine->unpark = NULL;
>  
> -       engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
> +       if (!intel_vgpu_active(engine->i915))
> +               engine->flags |= I915_ENGINE_HAS_SEMAPHORES;

Fwiw, this will have the desired effect so,

Acked-by: Chris Wilson <chris@chris-wilson.co.uk>

Just the question remains as this is being used by userspace, sweeping
it under the rug might be a bit more difficult.
-Chris
Zhenyu Wang March 28, 2019, 2:26 a.m. UTC | #3
On 2019.03.27 09:15:36 +0000, Chris Wilson wrote:
> Quoting Zhenyu Wang (2019-03-27 09:06:36)
> > This is to disable semaphore usage when on vGPU for now. Unfortunately
> > GVT-g hasn't fully enabled semaphore usage yet, so current guest with
> > semaphore use would cause vGPU failure.
> > 
> > Although current semaphore failure with vGPU can be simply resolved by
> > allowing cmd parser to accept MI_SEMAPHORE_WAIT command with address
> > audit, we're checking general usage of semaphore and how we should
> > handle it properly for virtualization in consider of function and
> > security concern. So we decide to request to disable it for now in
> > guest driver. Once GVT could support it, we would add new compat bit
> > to turn it on.
> 
> MI_WAIT_SEMAPHORE are used by Vulkan (anvil) as well for VkEvents.

For batch buffer usage, current GVT won't scan on non-privileged buffer
so that's still accepted. We need to consider all use case of semaphore anyway.

thanks

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 66bc3cd4e166..50075e24ae03 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -2315,7 +2315,8 @@  void intel_execlists_set_default_submission(struct intel_engine_cs *engine)
 	engine->park = NULL;
 	engine->unpark = NULL;
 
-	engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
+	if (!intel_vgpu_active(engine->i915))
+		engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
 	engine->flags |= I915_ENGINE_SUPPORTS_STATS;
 	if (engine->preempt_context)
 		engine->flags |= I915_ENGINE_HAS_PREEMPTION;