[PATCH 1/4] drm/amdgpu: fix object unreserved issue

zhoucm1 zhoucm1 at amd.com
Mon Mar 5 04:51:31 UTC 2018



On 2018年03月05日 12:09, Monk Liu wrote:
> bo_do_create will unreserve in in the end if @resv
> is NULL, which cause the following bo_create_shadow
> run without lock held on @resv
>
> Change-Id: Iaad24b8aea60522f25188874ab9d5c5f13f1a941
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 216799cc..d8a818d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -507,9 +507,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
>   		return r;
>   
>   	if ((flags & AMDGPU_GEM_CREATE_SHADOW) && amdgpu_need_backup(adev)) {
> -		if (!resv)
> -			WARN_ON(reservation_object_lock((*bo_ptr)->tbo.resv,
> -							NULL));
> +		if (!resv) {
> +			WARN_ON(reservation_object_lock((*bo_ptr)->tbo.resv, NULL));
isn't this locking resv?

> +			r = amdgpu_bo_reserve(*bo_ptr, kernel?true:false);
I don't think this is need.

Regards,
David Zhou
> +			if (unlikely(r))
> +				return r;
> +		}
>   
>   		r = amdgpu_bo_create_shadow(adev, size, byte_align, (*bo_ptr));
>   



More information about the amd-gfx mailing list