drm/amdgpu/userq: properly account for resets
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu/userq: properly account for resets
We need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue() handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +6 -1
@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL); else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL ); + } }else { gpu_reset = true; }
Signature · 1 line
2.55.0
AMD General
Quoted 48 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, July 14, 2026 4:39 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +6
-1@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL); else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL ); + } }else {gpu_reset = true; }--
2.55.0
AMD General
Regards,
Prike
Quoted 31 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 4:39 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL);
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct · line 156
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +5
-1else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL );
If we do the userq reset post similar process here just like as mes_userq_reset_queue(), so do we need to clear the duplicate the code in the mes_userq_reset_queue()? Otherwise, the gpu reset counter should be incorrect. Except that, we might input the wedge task info to report the guilty process info.
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-0+ } }else {gpu_reset = true; }--
2.55.0
AMD General
Regards,
Prike
Quoted 52 lines
-----Original Message-----
From: Liang, Prike
Sent: Tuesday, July 14, 2026 10:49 AM
To: 'Alex Deucher' <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Khatri, Sunil <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/userq: properly account for resetsRegards,
PrikeQuoted 38 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 4:39 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +3
-1@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL); else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct · line 156
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2
-0+amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL );If we do the userq reset post similar process here just like as
mes_userq_reset_queue(), so do we need to clear the duplicate the code in themes_userq_reset_queue()? Otherwise, the gpu reset counter should be incorrect. Except that, we might input the wedge task info to report the guilty process info.
As to the first question, I recheck the code and found out the guilty user queue in the amdgpu_gfx_reset_mes_compute() was reset separately before mes_userq_reset_queue(), with this current reset sequence then this change it make sense to update reset counter and force complete fence.
But why need to reset the original guilty queue separately, should this guilty queue was found by the amdgpu_mes_detect_and_reset_hung_queues() in the MES firmware? If so, we may need to reset the guilty queue through mes_userq_reset_queue() rather than reset separately, then we don't need to add this change anymore.
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-0+ } }else {gpu_reset = true; }--
2.55.0
Quoted 67 lines · Prike
AMD General
Regards,
PrikeQuoted 52 lines
-----Original Message-----
From: Liang, Prike
Sent: Tuesday, July 14, 2026 10:49 AM
To: 'Alex Deucher' <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Khatri, Sunil <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/userq: properly account for resetsRegards,
PrikeQuoted 38 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 4:39 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +3
-1@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL); else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter);Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct · line 156
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2
-0+amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL );If we do the userq reset post similar process here just like as
mes_userq_reset_queue(), so do we need to clear the duplicate the code in themes_userq_reset_queue()? Otherwise, the gpu reset counter should be incorrect. Except that, we might input the wedge task info to report the guilty process info.
Quoted 3 lines
As to the first question, I recheck the code and found out the guilty user queue in the
amdgpu_gfx_reset_mes_compute()was reset separately beforemes_userq_reset_queue(), with this current reset sequence then this change it make sense to update reset counter and force complete fence.But why need to reset the original guilty queue separately, should this guilty queue was found by the
amdgpu_mes_detect_and_reset_hung_queues()in the MES firmware? If so, we may need to reset the guilty queue throughmes_userq_reset_queue()rather than reset separately, then we don't need to add this change anymore.
We still need it for gfx and sdma queues. Those don't get reset via amdgpu_gfx_reset_mes_compute(),
Alex
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-0+ } }else {gpu_reset = true; }--
2.55.0
AMD General
Regards,
Prike
Quoted 85 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 9:52 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; amd- [email protected]; SHANMUGAM, SRINIVASAN <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 67 lines · Prike
AMD General
Regards,
PrikeQuoted 61 lines
-----Original Message-----
From: Liang, Prike
Sent: Tuesday, July 14, 2026 10:49 AM
To: 'Alex Deucher' <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Khatri, Sunil <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/userq: properly account for resetsRegards,
PrikeQuoted 41 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 4:39 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -146,8 +146,13 @@ static voidamdgpu_userq_hang_detect_work(struct
work_struct*work)queue, NULL, NULL); else r = userq_funcs->reset(queue);drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +5
-1-if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); + drm_dev_wedged_event(adev_to_drm(adev),Quoted 1 line
DRM_WEDGE_RECOVERY_NONE, NULL);If we do the userq reset post similar process here just like as
mes_userq_reset_queue(), so do we need to clear the duplicate the code in themes_userq_reset_queue()? Otherwise, the gpu reset countershould be incorrect.
Quoted 3 lines
Quoted 1 line
Except that, we might input the wedge task info to report the guilty process info.
As to the first question, I recheck the code and found out the guilty user queue in
the
amdgpu_gfx_reset_mes_compute()was reset separately beforemes_userq_reset_queue(), with this current reset sequence then this change it make sense to update reset counter and force complete fence.Quoted 1 line
Quoted 8 lines
Quoted 1 line
But why need to reset the original guilty queue separately, should this guilty queue
was found by the
amdgpu_mes_detect_and_reset_hung_queues()in the MES firmware? If so, we may need to reset the guilty queue throughmes_userq_reset_queue()rather than reset separately, then we don't need to add this change anymore.We still need it for gfx and sdma queues. Those don't get reset via
amdgpu_gfx_reset_mes_compute(),
Yes, I will check whether the original guilty compute queue can be identified by amdgpu_mes_detect_and_reset_hung_queues(). If so, the separate guilty queue reset via mes_userq_reset_queue() becomes redundant and can be removed. The compute userq reset refcount and completed fence handling would then be relocated into amdgpu_userq_hang_detect_work(), consolidating the reset path into a single flow.
Thanks,
Prike
Quoted 11 lines
Alex
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
+ }
} else { gpu_reset = true; }--
2.55.0
Quoted 97 lines · Prike
AMD General
Regards,
PrikeQuoted 91 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 9:52 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; amd- [email protected]; SHANMUGAM, SRINIVASAN <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 67 lines · Prike
AMD General
Regards,
PrikeQuoted 61 lines
-----Original Message-----
From: Liang, Prike
Sent: Tuesday, July 14, 2026 10:49 AM
To: 'Alex Deucher' <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Khatri, Sunil <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/userq: properly account for resetsRegards,
PrikeQuoted 41 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 4:39 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -146,8 +146,13 @@ static voidamdgpu_userq_hang_detect_work(struct
work_struct*work)queue, NULL, NULL); else r = userq_funcs->reset(queue);drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +5
-1-if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); + drm_dev_wedged_event(adev_to_drm(adev),Quoted 1 line
DRM_WEDGE_RECOVERY_NONE, NULL);If we do the userq reset post similar process here just like as
mes_userq_reset_queue(), so do we need to clear the duplicate the code in themes_userq_reset_queue()? Otherwise, the gpu reset countershould be incorrect.
Quoted 3 lines
Quoted 1 line
Except that, we might input the wedge task info to report the guilty process info.
As to the first question, I recheck the code and found out the guilty user queue in
the
amdgpu_gfx_reset_mes_compute()was reset separately beforemes_userq_reset_queue(), with this current reset sequence then this change it make sense to update reset counter and force complete fence.Quoted 2 lines
But why need to reset the original guilty queue separately, should this guilty queue
was found by the
amdgpu_mes_detect_and_reset_hung_queues()in the MES firmware? If so, we may need to reset the guilty queue throughmes_userq_reset_queue()rather than reset separately, then we don't need to add this change anymore.
Quoted 5 lines
Quoted 2 lines
We still need it for gfx and sdma queues. Those don't get reset via
amdgpu_gfx_reset_mes_compute(),Yes, I will check whether the original guilty compute queue can be identified by
amdgpu_mes_detect_and_reset_hung_queues(). If so, the separate guilty queue reset viames_userq_reset_queue()becomes redundant and can be removed. The compute userq reset refcount and completed fence handling would then be relocated intoamdgpu_userq_hang_detect_work(), consolidating the reset path into a single flow.
I don't think we need that; see V3 of the patch I sent out earlier today.
Alex
Quoted 15 lines
Thanks,
PrikeQuoted 11 lines
Alex
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
+ }
} else { gpu_reset = true; }--
2.55.0
AMD General
Quoted 43 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 2:09 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +6
-1@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL); else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL ); + } }else {
Quoted 2 lines
gpu_reset = true;
}After the original queue was reset successfully, it did not update gpu_reset_counter, complete its pending fences, or send the wedged event. mes_userq_reset_queue() already updates gpu_reset_counter, completes the pending fences, and sends the wedged event for the other affected queues, but skips the original queue because it has already been reset.
This patch adds the same steps for the original queue, making the reset handling consistent for both the original queue and the other affected queues.
Quoted 2 lines
--
2.55.0
Quoted 43 lines · SRINIVASAN
AMD General
Quoted 41 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 2:09 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +5
-1@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL); else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL );
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-0+ } }else {gpu_reset = true; }After the original queue was reset successfully, it did not update
gpu_reset_counter, complete its pending fences, or send the wedged event.mes_userq_reset_queue()already updatesgpu_reset_counter, completes the pending fences, and sends the wedged event for the other affected queues, but skips the original queue because it has already been reset.
What is the rationale of sending multiple device wedged events on a per queue basis?
Thanks,
Lijo
Quoted 7 lines
This patch adds the same steps for the original queue, making the reset handling consistent for both the original queue and the other affected queues.
Reviewed-by Srinivasan Shanmugam <[email protected]>Quoted 2 lines
--
2.55.0
AMD General
Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, July 14, 2026 3:14:34 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>; Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
Cc: Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resets
Quoted 43 lines · SRINIVASAN
AMD General
Quoted 41 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 2:09 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and set the wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but the caller needs to handle this directly for the original guilty queue.Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +5
-1@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL, NULL); else r = userq_funcs->reset (queue); -if (r) +if (r) { gpu_reset = true; + }else { +atomic_inc (&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion (queue); +drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL );
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-0+ } }else {gpu_reset = true; }After the original queue was reset successfully, it did not update
gpu_reset_counter, complete its pending fences, or send the wedged event.mes_userq_reset_queue()already updatesgpu_reset_counter, completes the pending fences, and sends the wedged event for the other affected queues, but skips the original queue because it has already been reset.
What is the rationale of sending multiple device wedged events on a per queue basis?
The question of whether drm_dev_wedged_event() should be emitted once per queue or once per overall recovery seems like a broader design discussion.
Thanks,
Srini
Quoted 70 lines · SRINIVASAN
AMD General
Get Outlook for Android <https://aka.ms/AAb9ysg>
------------------------------------------------------------------------
*From:* Lazar, Lijo <[email protected]>
*Sent:* Tuesday, July 14, 2026 3:14:34 PM
*To:* SHANMUGAM, SRINIVASAN <[email protected]>; Deucher, Alexander <[email protected]>; [email protected] <[email protected]> *Cc:* Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 12 lines · SRINIVASAN
AMD General
Quoted 10 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 2:09 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; SHANMUGAM, SRINIVASAN <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: [PATCH] drm/amdgpu/userq: properly account for resetsWe need to increment the reset counter, force fence completion, and
set the
Quoted 3 lines
Quoted 3 lines
wedged event when a user queue is reset.
mes_userq_reset_queue()handles this for collateral damage, but thecaller needs
Quoted 10 lines
Quoted 10 lines
to handle this directly for the original guilty queue.
Signed-off-by Alex Deucher <[email protected]>Cc Srinivasan Shanmugam <[email protected]>Cc Prike Liang <[email protected]>Cc Sunil Khatri <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c| 7 ++++++-1 file changed, 6 insertions(+), 1 deletion(-)Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct · line 147
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) queue, NULL,NULL);
Quoted 15 lines
Quoted 6 lines
else
r =userq_funcs->reset(queue); - if (r)
+ if (r) {
gpu_reset= true;
+ } else {Quoted 8 lines
+
atomic_inc(&adev->gpu_reset_counter); +amdgpu_userq_fence_driver_force_completion(queue); +drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL);
+ }
} else {
gpu_reset= true;
}Quoted 1 line
After the original queue was reset successfully, it did not update
gpu_reset_counter, complete its pending fences, or send the wedged event.
Quoted 9 lines
Quoted 1 line
mes_userq_reset_queue()already updatesgpu_reset_counter, completesthe pending fences, and sends the wedged event for the other affected queues,
Quoted 1 line
but skips the original queue because it has already been reset.
What is the rationale of sending multiple device wedged events on a per queue basis?
The question of whether
drm_dev_wedged_event()should be emitted once per queue or once per overall recovery seems like a broader design discussion.
Along with that, also need to consider if device reset_counter needs to be incremented on a per queue basis or based on reset event recovery. It could get incremented multiple times inside this - mes_userq_reset_queue.
Thanks,
Lijo
Quoted 5 lines
Thanks,
Srini
AMD General
Quoted 89 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, July 14, 2026 4:02 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>; Deucher, Alexander <[email protected]>; amd- [email protected]
Cc: Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 5 lines · SRINIVASAN
AMD General
Quoted 7 lines
Get Outlook for Android <https://aka.ms/AAb9ysg>
----------------------------------------------------------------------
--
*From:* Lazar, Lijo <[email protected]>
*Sent:* Tuesday, July 14, 2026 3:14:34 PM
*To:* SHANMUGAM, SRINIVASAN <[email protected]>;Deucher,
Quoted 64 lines
Alexander <[email protected]>; [email protected] <[email protected]>
*Cc:* Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 4 lines · SRINIVASAN
AMD General
Quoted 2 lines
-----Original Message-----
From: Alex Deucher <[email protected]> >> Sent: Tuesday,July 14, 2026 2:09 AM >> To: [email protected] >> Cc:
Deucher, Alexander <[email protected]>; SHANMUGAM, >> SRINIVASAN <[email protected]>; Liang, Prike >> <[email protected]>; Khatri, Sunil <[email protected]> >>
Subject: [PATCH] drm/amdgpu/userq: properly account for resets >> >> We need to increment the reset counter, force fence completion, and set the >> wedged event when a user queue is reset.Quoted 2 lines
Quoted 2 lines
mes_userq_reset_queue()handles this for collateral damage, butthe caller needs >> to handle this directly for the original guilty queue.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Alex Deucher <[email protected]> >> Cc:Srinivasan Shanmugam <[email protected]> >> Cc: Prike Liang <[email protected]> >> Cc: Sunil Khatri <[email protected]> >> --- >>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c| 7 ++++++- >> 1 file
changed, 6 insertions(+), 1 deletion(-) >> >> diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Quoted 2 lines
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index6aa75da27f912..5e1262636e1e9100644 >> ---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Review static void
Quoted 2 lines
+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c(quoted diff) +0
-0@@ -146,8 +146,13 @@ static voidamdgpu_userq_hang_detect_work(struct
Quoted 2 lines
Review static void · line 147
Quoted 2 lines
(quoted diff) +0
-0work_struct *work) queue,NULL, NULL); >> else >> r =
userq_funcs->reset(queue); >> - if (r) >> +
if (r) { >>gpu_reset= true; >> +
} else { >> +atomic_inc(&adev->gpu_reset_counter);Quoted 1 line
Review static void · line 148
Quoted 1 line
(quoted diff) +1
-0+
amdgpu_userq_fence_driver_force_completion(queue);Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct work_struct *work) · line 158
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2
-0+drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL ); + } }else { gpu_reset = true; }After the original queue was reset successfully, it did not update
gpu_reset_counter, complete its pending fences, or send the wedged event.Quoted 1 line
mes_userq_reset_queue()already updatesgpu_reset_counter,completes the pending fences, and sends the wedged event for the other affected queues, > but skips the original queue because it has already been reset.
What is the rationale of sending multiple device wedged events on a per queue basis?
Quoted 8 lines
Quoted 4 lines
The question of whether
drm_dev_wedged_event()should be emitted once per queue or once per overall recovery seems like a broader design discussion.Along with that, also need to consider if device
reset_counterneeds to be incremented on a per queue basis or based on reset event recovery. It could get incremented multiple times inside this -mes_userq_reset_queue.
Looking at the current flow, both gpu_reset_counter and drm_dev_wedged_event() are updated once for each successfully reset queue. It would be helpful to clarify whether they are intended to be updated per affected queue or once per overall recovery.
Thanks,
Srini
Quoted 9 lines
Thanks,
LijoQuoted 5 lines
Thanks,
Srini
Quoted 97 lines · SRINIVASAN
AMD General
Quoted 94 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, July 14, 2026 4:02 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>; Deucher, Alexander <[email protected]>; amd- [email protected]
Cc: Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 5 lines · SRINIVASAN
AMD General
Quoted 7 lines
Get Outlook for Android <https://aka.ms/AAb9ysg>
----------------------------------------------------------------------
--
*From:* Lazar, Lijo <[email protected]>
*Sent:* Tuesday, July 14, 2026 3:14:34 PM
*To:* SHANMUGAM, SRINIVASAN <[email protected]>;Deucher,
Quoted 68 lines
Alexander <[email protected]>; [email protected] <[email protected]>
*Cc:* Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 4 lines · SRINIVASAN
AMD General
Quoted 2 lines
-----Original Message-----
From: Alex Deucher <[email protected]> >> Sent: Tuesday,July 14, 2026 2:09 AM >> To: [email protected] >> Cc:
Deucher, Alexander <[email protected]>; SHANMUGAM, >> SRINIVASAN <[email protected]>; Liang, Prike >> <[email protected]>; Khatri, Sunil <[email protected]> >>
Subject: [PATCH] drm/amdgpu/userq: properly account for resets >> >> We need to increment the reset counter, force fence completion, and set the >> wedged event when a user queue is reset.Quoted 2 lines
Quoted 2 lines
mes_userq_reset_queue()handles this for collateral damage, butthe caller needs >> to handle this directly for the original guilty queue.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Alex Deucher <[email protected]> >> Cc:Srinivasan Shanmugam <[email protected]> >> Cc: Prike Liang <[email protected]> >> Cc: Sunil Khatri <[email protected]> >> --- >>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c| 7 ++++++- >> 1 file
changed, 6 insertions(+), 1 deletion(-) >> >> diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Quoted 2 lines
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index6aa75da27f912..5e1262636e1e9100644 >> ---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Review static void
Quoted 2 lines
+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c(quoted diff) +0
-0@@ -146,8 +146,13 @@ static voidamdgpu_userq_hang_detect_work(struct
Quoted 2 lines
Review static void · line 147
Quoted 2 lines
(quoted diff) +0
-0work_struct *work) queue,NULL, NULL); >> else >> r =
userq_funcs->reset(queue); >> - if (r) >> +
if (r) { >>gpu_reset= true; >> +
} else { >> +atomic_inc(&adev->gpu_reset_counter);Quoted 1 line
Review static void · line 148
Quoted 1 line
(quoted diff) +1
-0+
amdgpu_userq_fence_driver_force_completion(queue);Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct work_struct *work) · line 158
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2
-0+drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ,NULL ); + } }else { gpu_reset = true; }After the original queue was reset successfully, it did not update
gpu_reset_counter, complete its pending fences, or send the wedged event.Quoted 1 line
mes_userq_reset_queue()already updatesgpu_reset_counter,completes the pending fences, and sends the wedged event for the other affected queues, > but skips the original queue because it has already been reset.
What is the rationale of sending multiple device wedged events on a per queue basis?
The question of whether
drm_dev_wedged_event()should be emitted once per queue or once per overall recovery seems like a broader design discussion.
Quoted 6 lines
Quoted 3 lines
Along with that, also need to consider if device
reset_counterneeds to be incremented on a per queue basis or based on reset event recovery. It could get incremented multiple times inside this -mes_userq_reset_queue.Looking at the current flow, both
gpu_reset_counteranddrm_dev_wedged_event()are updated once for each successfully reset queue. It would be helpful to clarify whether they are intended to be updated per affected queue or once per overall recovery.
What are the semantics around the reset counter and wedged events? Presumably each should be incremented for each queue that is reset? If a hang affects multiple queues shouldn't each be a separate "reset"? In the most common case, there should just be one since queue reset should be able to reset just the guilty queue.
Alex
Quoted 13 lines
Thanks,
SriniQuoted 9 lines
Thanks,
LijoQuoted 5 lines
Thanks,
Srini
AMD General
Quoted 126 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 7:26 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>
Cc: Lazar, Lijo <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 7 lines · SRINIVASAN
AMD General
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, July 14, 2026 4:02 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>;Deucher,
Quoted 14 lines
Quoted 14 lines
Alexander <[email protected]>; amd- [email protected]
Cc: Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 5 lines · SRINIVASAN
AMD General
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Get Outlook for Android <https://aka.ms/AAb9ysg>
------------------------------------------------------------------
----
--
*From:* Lazar, Lijo <[email protected]>
*Sent:* Tuesday, July 14, 2026 3:14:34 PM
*To:* SHANMUGAM, SRINIVASANQuoted 10 lines
Quoted 10 lines
Deucher,
Quoted 9 lines
Alexander <[email protected]>; [email protected] <[email protected]> *Cc:* Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 6 lines
Quoted 6 lines
Quoted 6 lines · SRINIVASAN
Quoted 4 lines
AMD General
Quoted 2 lines
-----Original Message-----
From: Alex Deucher <[email protected]> >> Sent:Tuesday, July 14, 2026 2:09 AM >> To: [email protected] >>
Cc:
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Deucher, Alexander <[email protected]>; SHANMUGAM, >> SRINIVASAN <[email protected]>; Liang, Prike >> <[email protected]>; Khatri, Sunil <[email protected]> >>
Subject: [PATCH] drm/amdgpu/userq: properly account for resets >>Quoted 1 line
Quoted 1 line
We need to increment the reset counter, force fence completion,
and set the >> wedged event when a user queue is reset.
Quoted 2 lines
Quoted 2 lines
mes_userq_reset_queue()handles this for collateral damage,but the caller needs >> to handle this directly for the original guilty queue.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Alex Deucher <[email protected]> >> Cc:Srinivasan Shanmugam <[email protected]> >> Cc: Prike Liang <[email protected]> >> Cc: Sunil Khatri <[email protected]> >> --- >>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c| 7 ++++++- >> 1 file
changed, 6 insertions(+), 1 deletion(-) >> >> diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Quoted 2 lines
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index6aa75da27f912..5e1262636e1e9100644 >> ---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Review static void
Quoted 2 lines
+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c(quoted diff) +0
-0@@ -146,8 +146,13 @@ static voidamdgpu_userq_hang_detect_work(struct
Quoted 2 lines
Review static void · line 147
Quoted 2 lines
(quoted diff) +0
-0work_struct *work) queue,NULL, NULL); >> else >> r =
userq_funcs->reset(queue); >> - if (r) >> +
if (r) { >>gpu_reset= true; >> +
} else { >> +atomic_inc(&adev->gpu_reset_counter);Quoted 1 line
Review static void · line 148
Quoted 1 line
(quoted diff) +1
-0+
amdgpu_userq_fence_driver_force_completion(queue);Quoted 7 lines
Quoted 6 lines
(quoted diff) +2
-0+ drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); + } } else { gpu_reset = true; }Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
After the original queue was reset successfully, it did not
update
gpu_reset_counter, complete its pending fences, or send the wedgedevent.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
mes_userq_reset_queue()already updatesgpu_reset_counter,completes the pending fences, and sends the wedged event for the other affected queues, > but skips the original queue because it has already been reset.
What is the rationale of sending multiple device wedged events on a per queue basis?
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
The question of whether
drm_dev_wedged_event()should be emitted once per queue or once per overall recovery seems like a broader design discussion.Along with that, also need to consider if device
reset_counterneeds to be incremented on a per queue basis or based on reset event recovery. It could get incremented multiple times inside this -
mes_userq_reset_queue.Quoted 2 lines
Looking at the current flow, both
gpu_reset_counterand
drm_dev_wedged_event()are updated once for each successfully reset queue. It would be helpful to clarify whether they are intended to be updated per affected queue or once per overall recovery.Quoted 1 line
Quoted 5 lines
What are the semantics around the reset counter and wedged events? Presumably each should be incremented for each queue that is reset? If a hang affects multiple queues shouldn't each be a separate "reset"?
In the most common case, there should just be one since queue reset should be able to reset just the guilty queue.
Thanks for the clarification, Alex. Understood that the reset counter and wedged event are intended to be updated once for each queue that is reset.
Best Regards,
Srini
Quoted 2 lines
Alex
Quoted 129 lines · SRINIVASAN
AMD General
Quoted 126 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, July 14, 2026 7:26 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>
Cc: Lazar, Lijo <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 7 lines · SRINIVASAN
AMD General
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, July 14, 2026 4:02 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>;Deucher,
Quoted 14 lines
Quoted 14 lines
Alexander <[email protected]>; amd- [email protected]
Cc: Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 5 lines · SRINIVASAN
AMD General
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Get Outlook for Android <https://aka.ms/AAb9ysg>
------------------------------------------------------------------
----
--
*From:* Lazar, Lijo <[email protected]>
*Sent:* Tuesday, July 14, 2026 3:14:34 PM
*To:* SHANMUGAM, SRINIVASANQuoted 10 lines
Quoted 10 lines
Deucher,
Quoted 9 lines
Alexander <[email protected]>; [email protected] <[email protected]> *Cc:* Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 6 lines
Quoted 6 lines
Quoted 6 lines · SRINIVASAN
Quoted 4 lines
AMD General
Quoted 2 lines
-----Original Message-----
From: Alex Deucher <[email protected]> >> Sent:Tuesday, July 14, 2026 2:09 AM >> To: [email protected] >>
Cc:
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Deucher, Alexander <[email protected]>; SHANMUGAM, >> SRINIVASAN <[email protected]>; Liang, Prike >> <[email protected]>; Khatri, Sunil <[email protected]> >>
Subject: [PATCH] drm/amdgpu/userq: properly account for resets >>Quoted 1 line
Quoted 1 line
We need to increment the reset counter, force fence completion,
and set the >> wedged event when a user queue is reset.
Quoted 2 lines
Quoted 2 lines
mes_userq_reset_queue()handles this for collateral damage,but the caller needs >> to handle this directly for the original guilty queue.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Alex Deucher <[email protected]> >> Cc:Srinivasan Shanmugam <[email protected]> >> Cc: Prike Liang <[email protected]> >> Cc: Sunil Khatri <[email protected]> >> --- >>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c| 7 ++++++- >> 1 file
changed, 6 insertions(+), 1 deletion(-) >> >> diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Quoted 2 lines
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index6aa75da27f912..5e1262636e1e9100644 >> ---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Review static void
Quoted 2 lines
+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c(quoted diff) +0
-0@@ -146,8 +146,13 @@ static voidamdgpu_userq_hang_detect_work(struct
Quoted 2 lines
Review static void · line 147
Quoted 2 lines
(quoted diff) +0
-0work_struct *work) queue,NULL, NULL); >> else >> r =
userq_funcs->reset(queue); >> - if (r) >> +
if (r) { >>gpu_reset= true; >> +
} else { >> +atomic_inc(&adev->gpu_reset_counter);Quoted 1 line
Review static void · line 148
Quoted 1 line
(quoted diff) +1
-0+
amdgpu_userq_fence_driver_force_completion(queue);Quoted 7 lines
Quoted 6 lines
(quoted diff) +2
-0+ drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); + } } else { gpu_reset = true; }Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
After the original queue was reset successfully, it did not
update
gpu_reset_counter, complete its pending fences, or send the wedgedevent.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
mes_userq_reset_queue()already updatesgpu_reset_counter,completes the pending fences, and sends the wedged event for the other affected queues, > but skips the original queue because it has already been reset.
What is the rationale of sending multiple device wedged events on a per queue basis?
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
The question of whether
drm_dev_wedged_event()should be emitted once per queue or once per overall recovery seems like a broader design discussion.Along with that, also need to consider if device
reset_counterneeds to be incremented on a per queue basis or based on reset event recovery. It could get incremented multiple times inside this -
mes_userq_reset_queue.Quoted 2 lines
Looking at the current flow, both
gpu_reset_counterand
drm_dev_wedged_event()are updated once for each successfully reset queue. It would be helpful to clarify whether they are intended to be updated per affected queue or once per overall recovery.Quoted 1 line
Quoted 7 lines
Quoted 5 lines
What are the semantics around the reset counter and wedged events? Presumably each should be incremented for each queue that is reset? If a hang affects multiple queues shouldn't each be a separate "reset"?
In the most common case, there should just be one since queue reset should be able to reset just the guilty queue.Thanks for the clarification, Alex. Understood that the reset counter and wedged event are intended to be updated once for each queue that is reset.
Well, I guess that is the question. We are the semantics around these?
Alex
Quoted 6 lines
Best Regards,
SriniQuoted 2 lines
Alex
Quoted 103 lines · Alex Deucher
Quoted 101 lines · SRINIVASAN
AMD General
Quoted 97 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, July 14, 2026 4:02 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>; Deucher, Alexander <[email protected]>; amd- [email protected]
Cc: Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 5 lines · SRINIVASAN
AMD General
Quoted 7 lines
Get Outlook for Android <https://aka.ms/AAb9ysg>
----------------------------------------------------------------------
--
*From:* Lazar, Lijo <[email protected]>
*Sent:* Tuesday, July 14, 2026 3:14:34 PM
*To:* SHANMUGAM, SRINIVASAN <[email protected]>;Deucher,
Quoted 61 lines
Alexander <[email protected]>; [email protected] <[email protected]>
*Cc:* Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 4 lines · SRINIVASAN
AMD General
Quoted 2 lines
-----Original Message-----
From: Alex Deucher <[email protected]> >> Sent: Tuesday,July 14, 2026 2:09 AM >> To: [email protected] >> Cc:
Deucher, Alexander <[email protected]>; SHANMUGAM, >> SRINIVASAN <[email protected]>; Liang, Prike >> <[email protected]>; Khatri, Sunil <[email protected]> >>
Subject: [PATCH] drm/amdgpu/userq: properly account for resets >> >> We need to increment the reset counter, force fence completion, and set the >> wedged event when a user queue is reset.Quoted 2 lines
Quoted 2 lines
mes_userq_reset_queue()handles this for collateral damage, butthe caller needs >> to handle this directly for the original guilty queue.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Alex Deucher <[email protected]> >> Cc:Srinivasan Shanmugam <[email protected]> >> Cc: Prike Liang <[email protected]> >> Cc: Sunil Khatri <[email protected]> >> --- >>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c| 7 ++++++- >> 1 file
changed, 6 insertions(+), 1 deletion(-) >> >> diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Quoted 2 lines
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index6aa75da27f912..5e1262636e1e9100644 >> ---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.cQuoted 2 lines
Review static void
Quoted 2 lines
+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c(quoted diff) +0
-0@@ -146,8 +146,13 @@ static voidamdgpu_userq_hang_detect_work(struct
Quoted 2 lines
Review static void · line 147
Quoted 2 lines
(quoted diff) +0
-0work_struct *work) queue,NULL, NULL); >> else >> r =
userq_funcs->reset(queue); >> - if (r) >> +
if (r) { >>gpu_reset= true; >> +
} else { >> +atomic_inc(&adev->gpu_reset_counter);Quoted 1 line
Review static void · line 148
Quoted 1 line
(quoted diff) +1
-0+
amdgpu_userq_fence_driver_force_completion(queue);Quoted 8 lines
Review static void · line 154
Quoted 6 lines
(quoted diff) +2
-0+ drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); + } } else { gpu_reset = true; }After the original queue was reset successfully, it did not update
gpu_reset_counter, complete its pending fences, or send the wedged event.Quoted 1 line
mes_userq_reset_queue()already updatesgpu_reset_counter,completes the pending fences, and sends the wedged event for the other affected queues, > but skips the original queue because it has already been reset.
Quoted 7 lines
What is the rationale of sending multiple device wedged events on a per queue basis?
The question of whether
drm_dev_wedged_event()should be emitted once per queue or once per overall recovery seems like a broader design discussion.Along with that, also need to consider if device
reset_counterneeds to be incremented on a per queue basis or based on reset event recovery. It could get incremented multiple times inside this -mes_userq_reset_queue.
Quoted 9 lines
Quoted 2 lines
Looking at the current flow, both
gpu_reset_counteranddrm_dev_wedged_event()are updated once for each successfully reset queue. It would be helpful to clarify whether they are intended to be updated per affected queue or once per overall recovery.What are the semantics around the reset counter and wedged events? Presumably each should be incremented for each queue that is reset? If a hang affects multiple queues shouldn't each be a separate "reset"? In the most common case, there should just be one since queue reset should be able to reset just the guilty queue.
Device wedged event is a udev event. It's not good to send multiple events when multiple queues are recovered as part of single recovery process. Otherwise userspace monitoring the device will see back to back events. There is no context associated so it doesn't have any clue of what sort of reset happened.
I think the same goes with device. I believe it's to indicate a recovery event associated with device and not as a per queue event.
Thanks,
Lijo
Quoted 15 lines
Alex
Quoted 13 lines
Thanks,
SriniQuoted 9 lines
Thanks,
LijoQuoted 5 lines
Thanks,
Srini
Quoted 116 lines · Lijo
Quoted 103 lines · Alex Deucher
Quoted 101 lines · SRINIVASAN
AMD General
Quoted 97 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, July 14, 2026 4:02 PM
To: SHANMUGAM, SRINIVASAN <[email protected]>; Deucher, Alexander <[email protected]>; amd- [email protected]
Cc: Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: properly account for resetsQuoted 5 lines · SRINIVASAN
AMD General
Quoted 7 lines
Get Outlook for Android <https://aka.ms/AAb9ysg>
----------------------------------------------------------------------
Signature · 3 lines
*From:* Lazar, Lijo <[email protected]> *Sent:* Tuesday, July 14, 2026 3:14:34 PM *To:* SHANMUGAM, SRINIVASAN <[email protected]>;Deucher,
Quoted 61 lines
Alexander <[email protected]>; [email protected] <[email protected]>
*Cc:* Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu/userq: properly account for resetsOn 14-Jul-26 10:16 AM, SHANMUGAM, SRINIVASAN wrote:
> AMD General
>
>> -----Original Message-----
>> From: Alex Deucher <[email protected]> >> Sent: Tuesday, July 14, 2026 2:09 AM >> To: [email protected] >> Cc:
Deucher, Alexander <[email protected]>; SHANMUGAM, >> SRINIVASAN <[email protected]>; Liang, Prike >> <[email protected]>; Khatri, Sunil <[email protected]> >>
Subject: [PATCH] drm/amdgpu/userq: properly account for resets >> >> We need to increment the reset counter, force fence completion, and set the >> wedged event when a user queue is reset.
>>
>>mes_userq_reset_queue()handles this for collateral damage, but the caller needs >> to handle this directly for the original guilty queue.
>>
>> Signed-off-by: Alex Deucher <[email protected]> >> Cc:
Srinivasan Shanmugam <[email protected]> >> Cc: Prike Liang <[email protected]> >> Cc: Sunil Khatri <[email protected]> >> --- >>drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c| 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
>>b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
>> index6aa75da27f912..5e1262636e1e9100644 >> ---a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
>> +++b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
>> @@ -146,8 +146,13 @@ static void amdgpu_userq_hang_detect_work(struct
>>work_struct*work)
>> queue, NULL, NULL); >> else >> r = userq_funcs->reset(queue); >> - if (r) >> +
if (r) { >>gpu_reset= true; >> +
} else { >> +atomic_inc(&adev->gpu_reset_counter);
>> +amdgpu_userq_fence_driver_force_completion(queue);
>> +drm_dev_wedged_event(adev_to_drm(adev), >> DRM_WEDGE_RECOVERY_NONE, NULL);
>> + }
>> } else {
>>gpu_reset= true;
>> }
>
> After the original queue was reset successfully, it did not updategpu_reset_counter, complete its pending fences, or send the wedged event. >mes_userq_reset_queue()already updatesgpu_reset_counter, completes the pending fences, and sends the wedged event for the other affected queues, > but skips the original queue because it has already been reset.Quoted 7 lines
What is the rationale of sending multiple device wedged events on a per queue basis?
The question of whether
drm_dev_wedged_event()should be emitted once per queue or once per overall recovery seems like a broader design discussion.Along with that, also need to consider if device
reset_counterneeds to be incremented on a per queue basis or based on reset event recovery. It could get incremented multiple times inside this -mes_userq_reset_queue.Quoted 9 lines
Quoted 2 lines
Looking at the current flow, both
gpu_reset_counteranddrm_dev_wedged_event()are updated once for each successfully reset queue. It would be helpful to clarify whether they are intended to be updated per affected queue or once per overall recovery.What are the semantics around the reset counter and wedged events? Presumably each should be incremented for each queue that is reset? If a hang affects multiple queues shouldn't each be a separate "reset"? In the most common case, there should just be one since queue reset should be able to reset just the guilty queue.
Quoted 4 lines
Device wedged event is a udev event. It's not good to send multiple events when multiple queues are recovered as part of single recovery process. Otherwise userspace monitoring the device will see back to back events. There is no context associated so it doesn't have any clue of what sort of reset happened.
I think the same goes with device. I believe it's to indicate a recovery event associated with device and not as a per queue event.
"I think the same goes with device" = device reset counter
Thanks,
Lijo
Quoted 19 lines
Thanks,
LijoQuoted 15 lines
Alex
Quoted 13 lines
Thanks,
SriniQuoted 9 lines
Thanks,
LijoQuoted 5 lines
Thanks,
Srini