[PATCH v6 5/6] drm/i915/gvt: Refine error handling in dispatch_workload

Zhenyu Wang zhenyuw at linux.intel.com
Mon Aug 14 09:54:10 UTC 2017


On 2017.08.14 17:14:21 +0800, fred gao wrote:
> When an error occurs in dispatch_workload, this patch is to do the
> proper cleanup and rollback to the original states before the workload
> is abandoned.
> 
> v2:
> - split the mixed several error paths for better review. (Zhenyu)
> 
> v3:
> - original PTR_ERR(cs) is good and code cleanup. (Zhenyu)
> 
> v4:
> - reuse the existing i915_add_request for error handling. (Zhenyu)
> 
> v5:
> - remove the duplicate error handling release_shadow_wa_ctx and
>   move the engine->context_unpin upper. (Zhenyu)
> 
> Signed-off-by: fred gao <fred.gao at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/scheduler.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
> index 2917196..f1a048a 100644
> --- a/drivers/gpu/drm/i915/gvt/scheduler.c
> +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
> @@ -338,15 +338,17 @@ static int dispatch_workload(struct intel_vgpu_workload *workload)
>  
>  	ret = intel_gvt_scan_and_shadow_workload(workload);
>  	if (ret)
> -		goto out;
> +		goto err_scan;
>  
>  	if (workload->prepare) {
>  		ret = workload->prepare(workload);
> -		if (ret)
> -			goto out;
> +		if (ret) {
> +			engine->context_unpin(engine, shadow_ctx);
> +			goto err_scan;
> +		}
>  	}
>  
> -out:
> +err_scan:

Let's just keep label as 'out', as it's for normal path too.

>  	if (ret)
>  		workload->status = ret;
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

-- 
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: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170814/9a7dde97/attachment.sig>


More information about the intel-gvt-dev mailing list