]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu/userq: schedule_delayed_work should be after fence signalled
authorSunil Khatri <sunil.khatri@amd.com>
Tue, 24 Mar 2026 15:16:34 +0000 (20:46 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 24 Mar 2026 17:35:23 +0000 (13:35 -0400)
Reorganise the amdgpu_eviction_fence_suspend_worker code so
schedule_delayed_work is the last thing we do after amdgpu_userq_evict
is complete and the eviction fence is signalled.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h

index 9ca21a32bc98bcd16f6f8957557b307a0493c7f9..4c5e38dea4c22320d32365dd219e1fea7c0978b5 100644 (file)
@@ -76,7 +76,7 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
        cookie = dma_fence_begin_signalling();
 
        ev_fence = amdgpu_evf_mgr_get_fence(evf_mgr);
-       amdgpu_userq_evict(uq_mgr, !evf_mgr->shutdown);
+       amdgpu_userq_evict(uq_mgr);
 
        /*
         * Signaling the eviction fence must be done while holding the
@@ -86,6 +86,10 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
        dma_fence_signal(ev_fence);
        dma_fence_end_signalling(cookie);
        dma_fence_put(ev_fence);
+
+       if (!evf_mgr->shutdown)
+               schedule_delayed_work(&uq_mgr->resume_work, 0);
+
        mutex_unlock(&uq_mgr->userq_mutex);
 }
 
index f3fdfe535d02a72cef4c385ca416534b8e4ed889..7f64b783954ae37c7037a1b265e723c7bab29278 100644 (file)
@@ -1298,7 +1298,7 @@ amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr)
 }
 
 void
-amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr, bool schedule_resume)
+amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr)
 {
        struct amdgpu_device *adev = uq_mgr->adev;
        int ret;
@@ -1312,8 +1312,6 @@ amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr, bool schedule_resume)
        if (ret)
                dev_err(adev->dev, "Failed to evict userqueue\n");
 
-       if (schedule_resume)
-               schedule_delayed_work(&uq_mgr->resume_work, 0);
 }
 
 int amdgpu_userq_mgr_init(struct amdgpu_userq_mgr *userq_mgr, struct drm_file *file_priv,
index f0abc16d02cce0ef7dbf23332230da87c68ec626..a4d44abf24fa83d7188d90c810940175f24b728a 100644 (file)
@@ -133,8 +133,7 @@ int amdgpu_userq_create_object(struct amdgpu_userq_mgr *uq_mgr,
 void amdgpu_userq_destroy_object(struct amdgpu_userq_mgr *uq_mgr,
                                 struct amdgpu_userq_obj *userq_obj);
 
-void amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr,
-                       bool schedule_resume);
+void amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr);
 
 void amdgpu_userq_ensure_ev_fence(struct amdgpu_userq_mgr *userq_mgr,
                                  struct amdgpu_eviction_fence_mgr *evf_mgr);