[PATCH v3 5/5] drm/amdgpu: lock the eviction fence before signaling it

Christian König christian.koenig at amd.com
Wed Apr 30 12:03:59 UTC 2025


On 4/30/25 04:40, Prike Liang wrote:
> Lock the eviction fence before trying to signal it.
> 
> Signed-off-by: Prike Liang <Prike.Liang at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> index 242bfb91c4f7..fed065892568 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> @@ -108,7 +108,9 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
>  	struct amdgpu_eviction_fence *ev_fence;
>  
>  	mutex_lock(&uq_mgr->userq_mutex);
> +	spin_lock(&evf_mgr->ev_fence_lock);
>  	ev_fence = evf_mgr->ev_fence;
> +	spin_unlock(&evf_mgr->ev_fence_lock);

That's a good catch, but won't work like this.

You need to grab a reference to the fence while holding the lock, e.g. something like dma_fence_get(evf_mgr->ev_fence);

Regards,
Christian.

>  	if (!ev_fence)
>  		goto unlock;
>  



More information about the amd-gfx mailing list