Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/amdgpu: broken !amdgpu_gpu_recovery flow in amdgpu_gfx_reset_mes_compute() --
commit 8a38bbe4db1b13fc0dffaa46e16598a2c6c11936 Author: Amber Lin <[email protected]> drm/amdkfd: Move gpu_recovery location This commit moves the amdgpu_gpu_recovery check from reset_queues_mes() into amdgpu_gfx_reset_mes_compute() so bad queue removal still runs when GPU recovery is disabled. > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > index c5a2dcff5058a..c30fecc653b4b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > @@ -2594,14 +2594,17 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device > *adev, > * reset detect will return the array of bad queue doorbells > */ > r = amdgpu_mes_suspend(adev, xcc_id); > + dev_dbg(adev->dev, "Suspend all returns %d. xcc_id %d\n", r, xcc_id); > + > + if (!amdgpu_gpu_recovery) > + goto after_reset; > + > /* if suspend all success, it should no hang queue */ > - if (!r) { > - dev_dbg(adev->dev, "Suspend all succeeds. xcc_id %d\n", xcc_id); > + if (!r) > /* always reset the KCQ/userq since we need to signal the fence > * and we could be stuck in a loop which is preemptable. > */ > goto fence_reset; > - } > r = amdgpu_mes_detect_and_reset_hung_queues(adev, > AMDGPU_RING_TYPE_COMPUTE, > true, &num_hung, > adev->gfx.mec.mes_hung_db_array, xcc_id); > if (r) { > @@ -2662,6 +2665,7 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device > *adev, > goto out; > } > > +after_reset: > /* MES doesn't detect any hung queue but we have a known bad queue > * and it is not KCQ > */ [Severity: High] Can jumping to after_reset when !amdgpu_gpu_recovery leave all kernel compute ring DRM schedulers permanently stopped when a queue hangs? Before calling amdgpu_mes_suspend(), amdgpu_gfx_reset_mes_compute() stops the compute ring schedulers via amdgpu_gfx_reset_stop_compute_scheds(). When a queue is hung, amdgpu_mes_suspend() fails with a non-zero r, but if !amdgpu_gpu_recovery is set, this jumps straight to after_reset with num_hung == 0: drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:amdgpu_gfx_reset_mes_compute() { ... after_reset: if (!num_hung && queue_input && !ring) { ... r = adev->mes.funcs->remove_hw_queue(&adev->mes, queue_input); ... } out: amdgpu_mes_resume(adev, xcc_id); ring_err = r; ... if (!ring_err) amdgpu_gfx_reset_start_compute_scheds(adev, ring); ... } Because suspend_all failed, the hung queue was not preempted and remove_hw_queue() fails as well (or if another queue on the XCC caused suspend_all to fail, remove_hw_queue() can succeed and overwrite the non-zero suspend error r with 0). When r is non-zero, ring_err is non-zero and amdgpu_gfx_reset_start_compute_scheds() is skipped; since no full GPU reset follows when !amdgpu_gpu_recovery (or when called from kfd_dqm_suspend_bad_queue_mes()), the compute schedulers are never restarted. Also, if amdgpu_gfx_reset_mes_compute() is called for a KCQ or KGD user queue (where queue_input is NULL) and amdgpu_mes_suspend() succeeds, jumping to after_reset skips fence_reset and returns 0 without resetting the ring or user queue. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
