drm/amdgpu: resume MES scheduling after user queue hang detection and recovery
Subsystems (2)
PATCH 1/1 drm/amdgpu: resume MES scheduling after user queue hang detection and recovery
This patch ensures the MES is properly resumed
after detecting and recovering from a user queue hang condition.
Key changes:
1. Track when a hung user queue is detected using found_hung_queue flag
2. Call amdgpu_mes_resume() to restart MES scheduling after completing the hang recovery process
3. This complements the existing recovery steps (fence force completion and device wedging) by ensuring the scheduler can process new work
Without this resume call, the MES scheduler may remain in a paused state even after the hung queue has been handled, preventing newly submitted work from being processed and leading to system stalls.
--- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +7 -0
@@ -208,6 +208,7 @@ static int mes_userq_detect_and_reset(struct amdgpu_device *adev,unsigned int hung_db_num =0 ;unsigned long queue_id;u32 db_array[8 ]; +bool found_hung_queue =false;int r, i;if (db_array_size >8 ) {
@@ -232,6 +233,7 @@ static int mes_userq_detect_and_reset(struct amdgpu_device *adev,for (i =0 ; i < hung_db_num; i++) {if (queue->doorbell_index == db_array[i]) { queue->state =AMDGPU_USERQ_STATE_HUNG ; + found_hung_queue = true;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 );
@@ -241,6 +243,11 @@ static int mes_userq_detect_and_reset(struct amdgpu_device *adev, } } +if (found_hung_queue) { +/* Resume scheduling after hang recovery */ + r =amdgpu_mes_resume (adev); + } +return r; }
Signature · 1 line
2.49.0
Quoted 11 lines · Jesse.Zhang
This patch ensures the MES is properly resumed
after detecting and recovering from a user queue hang condition.Key changes:
1. Track when a hung user queue is detected usingfound_hung_queueflag
2. Callamdgpu_mes_resume()to restart MES scheduling after completing the hang recovery process
3. This complements the existing recovery steps (fence force completion and device wedging) by ensuring the scheduler can process new work
Quoted 5 lines
Without this resume call, the MES scheduler may remain in a paused state even after the hung queue has been handled, preventing newly submitted work from being processed and leading to system stalls.
Signed-off-by Jesse Zhang <[email protected]>
Quoted 39 lines
--- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +7
-1@@ -208,6 +208,7 @@ static int mes_userq_detect_and_reset(struct amdgpu_device *adev,unsigned int hung_db_num =0 ;unsigned long queue_id;u32 db_array[8 ]; +bool found_hung_queue =false;int r, i;if (db_array_size >8 ) {@@ -232,6 +233,7 @@ static int mes_userq_detect_and_reset(struct amdgpu_device *adev,for (i =0 ; i < hung_db_num; i++) {if (queue->doorbell_index == db_array[i]) { queue->state =AMDGPU_USERQ_STATE_HUNG ; + found_hung_queue = true;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 );@@ -241,6 +243,11 @@ static int mes_userq_detect_and_reset(struct amdgpu_device *adev, } } +if (found_hung_queue) { +/* Resume scheduling after hang recovery */ + r =amdgpu_mes_resume (adev); + } +return r; } --2.49.0
[Public]
OK, so that looks the queue is not the functional status as I pointed out in the last meeting. We might to check the queue whether is remapped or active before performing the queue resume.
Regards,
Prike
Quoted 77 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, November 7, 2025 10:07 PM
To: Zhang, Jesse(Jie) <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: resume MES scheduling after user queue hang detection and recoveryQuoted 11 lines · Jesse.Zhang
This patch ensures the MES is properly resumed after detecting and recovering from a user queue hang condition.
Key changes:
1. Track when a hung user queue is detected usingfound_hung_queueflag 2. Callamdgpu_mes_resume()to restart MES scheduling after completing the hang recovery process
3. This complements the existing recovery steps (fence force completion and device wedging) by ensuring the scheduler can process new workQuoted 5 lines
Without this resume call, the MES scheduler may remain in a paused state even after the hung queue has been handled, preventing newly submitted work from being processed and leading to system stalls.
Signed-off-by Jesse Zhang <[email protected]>Acked-by Alex Deucher <[email protected]>drivers/gpu/drm/amd/amdgpu/mes_userqueue.c static int mes_userq_detect_and_reset(struct
Quoted 10 lines
--- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +0
-0@@ -208,6 +208,7 @@ static int mes_userq_detect_and_reset(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/mes_userqueue.c static int mes_userq_detect_and_reset(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +1
-0unsigned int hung_db_num =0 ;unsigned long queue_id;u32 db_array[8 ]; +bool found_hung_queue =false;int r, i;if (db_array_size >8 ) {@@ -232,6 +233,7 @@ static int mes_userq_detect_and_reset(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/mes_userqueue.c static int mes_userq_detect_and_reset(struct · line 239
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +2
-0for (i =0 ; i < hung_db_num; i++) {if (queue->doorbell_index == db_array[i]) { queue->state =AMDGPU_USERQ_STATE_HUNG ; + found_hung_queue = + true;atomic_inc (&adev->gpu_reset_counter);
amdgpu_userq_fence_driver_force_completion(queue);Quoted 2 lines
drm_dev_wedged_event(adev_to_drm(adev),
DRM_WEDGE_RECOVERY_NONE, NULL); @@ -241,6 +243,11 @@ static int mes_userq_detect_and_reset(structamdgpu_device*adev,Quoted 14 lines
} }drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +5
-1+if (found_hung_queue) { +/* Resume scheduling after hang recovery */ + r =amdgpu_mes_resume (adev); + } +return r; } --2.49.0
[Public]
Quoted 10 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, November 10, 2025 9:49 AM
To: Alex Deucher <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: resume MES scheduling after user queue hang detection and recovery
Quoted 6 lines
[Public]
OK, so that looks the queue is not the functional status as I pointed out in the last meeting.
We might to check the queue whether is remapped or active before performing the queue resume.
[Zhang, Jesse(Jie)] The MES firmware will check the registers regCP_GFX_HQD_ACTIVE/regCP_HQD_ACTIVE_ACTIVE after a reset.
Thanks
Jesse
Quoted 85 lines
Regards,
PrikeQuoted 80 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, November 7, 2025 10:07 PM
To: Zhang, Jesse(Jie) <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: resume MES scheduling after user queue hang detection and recoveryQuoted 12 lines · Jesse.Zhang
This patch ensures the MES is properly resumed after detecting and recovering from a user queue hang condition.
Key changes:
1. Track when a hung user queue is detected usingfound_hung_queueflag 2. Callamdgpu_mes_resume()to restart MES scheduling after completing the hang recovery process
3. This complements the existing recovery steps (fence force completion and device wedging) by ensuring the scheduler can process new
workQuoted 5 lines
Without this resume call, the MES scheduler may remain in a paused state even after the hung queue has been handled, preventing newly submitted work from being processed and leading to system stalls.
Signed-off-by Jesse Zhang <[email protected]>Acked-by Alex Deucher <[email protected]>drivers/gpu/drm/amd/amdgpu/mes_userqueue.c static int mes_userq_detect_and_reset(struct
Quoted 10 lines
--- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +0
-0@@ -208,6 +208,7 @@ static int mes_userq_detect_and_reset(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/mes_userqueue.c static int mes_userq_detect_and_reset(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +1
-0unsigned int hung_db_num =0 ;unsigned long queue_id;u32 db_array[8 ]; +bool found_hung_queue =false;int r, i;if (db_array_size >8 ) {@@ -232,6 +233,7 @@ static int mes_userq_detect_and_reset(struct
amdgpu_device*adev,Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +2
-0for (i =0 ; i < hung_db_num; i++) {if (queue->doorbell_index == db_array[i]) { queue->state =AMDGPU_USERQ_STATE_HUNG ; + found_hung_queue = + true;
atomic_inc(&adev->gpu_reset_counter);
amdgpu_userq_fence_driver_force_completion(queue);Quoted 2 lines
drm_dev_wedged_event(adev_to_drm(adev),
DRM_WEDGE_RECOVERY_NONE, NULL); @@ -241,6 +243,11 @@ static int mes_userq_detect_and_reset(structamdgpu_device*adev,Quoted 14 lines
} }drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +5
-1+if (found_hung_queue) { +/* Resume scheduling after hang recovery */ + r =amdgpu_mes_resume (adev); + } +return r; } --2.49.0
[Public]
Regards,
Prike
Quoted 23 lines
-----Original Message-----
From: Zhang, Jesse(Jie) <[email protected]>
Sent: Monday, November 10, 2025 1:38 PM
To: Liang, Prike <[email protected]>; Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: resume MES scheduling after user queue hang detection and recovery[Public]
Quoted 11 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Monday, November 10, 2025 9:49 AM
To: Alex Deucher <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: resume MES scheduling after user queue hang detection and recovery
Quoted 8 lines
Quoted 6 lines
[Public]
OK, so that looks the queue is not the functional status as I pointed out in the last meeting.
We might to check the queue whether is remapped or active before performing the queue resume.[Zhang, Jesse(Jie)] The MES firmware will check the registers regCP_GFX_HQD_ACTIVE/regCP_HQD_ACTIVE_ACTIVE after a reset.
If all the queue that requires being active outside of firmware, then that's fine to always keeping queue resume in the driver.
Quoted 88 lines
Thanks
JesseQuoted 85 lines
Regards,
PrikeQuoted 80 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, November 7, 2025 10:07 PM
To: Zhang, Jesse(Jie) <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: resume MES scheduling after user queue hang detection and recoveryQuoted 12 lines · Jesse.Zhang
This patch ensures the MES is properly resumed after detecting and recovering from a user queue hang condition.
Key changes:
1. Track when a hung user queue is detected usingfound_hung_queueflag 2. Callamdgpu_mes_resume()to restart MES scheduling after completing the hang recovery process
3. This complements the existing recovery steps (fence force completion and device wedging) by ensuring the scheduler can process new
workQuoted 5 lines
Without this resume call, the MES scheduler may remain in a paused state even after the hung queue has been handled, preventing newly submitted work from being processed and leading to system stalls.
Signed-off-by Jesse Zhang <[email protected]>Acked-by Alex Deucher <[email protected]>drivers/gpu/drm/amd/amdgpu/mes_userqueue.c static int mes_userq_detect_and_reset(struct
Quoted 10 lines
--- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +0
-0@@ -208,6 +208,7 @@ static int mes_userq_detect_and_reset(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/mes_userqueue.c static int mes_userq_detect_and_reset(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +1
-0unsigned int hung_db_num =0 ;unsigned long queue_id;u32 db_array[8 ]; +bool found_hung_queue =false;int r, i;if (db_array_size >8 ) {@@ -232,6 +233,7 @@ static int mes_userq_detect_and_reset(struct
amdgpu_device*adev,Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +2
-0for (i =0 ; i < hung_db_num; i++) {if (queue->doorbell_index == db_array[i]) { queue->state =AMDGPU_USERQ_STATE_HUNG ; + found_hung_queue = + true;
atomic_inc(&adev->gpu_reset_counter);
amdgpu_userq_fence_driver_force_completion(queue);Quoted 2 lines
drm_dev_wedged_event(adev_to_drm(adev),
DRM_WEDGE_RECOVERY_NONE, NULL); @@ -241,6 +243,11 @@ static int mes_userq_detect_and_reset(structamdgpu_device*adev,Quoted 14 lines
} }drivers/gpu/drm/amd/amdgpu/mes_userqueue.c +5
-1+if (found_hung_queue) { +/* Resume scheduling after hang recovery */ + r =amdgpu_mes_resume (adev); + } +return r; } --2.49.0