Make sure lockdep sees the dependencies here.

Signed-off-by: Christian König <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
index 6598823ec619..e5aaa5156069 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
@@ -67,8 +67,17 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct 
*work)
                container_of(evf_mgr, struct amdgpu_fpriv, evf_mgr);
        struct amdgpu_userq_mgr *uq_mgr = &fpriv->userq_mgr;
        struct dma_fence *ev_fence;
+       bool cookie;
 
        mutex_lock(&uq_mgr->userq_mutex);
+
+       /*
+        * This is intentionally after taking the userq_mutex since we do
+        * allocate memory while holding this lock, but only after ensuring that
+        * the eviction fence is signaled.
+        */
+       cookie = dma_fence_begin_signalling();
+
        ev_fence = amdgpu_evf_mgr_get_fence(evf_mgr);
        amdgpu_userq_evict(uq_mgr, !evf_mgr->shutdown);
 
@@ -78,6 +87,7 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
         * next fence.
         */
        dma_fence_signal(ev_fence);
+       dma_fence_end_signalling(cookie);
        dma_fence_put(ev_fence);
        mutex_unlock(&uq_mgr->userq_mutex);
 }
-- 
2.43.0

Reply via email to