All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: amd-gfx@lists.freedesktop.org,
	Alex Deucher <alexander.deucher@amd.com>,
	christian.koenig@amd.com, pierre-eric.pelloux-prayer@amd.com,
	Natalie Vock <natalie.vock@gmx.de>,
	Tvrtko Ursulin <tursulin@ursulin.net>
Subject: Re: [PATCH 7/9] drm/amdgpu/gfx7: Use COND_EXEC
Date: Wed, 15 Jul 2026 12:45:42 +0200	[thread overview]
Message-ID: <2299222.Hq7AAxBmiT@timur-max> (raw)
In-Reply-To: <2a8374ee-bd72-4306-9524-a8cb3cc0d5f8@ursulin.net>

On 2026. július 15., szerda 11:38:40 közép-európai nyári idő Tvrtko Ursulin 
wrote:
> On 13/07/2026 13:58, Timur Kristóf wrote:
> > COND_EXEC tells the CP to discard the dwords following it
> > when its condition is zero (false).
> > 
> > This is useful for GPU recovery because it can help reduce
> > collateral damage during GFX IP block soft reset, meaning
> > that it reduces the likelyhood that we fail some jobs which
> > are not guilty of the hang as the IP block soft reset
> > mechanism clears the condition before doing the reset.
> > 
> > Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
> > ---
> > 
> >   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 22 ++++++++++++++++++++++
> >   1 file changed, 22 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 915612628f9a..6d52b8710437
> > 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > @@ -3162,6 +3162,22 @@ static void gfx_v7_0_ring_emit_vm_flush(struct
> > amdgpu_ring *ring,> 
> >   	}
> >   
> >   }
> > 
> > +static unsigned int gfx_v7_0_ring_emit_init_cond_exec(struct amdgpu_ring
> > *ring, +						      
uint64_t gpu_addr)
> > +{
> > +	unsigned int ret;
> > +
> > +	/* Discard following DWs after this packet when gpu_addr==0 */
> > +	amdgpu_ring_write(ring, PACKET3(PACKET3_COND_EXEC, 3));
> > +	amdgpu_ring_write(ring, lower_32_bits(gpu_addr));
> > +	amdgpu_ring_write(ring, upper_32_bits(gpu_addr));
> > +	amdgpu_ring_write(ring, 0);
> > +	ret = ring->wptr & ring->buf_mask;
> > +	/* patch dummy value later */
> > +	amdgpu_ring_write(ring, 0);
> > +	return ret;
> > +}
> > +
> > 
> >   static void gfx_v7_0_ring_emit_wreg(struct amdgpu_ring *ring,
> >   
> >   				    uint32_t reg, uint32_t val)
> >   
> >   {
> > 
> > @@ -4943,6 +4959,8 @@ static const struct amdgpu_ring_funcs
> > gfx_v7_0_ring_funcs_gfx = {> 
> >   	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
> >   	.set_wptr = gfx_v7_0_ring_set_wptr_gfx,
> >   	.emit_frame_size =
> > 
> > +		5 + /* gfx_v7_0_ring_emit_init_cond_exec (from 
amdgpu_ib_schedule) */
> > +		5 + /* gfx_v7_0_ring_emit_init_cond_exec (from 
amdgpu_vm_flush) */
> 
> gfx8 version /appears/ to make an effort to keep the additions here
> sorted in the emission order. I think at least.

As far as I see it was already not in emission order here.

> Not sure how much value
> it adds since the whole emit_frame_size mechanism is "fragilotedious".
> 
> :) Another task for a rainy day - we see if it can be replaced with
> 
> something more manageable.

If you have ideas how to clean it up, I'd be happy to hear it.

> Anyway, digressions aside:
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> 
> Regards,
> 
> Tvrtko
> 
> >   		20 + /* gfx_v7_0_ring_emit_gds_switch */
> >   		7 + /* gfx_v7_0_ring_emit_hdp_flush */
> >   		5 + /* hdp invalidate */
> > 
> > @@ -4965,6 +4983,7 @@ static const struct amdgpu_ring_funcs
> > gfx_v7_0_ring_funcs_gfx = {> 
> >   	.pad_ib = amdgpu_ring_generic_pad_ib,
> >   	.emit_switch_buffer = gfx_v7_0_ring_emit_sb,
> >   	.emit_cntxcntl = gfx_v7_ring_emit_cntxcntl,
> > 
> > +	.init_cond_exec = gfx_v7_0_ring_emit_init_cond_exec,
> > 
> >   	.emit_wreg = gfx_v7_0_ring_emit_wreg,
> >   	.soft_recovery = gfx_v7_0_ring_soft_recovery,
> >   	.emit_mem_sync = gfx_v7_0_emit_mem_sync,
> > 
> > @@ -4979,6 +4998,8 @@ static const struct amdgpu_ring_funcs
> > gfx_v7_0_ring_funcs_compute = {> 
> >   	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
> >   	.set_wptr = gfx_v7_0_ring_set_wptr_compute,
> >   	.emit_frame_size =
> > 
> > +		5 + /* gfx_v7_0_ring_emit_init_cond_exec (from 
amdgpu_ib_schedule) */
> > +		5 + /* gfx_v7_0_ring_emit_init_cond_exec (from 
amdgpu_vm_flush) */
> > 
> >   		20 + /* gfx_v7_0_ring_emit_gds_switch */
> >   		7 + /* gfx_v7_0_ring_emit_hdp_flush */
> >   		5 + /* hdp invalidate */
> > 
> > @@ -4997,6 +5018,7 @@ static const struct amdgpu_ring_funcs
> > gfx_v7_0_ring_funcs_compute = {> 
> >   	.test_ib = gfx_v7_0_ring_test_ib,
> >   	.insert_nop = amdgpu_ring_insert_nop,
> >   	.pad_ib = amdgpu_ring_generic_pad_ib,
> > 
> > +	.init_cond_exec = gfx_v7_0_ring_emit_init_cond_exec,
> > 
> >   	.emit_wreg = gfx_v7_0_ring_emit_wreg,
> >   	.soft_recovery = gfx_v7_0_ring_soft_recovery,
> >   	.emit_mem_sync = gfx_v7_0_emit_mem_sync_compute,





  reply	other threads:[~2026-07-15 10:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 12:58 [PATCH 0/9] drm/amdgpu/gfx7: Use GFX IP block soft reset on GFX7 Timur Kristóf
2026-07-13 12:58 ` [PATCH 1/9] drm/amdgpu/gfx7: Make amdgpu_gfx_mqd_sw_init() usable " Timur Kristóf
2026-07-14 14:59   ` Tvrtko Ursulin
2026-07-14 15:05     ` Alex Deucher
2026-07-14 15:19       ` Tvrtko Ursulin
2026-07-14 15:39         ` Timur Kristóf
2026-07-14 18:23           ` Tvrtko Ursulin
2026-07-13 12:58 ` [PATCH 2/9] drm/amdgpu/gfx7: Refactor MQD initialization and finalization Timur Kristóf
2026-07-14 18:47   ` Tvrtko Ursulin
2026-07-15  8:08     ` Timur Kristóf
2026-07-15  8:26       ` Tvrtko Ursulin
2026-07-13 12:58 ` [PATCH 3/9] drm/amdgpu/gfx7: Return error code when compute ring tests fail Timur Kristóf
2026-07-14 18:55   ` Tvrtko Ursulin
2026-07-14 20:41     ` Alex Deucher
2026-07-15  8:02       ` Timur Kristóf
2026-07-15  9:50         ` Christian König
2026-07-15 10:50           ` Timur Kristóf
2026-07-13 12:58 ` [PATCH 4/9] drm/amdgpu/gfx7: Return error code when failing to start GFX ring Timur Kristóf
2026-07-14 18:58   ` Tvrtko Ursulin
2026-07-13 12:58 ` [PATCH 5/9] drm/amdgpu/gfx7: Fixup emitting SWITCH_BUFFER packets Timur Kristóf
2026-07-15  8:56   ` Tvrtko Ursulin
2026-07-15 10:36     ` Timur Kristóf
2026-07-15 11:20       ` Tvrtko Ursulin
2026-07-15 11:50       ` Christian König
2026-07-13 12:58 ` [PATCH 6/9] drm/amdgpu/gfx7: Clean up gfx ring during reset Timur Kristóf
2026-07-15  9:18   ` Tvrtko Ursulin
2026-07-15 10:16     ` Timur Kristóf
2026-07-15 11:07       ` Tvrtko Ursulin
2026-07-13 12:58 ` [PATCH 7/9] drm/amdgpu/gfx7: Use COND_EXEC Timur Kristóf
2026-07-15  9:38   ` Tvrtko Ursulin
2026-07-15 10:45     ` Timur Kristóf [this message]
2026-07-13 12:58 ` [PATCH 8/9] drm/amdgpu/gfx7: Fixup IP block soft reset Timur Kristóf
2026-07-15  9:53   ` Tvrtko Ursulin
2026-07-13 12:58 ` [PATCH 9/9] drm/amdgpu/gfx7: Enable IP block soft reset as a GPU recovery method Timur Kristóf
2026-07-15  9:55   ` Tvrtko Ursulin

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=2299222.Hq7AAxBmiT@timur-max \
    --to=timur.kristof@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=natalie.vock@gmx.de \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=tursulin@ursulin.net \
    /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.