]> git.hungrycats.org Git - linux/commitdiff
drm/amdgpu: Remove faulty queue before resume
authorAmber Lin <Amber.Lin@amd.com>
Fri, 29 May 2026 19:36:52 +0000 (15:36 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jun 2026 19:51:36 +0000 (15:51 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c

index d7b595e3f115614d4662405330033555eb786cfb..ff5a55f5f3c9e1a4c5a257943304ed8262ded6eb 100644 (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 @@ fence_reset:
                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);
index d40bc86a6178f933624a7d228fecfe92c4aad784..4003360c7d9a88f8dea01c2f3ebdfeb3f8b5b58e 100644 (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,
index 5f0f8a5e3b7d5e892e6d6deb3783a7a479b2dbe5..4e3bd505c368dcb456e1158fd43b0d7b77b89f90 100644 (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)
index 244c51c70c7e1e3891ea0ef234941c4a892c8041..0bd9d8a21f5e1c5faeaaa26fc7f5f5544546c26b 100644 (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)
index 1334402d211d1546d884d6a7c5d5c6f4c5cebb5c..380ba062134e485857d5e38113599c99af4650ae 100644 (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)
index 6054c8e216b8e7e996bba581ba65a8eb9c45bcd0..744b6c65107f92c3ddf9b5c312d7462feb8b61c6 100644 (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;