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 v3 12/15] drm/amdgpu/gfx: add a gfx engine soft reset
Date: Tue, 03 Nov 2026 21:38:56 +0100 [thread overview]
Message-ID: <5b50e068b3a16d7e25af73ecbb61c3e137ecedda.camel@gmail.com> (raw)
In-Reply-To: <20261028085736.3808569-12-Jesse.Zhang@amd.com>
On Wed, 2026-10-28 at 16:56 +0800, Jesse Zhang wrote:
> Add amdgpu_gfx_soft_reset_engine(), the soft_reset_engine() IP block
> callback of the gfx IPs, around the reset_engine callback. It only
> supports the graphics engine so far. The IP block soft reset stops,
> backs up and replays the kernel gfx rings around it; the compute
> rings
> aren't stopped.
>
> MES is suspended across the reset, so that it doesn't schedule or map
> queues while the CP front-end is reset. The compute queues are
> preempted
> meanwhile: their work is only paused. MES
> fetches its commands through the CP front-end though, and a hung gfx
> stream can keep it from completing the suspend. Reset the engine
> anyway:
> the reset frees the front-end.
>
> The reset also clears the HQDs of the gfx user queues. Call
> amdgpu_userq_pre_engine_reset() after the MES suspend, to save the
> ring
> state of the queues still on a HQD, and
> amdgpu_userq_post_engine_reset()
> after the reset, before MES resumes, to restore them. @guilty_queue
> is
> the gfx user queue that hung, if any: it is hung instead. If the
> engine
> reset fails, amdgpu_userq_cancel_engine_reset() drops the saved ring
> state for the full reset that follows.
>
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 41
> +++++++++++++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 ++
> 2 files changed, 44 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 0ae6e990c310..f1a26e4eb06c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -2181,6 +2181,47 @@ int amdgpu_gfx_reset_mes_gfx(struct
> amdgpu_device *adev,
> return r;
> }
>
> +/**
> + * amdgpu_gfx_soft_reset_engine() - Soft reset one engine of the GFX
> IP.
> + *
> + * @ip_block: The GFX IP block.
> + * @engine: The engine to reset.
> + * @guilty_queue: The user queue that hung, or NULL.
> + *
> + * soft_reset_engine() IP block callback around the reset_engine
> callback,
> + * which resets the CP of the engine. Only the graphics engine is
> supported
> + * so far.
> + */
> +int amdgpu_gfx_soft_reset_engine(struct amdgpu_ip_block *ip_block,
> + enum amd_ip_engine engine,
> + struct amdgpu_usermode_queue
> *guilty_queue)
> +{
> + struct amdgpu_device *adev = ip_block->adev;
> + int r;
> +
> + if (engine != AMD_IP_ENGINE_GFX || !adev->gfx.funcs-
> >reset_engine)
> + return -EOPNOTSUPP;
> +
> + mutex_lock(&adev->gfx.mec.reset_mutex);
> +
> + /* The suspend may time out while the gfx engine hangs:
> reset anyway. */
> + amdgpu_mes_suspend(adev, 0);
> + amdgpu_userq_pre_engine_reset(adev, AMDGPU_HW_IP_GFX);
> + r = adev->gfx.funcs->reset_engine(adev, engine);
> + if (r) {
> + amdgpu_userq_cancel_engine_reset(adev,
> AMDGPU_HW_IP_GFX);
> + amdgpu_mes_resume(adev, 0);
> + goto exit;
> + }
> +
> + amdgpu_userq_post_engine_reset(adev, AMDGPU_HW_IP_GFX,
> guilty_queue);
> + r = amdgpu_mes_resume(adev, 0);
> +
> +exit:
> + mutex_unlock(&adev->gfx.mec.reset_mutex);
> + return r;
> +}
I think the additional functionality should be added to
the amdgpu_device_ip_soft_reset() function as well.
> +
> int amdgpu_gfx_mes_reset_queue(struct amdgpu_ring *ring,
> unsigned int vmid,
> struct amdgpu_fence *timedout_fence,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> index 6bbf53359a49..d63d9f5f5b96 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> @@ -740,6 +740,9 @@ void amdgpu_gfx_pipe_reset_prepare(struct
> amdgpu_device *adev,
> struct amdgpu_ring *guilty_ring,
> u32 me, u32 pipe,
> struct amdgpu_gfx_pipe_reset_ctx
> *ctx);
> +int amdgpu_gfx_soft_reset_engine(struct amdgpu_ip_block *ip_block,
> + enum amd_ip_engine engine,
> + struct amdgpu_usermode_queue
> *guilty_queue);
> int amdgpu_gfx_reset_mes_gfx(struct amdgpu_device *adev,
> struct amdgpu_ring *ring,
> struct amdgpu_fence *guilty_fence,
next prev parent reply other threads:[~2026-11-03 20:39 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 8:56 [PATCH v3 01/15] drm/amdgpu: pass the device to the multi ring reset helpers Jesse Zhang
2026-10-28 8:56 ` [PATCH v3 02/15] drm/amdgpu: complete the guilty fence at the end of a multi ring reset Jesse Zhang
2026-11-03 20:12 ` Timur Kristóf
2026-11-04 2:46 ` Zhang, Jesse(Jie)
2026-11-04 22:46 ` Timur Kristóf
2026-11-05 2:09 ` Zhang, Jesse(Jie)
2026-11-05 8:54 ` Timur Kristóf
2026-10-28 8:56 ` [PATCH v3 03/15] drm/amdgpu: add an engine scope to the IP block soft reset Jesse Zhang
2026-11-03 20:15 ` Timur Kristóf
2026-11-04 3:32 ` Zhang, Jesse(Jie)
2026-11-04 22:49 ` Timur Kristóf
2026-11-05 2:41 ` Zhang, Jesse(Jie)
2026-10-28 8:56 ` [PATCH v3 04/15] drm/amdgpu/gfx: add a reset_engine callback Jesse Zhang
2026-11-03 20:16 ` Timur Kristóf
2026-10-28 8:56 ` [PATCH v3 05/15] drm/amdgpu/gfx12: add a gfx engine reset Jesse Zhang
2026-10-28 8:56 ` [PATCH v3 06/15] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-03 20:22 ` Timur Kristóf
2026-10-28 8:56 ` [PATCH v3 07/15] drm/amdgpu/gfx: add callbacks to read and restore the ring state of a gfx queue Jesse Zhang
2026-11-03 20:29 ` Timur Kristóf
2026-10-28 8:56 ` [PATCH v3 08/15] drm/amdgpu/gfx12: " Jesse Zhang
2026-10-28 8:56 ` [PATCH v3 09/15] drm/amdgpu/gfx11: " Jesse Zhang
2026-10-28 8:56 ` [PATCH v3 10/15] drm/amdgpu/userq: add a helper to signal the fences of a queue up to a point Jesse Zhang
2026-10-28 8:56 ` [PATCH v3 11/15] drm/amdgpu/userq: add helpers to keep the user queues of one engine across a reset Jesse Zhang
2026-11-03 20:37 ` Timur Kristóf
2026-10-28 8:56 ` [PATCH v3 12/15] drm/amdgpu/gfx: add a gfx engine soft reset Jesse Zhang
2026-11-03 20:38 ` Timur Kristóf [this message]
2026-10-28 8:56 ` [PATCH v3 13/15] drm/amdgpu/userq: reset the gfx engine when a gfx user queue reset fails Jesse Zhang
2026-10-28 8:56 ` [PATCH v3 14/15] drm/amdgpu/gfx12: enable the gfx engine soft reset Jesse Zhang
2026-10-28 8:56 ` [PATCH v3 15/15] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-03 20:41 ` Timur Kristóf
2026-11-04 5:54 ` Zhang, Jesse(Jie)
2026-11-04 22:51 ` Timur Kristóf
2026-11-02 1:28 ` [PATCH v3 01/15] drm/amdgpu: pass the device to the multi ring reset helpers Zhang, Jesse(Jie)
2026-11-02 16:24 ` Timur Kristóf
2026-11-04 1:45 ` Zhang, Jesse(Jie)
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=5b50e068b3a16d7e25af73ecbb61c3e137ecedda.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.