]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu/userq: amdgpu_userq_vm_validate does not need userq mutex
authorSunil Khatri <sunil.khatri@amd.com>
Tue, 24 Mar 2026 14:58:54 +0000 (20:28 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 30 Mar 2026 18:31:55 +0000 (14:31 -0400)
amdgpu_userq_vm_validate function does not need userq_mutex and exec
lock is good enough to locking all bos and updating the eviction fence.

Also since we only need userq_mutex for amdgpu_userq_restore_all
so move the locks in the function itself.

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_userq.c

index 0d8f6bfc8d1db3b73d00fc8f5378d959b1cd3533..2a463f5644ac653d4bac11d91df4b322f7d4d47b 100644 (file)
@@ -1004,6 +1004,7 @@ amdgpu_userq_restore_all(struct amdgpu_userq_mgr *uq_mgr)
        unsigned long queue_id;
        int ret = 0, r;
 
+       mutex_lock(&uq_mgr->userq_mutex);
        /* Resume all the queues for this process */
        xa_for_each(&uq_mgr->userq_xa, queue_id, queue) {
 
@@ -1019,6 +1020,7 @@ amdgpu_userq_restore_all(struct amdgpu_userq_mgr *uq_mgr)
                        ret = r;
 
        }
+       mutex_unlock(&uq_mgr->userq_mutex);
 
        if (ret)
                drm_file_err(uq_mgr->file, "Failed to map all the queues\n");
@@ -1222,23 +1224,21 @@ static void amdgpu_userq_restore_worker(struct work_struct *work)
        struct dma_fence *ev_fence;
        int ret;
 
-       mutex_lock(&uq_mgr->userq_mutex);
        ev_fence = amdgpu_evf_mgr_get_fence(&fpriv->evf_mgr);
        if (!dma_fence_is_signaled(ev_fence))
-               goto unlock;
+               goto put_fence;
 
        ret = amdgpu_userq_vm_validate(uq_mgr);
        if (ret) {
                drm_file_err(uq_mgr->file, "Failed to validate BOs to restore\n");
-               goto unlock;
+               goto put_fence;
        }
 
        ret = amdgpu_userq_restore_all(uq_mgr);
        if (ret)
                drm_file_err(uq_mgr->file, "Failed to restore all queues\n");
 
-unlock:
-       mutex_unlock(&uq_mgr->userq_mutex);
+put_fence:
        dma_fence_put(ev_fence);
 }