[PATCH v4 10/11] drm/amdgpu: only bound the eviction fence to userq bo

Christian König christian.koenig at amd.com
Wed Jun 25 07:49:58 UTC 2025


On 24.06.25 10:45, Prike Liang wrote:
> It doesn't need to attach the invalid eviction fence
> to non-userq's BOs.

Clear NAK to this.

BOs are often created before the userqs are created.

Regards,
Christian.

> 
> Signed-off-by: Prike Liang <Prike.Liang at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 2c68118fe9fd..50356aa23a99 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -294,12 +294,14 @@ static int amdgpu_gem_object_open(struct drm_gem_object *obj,
>  	else
>  		++bo_va->ref_count;
>  
> -	/* attach gfx eviction fence */
> -	r = amdgpu_eviction_fence_attach(&fpriv->evf_mgr, abo);
> -	if (r) {
> -		DRM_DEBUG_DRIVER("Failed to attach eviction fence to BO\n");
> -		amdgpu_bo_unreserve(abo);
> -		return r;
> +	/* attach gfx eviction fence when userq created*/
> +	if (vm->is_userq_context) {
> +		r = amdgpu_eviction_fence_attach(&fpriv->evf_mgr, abo);
> +		if (r) {
> +			DRM_DEBUG_DRIVER("Failed to attach eviction fence to BO\n");
> +			amdgpu_bo_unreserve(abo);
> +			return r;
> +		}
>  	}
>  
>  	amdgpu_bo_unreserve(abo);
> @@ -365,7 +367,7 @@ static void amdgpu_gem_object_close(struct drm_gem_object *obj,
>  			goto out_unlock;
>  	}
>  
> -	if (!amdgpu_vm_is_bo_always_valid(vm, bo))
> +	if (!amdgpu_vm_is_bo_always_valid(vm, bo) && vm->is_compute_context)
>  		amdgpu_eviction_fence_detach(&fpriv->evf_mgr, bo);
>  
>  	bo_va = amdgpu_vm_bo_find(vm, bo);



More information about the amd-gfx mailing list