* [PATCH] drm/amdgpu: always emit the job vm fence
@ 2026-06-03 19:45 Alex Deucher
2026-06-04 11:06 ` Timur Kristóf
2026-06-05 9:24 ` Christian König
0 siblings, 2 replies; 5+ messages in thread
From: Alex Deucher @ 2026-06-03 19:45 UTC (permalink / raw)
To: amd-gfx; +Cc: Alex Deucher, timur.kristof, christian.koenig
We need the fence to reemit the gds switch or spm update
after a queue reset.
Fixes: a17ef941212b ("drm/amdgpu: rework ring reset backup and reemit v9")
Cc: timur.kristof@gmail.com
Cc: christian.koenig@amd.com
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 2f3470208829e..7e0e2281719b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -853,12 +853,10 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
job->oa_size);
}
- if (vm_flush_needed || pasid_mapping_needed || cleaner_shader_needed) {
- amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
- fence = &job->hw_vm_fence->base;
- /* get a ref for the job */
- dma_fence_get(fence);
- }
+ amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
+ fence = &job->hw_vm_fence->base;
+ /* get a ref for the job */
+ dma_fence_get(fence);
if (vm_flush_needed) {
mutex_lock(&id_mgr->lock);
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] drm/amdgpu: always emit the job vm fence
2026-06-03 19:45 [PATCH] drm/amdgpu: always emit the job vm fence Alex Deucher
@ 2026-06-04 11:06 ` Timur Kristóf
2026-06-05 9:24 ` Christian König
1 sibling, 0 replies; 5+ messages in thread
From: Timur Kristóf @ 2026-06-04 11:06 UTC (permalink / raw)
To: amd-gfx, Alex Deucher; +Cc: Alex Deucher, christian.koenig
Hi Alex,
On 2026. június 3., szerda 21:45:35 közép-európai nyári idő Alex Deucher
wrote:
> We need the fence to reemit the gds switch or spm update
> after a queue reset.
>
> Fixes: a17ef941212b ("drm/amdgpu: rework ring reset backup and reemit v9")
> Cc: timur.kristof@gmail.com
> Cc: christian.koenig@amd.com
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
The patch makes good sense to me. Thanks!
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 2f3470208829e..7e0e2281719b1
> 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -853,12 +853,10 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, struct
> amdgpu_job *job, job->oa_size);
> }
>
> - if (vm_flush_needed || pasid_mapping_needed ||
cleaner_shader_needed) {
> - amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> - fence = &job->hw_vm_fence->base;
> - /* get a ref for the job */
> - dma_fence_get(fence);
> - }
> + amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> + fence = &job->hw_vm_fence->base;
> + /* get a ref for the job */
> + dma_fence_get(fence);
>
> if (vm_flush_needed) {
> mutex_lock(&id_mgr->lock);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] drm/amdgpu: always emit the job vm fence
2026-06-03 19:45 [PATCH] drm/amdgpu: always emit the job vm fence Alex Deucher
2026-06-04 11:06 ` Timur Kristóf
@ 2026-06-05 9:24 ` Christian König
2026-06-05 10:11 ` Timur Kristóf
1 sibling, 1 reply; 5+ messages in thread
From: Christian König @ 2026-06-05 9:24 UTC (permalink / raw)
To: Alex Deucher, amd-gfx; +Cc: timur.kristof
On 6/3/26 21:45, Alex Deucher wrote:
> We need the fence to reemit the gds switch or spm update
> after a queue reset.
>
> Fixes: a17ef941212b ("drm/amdgpu: rework ring reset backup and reemit v9")
> Cc: timur.kristof@gmail.com
> Cc: christian.koenig@amd.com
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
That was avoided because it means another entry in the EOP ring buffer which can be bad for performance.
But correctness is obviously more important, just to keep in mind when we suddenly see 1% fps decrease and don't know where it's coming from.
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 2f3470208829e..7e0e2281719b1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -853,12 +853,10 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
> job->oa_size);
> }
>
> - if (vm_flush_needed || pasid_mapping_needed || cleaner_shader_needed) {
> - amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> - fence = &job->hw_vm_fence->base;
> - /* get a ref for the job */
> - dma_fence_get(fence);
> - }
> + amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> + fence = &job->hw_vm_fence->base;
> + /* get a ref for the job */
> + dma_fence_get(fence);
>
> if (vm_flush_needed) {
> mutex_lock(&id_mgr->lock);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] drm/amdgpu: always emit the job vm fence
2026-06-05 9:24 ` Christian König
@ 2026-06-05 10:11 ` Timur Kristóf
2026-06-05 22:19 ` Alex Deucher
0 siblings, 1 reply; 5+ messages in thread
From: Timur Kristóf @ 2026-06-05 10:11 UTC (permalink / raw)
To: Alex Deucher, amd-gfx, Christian König
On 2026. június 5., péntek 11:24:45 közép-európai nyári idő Christian König
wrote:
> On 6/3/26 21:45, Alex Deucher wrote:
> > We need the fence to reemit the gds switch or spm update
> > after a queue reset.
> >
> > Fixes: a17ef941212b ("drm/amdgpu: rework ring reset backup and reemit v9")
> > Cc: timur.kristof@gmail.com
> > Cc: christian.koenig@amd.com
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>
> That was avoided because it means another entry in the EOP ring buffer which
> can be bad for performance.
>
> But correctness is obviously more important, just to keep in mind when we
> suddenly see 1% fps decrease and don't know where it's coming from.
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
Thanks Christian, that's a valid point.
Do you think we should worry about an actual perf impact here?
If we want to avoid adding an extra fence, then an alternative solution could
be to include the emitted commands in the ib_wptr of the job's own fence when
a VM fence was not emitted.
What do you guys think?
Thanks,
Timur
>
> > ---
> >
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 ++++------
> > 1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index
> > 2f3470208829e..7e0e2281719b1 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > @@ -853,12 +853,10 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring,
> > struct amdgpu_job *job,>
> > job->oa_size);
> >
> > }
> >
> > - if (vm_flush_needed || pasid_mapping_needed ||
cleaner_shader_needed) {
> > - amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> > - fence = &job->hw_vm_fence->base;
> > - /* get a ref for the job */
> > - dma_fence_get(fence);
> > - }
> > + amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> > + fence = &job->hw_vm_fence->base;
> > + /* get a ref for the job */
> > + dma_fence_get(fence);
> >
> > if (vm_flush_needed) {
> >
> > mutex_lock(&id_mgr->lock);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] drm/amdgpu: always emit the job vm fence
2026-06-05 10:11 ` Timur Kristóf
@ 2026-06-05 22:19 ` Alex Deucher
0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2026-06-05 22:19 UTC (permalink / raw)
To: Timur Kristóf; +Cc: Alex Deucher, amd-gfx, Christian König
On Fri, Jun 5, 2026 at 6:11 AM Timur Kristóf <timur.kristof@gmail.com> wrote:
>
> On 2026. június 5., péntek 11:24:45 közép-európai nyári idő Christian König
> wrote:
> > On 6/3/26 21:45, Alex Deucher wrote:
> > > We need the fence to reemit the gds switch or spm update
> > > after a queue reset.
> > >
> > > Fixes: a17ef941212b ("drm/amdgpu: rework ring reset backup and reemit v9")
> > > Cc: timur.kristof@gmail.com
> > > Cc: christian.koenig@amd.com
> > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> >
> > That was avoided because it means another entry in the EOP ring buffer which
> > can be bad for performance.
> >
> > But correctness is obviously more important, just to keep in mind when we
> > suddenly see 1% fps decrease and don't know where it's coming from.
> >
> > Reviewed-by: Christian König <christian.koenig@amd.com>
>
> Thanks Christian, that's a valid point.
> Do you think we should worry about an actual perf impact here?
>
> If we want to avoid adding an extra fence, then an alternative solution could
> be to include the emitted commands in the ib_wptr of the job's own fence when
> a VM fence was not emitted.
>
> What do you guys think?
@Christian Koenig Is there a reason we need to emit gds and spm before
the vm fence if the vm fence is required? I've sent out a series to
retain that behavior, but if it doesn't matter, we could simplify
things more and move gds and spm into the ib fence.
Alex
>
> Thanks,
> Timur
>
> >
> > > ---
> > >
> > > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 ++++------
> > > 1 file changed, 4 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index
> > > 2f3470208829e..7e0e2281719b1 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > > @@ -853,12 +853,10 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring,
> > > struct amdgpu_job *job,>
> > > job->oa_size);
> > >
> > > }
> > >
> > > - if (vm_flush_needed || pasid_mapping_needed ||
> cleaner_shader_needed) {
> > > - amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> > > - fence = &job->hw_vm_fence->base;
> > > - /* get a ref for the job */
> > > - dma_fence_get(fence);
> > > - }
> > > + amdgpu_fence_emit(ring, job->hw_vm_fence, 0);
> > > + fence = &job->hw_vm_fence->base;
> > > + /* get a ref for the job */
> > > + dma_fence_get(fence);
> > >
> > > if (vm_flush_needed) {
> > >
> > > mutex_lock(&id_mgr->lock);
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-05 22:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 19:45 [PATCH] drm/amdgpu: always emit the job vm fence Alex Deucher
2026-06-04 11:06 ` Timur Kristóf
2026-06-05 9:24 ` Christian König
2026-06-05 10:11 ` Timur Kristóf
2026-06-05 22:19 ` Alex Deucher
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.