drm/amdgpu: Remove faulty queue before resume

When driver already knows a bad queue but MES suspend_all is successful
and MES hung queue detection doesn't detect it, remove this queue refore
resume_all.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Amber Lin
2026-05-29 15:36:52 -04:00
committed by Alex Deucher
parent 913c0d83be
commit f401a2633e
6 changed files with 23 additions and 6 deletions

View File

@@ -2244,7 +2244,8 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev,
struct amdgpu_ring *ring,
struct amdgpu_fence *guilty_fence,
struct amdgpu_usermode_queue *uq,
unsigned int *hung_queue_count)
unsigned int *hung_queue_count,
void *faulty_queue_input)
{
struct amdgpu_mes_hung_queue_hqd_info *hqd_info =
(struct amdgpu_mes_hung_queue_hqd_info *)
@@ -2252,6 +2253,7 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev,
int i, r, pipe, queue, queue_type;
unsigned int num_hung = 0;
bool use_mmio = adev->gfx.mec.use_mmio_for_reset;
struct mes_remove_queue_input *queue_input = (struct mes_remove_queue_input *)faulty_queue_input;
guard(mutex)(&adev->gfx.mec.reset_mutex);
/* stop the drm schedulers for all compute queues */
@@ -2306,6 +2308,20 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev,
if (r)
goto out;
}
/* MES doesn't detect any hung queue but we have a known bad queue
* and it is not KCQ
*/
if (!num_hung && queue_input && !ring) {
/* MES suspend_all is successful means this bad queue is
* preempted successfuly. Remove it before resume all so it
* doesn't get mapped back
*/
amdgpu_mes_lock(&adev->mes);
r = adev->mes.funcs->remove_hw_queue(&adev->mes, queue_input);
amdgpu_mes_unlock(&adev->mes);
}
out:
/* resume all will enable the non-hung queues */
amdgpu_mes_resume(adev, 0);

View File

@@ -651,7 +651,8 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev,
struct amdgpu_ring *ring,
struct amdgpu_fence *guilty_fence,
struct amdgpu_usermode_queue *uq,
unsigned int *hung_queue_count);
unsigned int *hung_queue_count,
void *faulty_queue_input);
void amdgpu_gfx_ras_error_func(struct amdgpu_device *adev,
void *ras_error_status,
void (*func)(struct amdgpu_device *adev, void *ras_error_status,

View File

@@ -141,7 +141,7 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work)
int r;
if (queue->queue_type == AMDGPU_HW_IP_COMPUTE)
r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, NULL);
r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, NULL, NULL);
else
r = userq_funcs->reset(queue);
if (r)

View File

@@ -6835,7 +6835,7 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring,
{
struct amdgpu_device *adev = ring->adev;
return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL);
return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL, NULL);
}
static void gfx_v11_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p)

View File

@@ -5261,7 +5261,7 @@ static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring,
{
struct amdgpu_device *adev = ring->adev;
return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL);
return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL, NULL);
}
static void gfx_v12_0_ring_begin_use(struct amdgpu_ring *ring)

View File

@@ -464,7 +464,7 @@ static int reset_queues_mes(struct device_queue_manager *dqm)
goto fail;
}
r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, &num_hung);
r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, &num_hung, NULL);
if (r)
goto fail;