All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: "Zhang, Jesse(Jie)" <Jesse.Zhang@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Koenig, Christian"	 <Christian.Koenig@amd.com>,
	"Lazar, Lijo" <Lijo.Lazar@amd.com>,
	Mario Sopena-Novales <Mario.Novales@amd.com>,
	"Rastogi, Manu" <Manu.Rastogi@amd.com>,
	"Zhu, Jiongyu (Joey)"	 <Jiongyu.Zhu@amd.com>
Subject: Re: [PATCH v3 02/15] drm/amdgpu: complete the guilty fence at the end of a multi ring reset
Date: Thu, 05 Nov 2026 09:54:31 +0100	[thread overview]
Message-ID: <d313dc4855779e4337d60a2642e81da0c102a3c8.camel@gmail.com> (raw)
In-Reply-To: <DM4PR12MB5152D797B071B435A47CC599E3772@DM4PR12MB5152.namprd12.prod.outlook.com>

On Thu, 2026-11-05 at 02:09 +0000, Zhang, Jesse(Jie) wrote:
> AMD General
> 
> > -----Original Message-----
> > From: Timur Kristóf <timur.kristof@gmail.com>
> > Sent: Thursday, November 5, 2026 6:47 AM
> > To: Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>; amd-
> > gfx@lists.freedesktop.org
> > Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig,
> > Christian
> > <Christian.Koenig@amd.com>; Lazar, Lijo <Lijo.Lazar@amd.com>; Mario
> > Sopena-Novales <Mario.Novales@amd.com>; Rastogi, Manu
> > <Manu.Rastogi@amd.com>; Zhu, Jiongyu (Joey) <Jiongyu.Zhu@amd.com>
> > Subject: Re: [PATCH v3 02/15] drm/amdgpu: complete the guilty fence
> > at the
> > end of a multi ring reset
> > 
> > On Wed, 2026-11-04 at 02:46 +0000, Zhang, Jesse(Jie) wrote:
> > > > > +           r = amdgpu_ring_reset_helper_end(ring, ring ==
> > > > > guilty_ring ?
> > > > > +                                            guilty_fence :
> > > > > ring->guilty_fence);
> > > > 
> > > > Can you help me understand what was wrong with the line before?
> > > > I think guilty_fence == ring->guilty_fence when ring ==
> > > > guilty_ring
> > > > no?
> > > 
> > > Usually yes, but not when the soft reset follows a failed ring
> > > reset
> > > of the same job.
> > >  amdgpu_ring_reset(ring, vmid, job->hw_fence)
> > >    -> amdgpu_ring_reset_helper_begin(ring, F)
> > >    -> amdgpu_ring_backup_unprocessed_commands(ring, F)
> > >       sets ring->guilty_fence = F.
> > > 
> > > So by the time the end helper runs, ring->guilty_fence no longer
> > > equals the guilty fence: the begin helper cleared it.
> > 
> > I think I see the problem.
> > 
> > I re-read the queue reset code and the helpers. During a queue
> > reset, it makes
> > a backup and saves the guilty fence but if the queue reset fails,
> > it doesn't
> > restore the contents, and on a subsequent call it clears the guilty
> > fence and the
> > backed up contents.
> > 
> > Unfortunately I think this commit doesn't completely fix that
> > because the reset
> > begin helper will still clear the backed up contents on the second
> > call (sets
> > ring_backup_entries_to_copy = 0).
> > 
> > I think the correct fix would be to make sure we don't repeat the
> > ring reset
> > begin helper:
> > https://gitlab.freedesktop.org/Venemo/linux/-
> > /commit/86f2bf222caee0da267f9d9e12362513fe4f7f9e
> > Please take a look and if you agree feel free to take that patch in
> > your series.
> Right, the second backup also drops the commands of the other jobs on
> the
> guilty ring, and skipping the begin helper is the better fix. With
> it,
> ring->guilty_fence also stays the guilty fence, so 02/15 isn't needed
> anymore.
> 
> I think the condition in your patch is inverted though:
> 
>         if (guilty_fence && ring->guilty_fence == guilty_fence)
>                 amdgpu_ring_reset_helper_begin(ring,
> ring_guilty_fence);
> 
> calls the begin helper only for a ring that was already backed up
> with
> this guilty fence. The other rings, and the guilty ring of a soft
> reset
> without a failed ring reset before it, aren't backed up anymore. The
> latter would even replay a stale backup. The guilty ring after a
> failed
> ring reset is the one ring that still goes through the begin helper.
> I
> think you meant:
> 
>         /* A failed ring reset of the same job already backed it up.
> */
>         if (ring != guilty_ring || ring->guilty_fence !=
> guilty_fence)
>                 amdgpu_ring_reset_helper_begin(ring,
> ring_guilty_fence);
> 
> If that's what you meant, I'll take your patch with that change in
> place
> of 02 in v4.
> 

Yes, thank you for the correction.



  reply	other threads:[~2026-11-05  8:54 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 [this message]
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
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=d313dc4855779e4337d60a2642e81da0c102a3c8.camel@gmail.com \
    --to=timur.kristof@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@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 \
    /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.