]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: trigger GPU recovery when userq destroy fails to unmap a hung queue
authorJesse Zhang <Jesse.Zhang@amd.com>
Wed, 1 Jul 2026 10:17:03 +0000 (18:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 Jul 2026 20:29:11 +0000 (16:29 -0400)
Destroying a hung user queue issues a MES REMOVE_QUEUE that times out,
The destroy path only logged the error and freed the queue, so the
next userq submission failed and forced a GPU reset attributed to an innocent workload.

Kick the userq reset work when unmap fails so the GPU is recovered at
destroy time.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8396b9de4198a54ec4760a94a179347540a9764d)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c

index ef3f0213cc465bcbdfac145ec1106a87346f118c..d854343b3734d57393f6a6dd3b102d9af1b4f156 100644 (file)
@@ -523,6 +523,15 @@ amdgpu_userq_destroy(struct amdgpu_userq_mgr *uq_mgr, struct amdgpu_usermode_que
        amdgpu_userq_cleanup(queue);
        mutex_unlock(&uq_mgr->userq_mutex);
 
+       /*
+        * A failed unmap means MES could not remove the hung queue and is now
+        * unresponsive.  Recover the GPU here so the wedged MES does not fail
+        * the next, unrelated queue submission and trigger a reset attributed
+        * to an innocent workload.
+        */
+       if (r)
+               queue_work(adev->reset_domain->wq, &uq_mgr->reset_work);
+
        cancel_delayed_work_sync(&queue->hang_detect_work);
        uq_funcs->mqd_destroy(queue);
        queue->userq_mgr = NULL;