[PATCH v2] drm/amdgpu: lock the eviction fence for wq signals it

Liang, Prike Prike.Liang at amd.com
Wed May 14 01:49:22 UTC 2025


[Public]

Soft ping.

Regards,
      Prike

> -----Original Message-----
> From: Liang, Prike <Prike.Liang at amd.com>
> Sent: Monday, May 12, 2025 10:20 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Liang, Prike
> <Prike.Liang at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>
> Subject: [PATCH v2] drm/amdgpu: lock the eviction fence for wq signals it
>
> Lock and refer to the eviction fence before the eviction fence schedules work
> queue tries to signal it.
>
> Suggested-by: Christian König <christian.koenig at amd.com>
> Signed-off-by: Prike Liang <Prike.Liang at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> index 1a7469543db5..d5f176fef357 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
> @@ -108,12 +108,18 @@ 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;
> -     if (!ev_fence)
> +     spin_unlock(&evf_mgr->ev_fence_lock);
> +
> +     if (ev_fence)
> +             dma_fence_get(&ev_fence->base);
> +     else
>               goto unlock;
>
>       amdgpu_userq_evict(uq_mgr, ev_fence);
>
> +     dma_fence_put(&ev_fence->base);
>  unlock:
>       mutex_unlock(&uq_mgr->userq_mutex);
>  }
> --
> 2.34.1



More information about the amd-gfx mailing list