All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Amber Lin" <amber.lin@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/amdkfd: Move gpu_recovery location
Date: Mon, 16 Nov 2026 08:13:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-216517@kernel.org> (raw)
In-Reply-To: <20261116075047.35150-1-amber.lin@amd.com>

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 <amber.lin@amd.com>

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/20261116075047.35150-1-amber.lin@amd.com?part=1

      reply	other threads:[~2026-11-16  8:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  7:50 [PATCH v2] drm/amdkfd: Move gpu_recovery location Amber Lin
2026-11-16  8:13 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-216517@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amber.lin@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.