* [PATCH] drm/amdgpu: trigger GPU recovery when userq destroy fails to unmap a hung queue
@ 2026-07-01 10:27 Jesse Zhang
2026-07-01 18:16 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Jesse Zhang @ 2026-07-01 10:27 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Christian Koenig, Jesse Zhang
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.
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index fb7e18c841ee..aa5cc5642e87 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -542,6 +542,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;
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdgpu: trigger GPU recovery when userq destroy fails to unmap a hung queue
2026-07-01 10:27 [PATCH] drm/amdgpu: trigger GPU recovery when userq destroy fails to unmap a hung queue Jesse Zhang
@ 2026-07-01 18:16 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2026-07-01 18:16 UTC (permalink / raw)
To: Jesse Zhang; +Cc: amd-gfx, Alexander.Deucher, Christian Koenig
On Wed, Jul 1, 2026 at 6:27 AM Jesse Zhang <Jesse.Zhang@amd.com> wrote:
>
> 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.
>
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> index fb7e18c841ee..aa5cc5642e87 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
> @@ -542,6 +542,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;
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-01 18:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 10:27 [PATCH] drm/amdgpu: trigger GPU recovery when userq destroy fails to unmap a hung queue Jesse Zhang
2026-07-01 18:16 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox