[PATCH] drm/i915/gvt: Use force single submit flag to distinguish gvt request from i915 request

Zhenyu Wang zhenyuw at linux.intel.com
Sun Mar 19 07:06:57 UTC 2017


On 2017.03.17 17:57:08 +0800, changbin.du at intel.com wrote:
> From: Changbin Du <changbin.du at intel.com>
> 
> In my previous Commit ab9da627906a ("drm/i915: make context status
> notifier head be per engine") rely on scheduler->current_workload[x]
> to distinguish gvt spacial request from i915 request. But this is
> not always true since no synchronization between workload_thread and
> lrc irq handler.
> 
>     lrc irq handler               workload_thread
>          ----                          ----
>   pick i915 requests;
>                                 intel_vgpu_submit_execlist();
>                                 current_workload[x] = xxx;
>   shadow_context_status_change();
> 
> Then current_workload[x] is not null but current request is of i915 self.
> So instead we check ctx flag CONTEXT_FORCE_SINGLE_SUBMISSION. Only gvt
> request set this flag and always set.
> 
> Signed-off-by: Changbin Du <changbin.du at intel.com>
> Reviewed-by: Yulei Zhang <yulei.zhang at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/scheduler.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
> index c4353ed..7d6b06c 100644
> --- a/drivers/gpu/drm/i915/gvt/scheduler.c
> +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
> @@ -127,6 +127,11 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
>  	return 0;
>  }
>  
> +static inline bool is_gvt_request(struct drm_i915_gem_request *req)
> +{
> +	return i915_gem_context_force_single_submission(req->ctx);
> +}
> +
>  static int shadow_context_status_change(struct notifier_block *nb,
>  		unsigned long action, void *data)
>  {
> @@ -137,7 +142,7 @@ static int shadow_context_status_change(struct notifier_block *nb,
>  	struct intel_vgpu_workload *workload =
>  		scheduler->current_workload[req->engine->id];
>  
> -	if (unlikely(!workload))
> +	if (unlikely(!workload) || !is_gvt_request(req))
>  		return NOTIFY_OK;
>  

This should be put before valid workload check and return early if not.

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170319/321a657c/attachment.sig>


More information about the intel-gvt-dev mailing list