All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: Jesse Zhang <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com,
	Christian Koenig <christian.koenig@amd.com>,
	 Lijo.Lazar@amd.com, Mario.Novales@amd.com, Manu.Rastogi@amd.com,
	 Jiongyu.Zhu@amd.com
Subject: Re: [PATCH v4 11/13] drm/amdgpu/userq: reset the gfx engine when a gfx user queue reset fails
Date: Thu, 19 Nov 2026 12:47:17 +0100	[thread overview]
Message-ID: <54b73d2a2b8ac13919bd904c8a38d07c417d3d34.camel@gmail.com> (raw)
In-Reply-To: <20261105030612.726542-11-Jesse.Zhang@amd.com>

On Thu, 2026-11-05 at 11:05 +0800, Jesse Zhang wrote:
> When neither the queue nor the pipe reset recovered a gfx user queue,
> fall back to a soft reset of the gfx engine before a full reset, when
> the GFX IP supports it. A hung kernel gfx queue gets there through
> the
> IP block soft reset of the job timeout handler; a user queue has no
> kernel ring, so call amdgpu_device_ip_soft_reset() directly, with the
> gfx ring type and no guilty ring.
> 
> The hung queue can't be unmapped before the reset: pass it to the
> engine
> reset, which unmaps it once the reset cleared its HQD, and hangs it,
> while the other gfx user queues keep their state.
> 
> v4: Call amdgpu_device_ip_soft_reset(), which now takes the ring type
>     (Timur).
> 
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 27 +++++++++++++++++++-
> --
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index 7abb9d95ef59..4f2dea21ad54 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -235,11 +235,25 @@ int mes_userq_reset_hw(struct
> amdgpu_usermode_queue *queue,
>  	return 0;
>  }
>  
> +/* The hung queue can't be unmapped now: the engine reset unmaps it
> after. */
> +static int mes_userq_reset_gfx_engine(struct amdgpu_usermode_queue
> *queue)
> +{
> +	return amdgpu_device_ip_soft_reset(queue->userq_mgr->adev,
> +					   AMDGPU_RING_TYPE_GFX,
> NULL, NULL, queue);
> +}
> +
> +static bool mes_userq_gfx_engine_reset_supported(struct
> amdgpu_device *adev)
> +{
> +	return adev->gfx.gfx_supported_reset &
> +	       AMDGPU_RESET_TYPE_IP_BLOCK_SOFT_RESET;
> +}
> +
>  int mes_userq_reset(struct amdgpu_usermode_queue *queue)
>  {
>  	struct amdgpu_userq_mgr *uq_mgr = queue->userq_mgr;
>  	struct amdgpu_device *adev = uq_mgr->adev;
>  	struct mes_reset_queue_input queue_input;
> +	int r;
>  
>  	/* already reset by an earlier job's hang-detect; just
> signal and bail */
>  	if (queue->state == AMDGPU_USERQ_STATE_HUNG)
> @@ -248,8 +262,10 @@ int mes_userq_reset(struct amdgpu_usermode_queue
> *queue)
>  	/* A GFX pipe reset also affects the kernel rings on that
> pipe. */
>  	if (queue->queue_type == AMDGPU_HW_IP_GFX &&
>  	    adev->gfx.funcs->detect_hung_queue &&
> -	    amdgpu_gfx_me_pipe_reset_supported(adev))
> -		return amdgpu_gfx_reset_mes_gfx(adev, NULL, NULL,
> queue, 0, true);
> +	    amdgpu_gfx_me_pipe_reset_supported(adev)) {
> +		r = amdgpu_gfx_reset_mes_gfx(adev, NULL, NULL,
> queue, 0, true);
> +		goto out;
> +	}
>  
>  	memset(&queue_input, 0x0, sizeof(struct
> mes_reset_queue_input));
>  	queue_input.doorbell_offset = queue->doorbell_index;
> @@ -277,7 +293,12 @@ int mes_userq_reset(struct amdgpu_usermode_queue
> *queue)
>  		}
>  	}
>  
> -	return mes_userq_reset_hw(queue, &queue_input);
> +	r = mes_userq_reset_hw(queue, &queue_input);
> +out:
> +	if (r && queue->queue_type == AMDGPU_HW_IP_GFX &&
> +	    mes_userq_gfx_engine_reset_supported(adev))
> +		r = mes_userq_reset_gfx_engine(queue);
> +	return r;
>  }
>  
>  int mes_userq_reset_queue(struct amdgpu_device *adev,

  reply	other threads:[~2026-11-19 11:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  3:05 [PATCH v4 01/13] drm/amdgpu: pass the device to the multi ring reset helpers Jesse Zhang
2026-11-05  3:05 ` [PATCH v4 02/13] drm/amdgpu/ring: During multi-queue reset, only call begin helper if needed Jesse Zhang
2026-11-11 23:52   ` Daniel Campos Ramos
2026-11-19 11:34   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 03/13] drm/amdgpu: add an engine scope to the IP block soft reset Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 04/13] drm/amdgpu/gfx: add callbacks to save and restore a gfx HQD Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 05/13] drm/amdgpu/gfx12: " Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 06/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 07/13] drm/amdgpu/userq: add a helper to signal the fences of a queue up to a point Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 08/13] drm/amdgpu/userq: add helpers to keep the user queues of one engine across a reset Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 09/13] drm/amdgpu/gfx12: add a gfx engine soft reset Jesse Zhang
2026-11-19 11:42   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 10/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 11/13] drm/amdgpu/userq: reset the gfx engine when a gfx user queue reset fails Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf [this message]
2026-11-05  3:05 ` [PATCH v4 12/13] drm/amdgpu/gfx12: enable the gfx engine soft reset Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 13/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-10  2:06 ` [PATCH v4 01/13] drm/amdgpu: pass the device to the multi ring reset helpers Zhang, Jesse(Jie)
2026-11-11 15:28   ` Timur Kristóf
2026-11-19 11:33 ` Timur Kristóf

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=54b73d2a2b8ac13919bd904c8a38d07c417d3d34.camel@gmail.com \
    --to=timur.kristof@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=Jiongyu.Zhu@amd.com \
    --cc=Lijo.Lazar@amd.com \
    --cc=Manu.Rastogi@amd.com \
    --cc=Mario.Novales@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /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.