[PATCH 4/6] drm/i915/gvt: Refine error handling for intel_vgpu_pin_mm

Zhenyu Wang zhenyuw at linux.intel.com
Mon Aug 7 07:33:32 UTC 2017


On 2017.08.07 12:13:21 +0800, fred gao wrote:
> When it is failed in shadow_mm, the pin_count should rollback
> to the original states before return.
> 
> v2:
> - split the mixed several error paths for better review. (Zhenyu)
> 
> Signed-off-by: fred gao <fred.gao at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/gtt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> index 66374db..8f46019 100644
> --- a/drivers/gpu/drm/i915/gvt/gtt.c
> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> @@ -1630,8 +1630,10 @@ int intel_vgpu_pin_mm(struct intel_vgpu_mm *mm)
>  
>  	if (!mm->shadowed) {
>  		ret = shadow_mm(mm);
> -		if (ret)
> +		if (ret) {
> +			atomic_dec(&mm->pincount);
>  			return ret;
> +		}
>  	}
>  
>  	list_del_init(&mm->lru_list);

Just move atomic_inc() after shadow success?

-- 
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/20170807/9fbc0ef0/attachment.sig>


More information about the intel-gvt-dev mailing list