[PATCH] drm/amdgpu: fix when the cleaner shader is emitted
Alex Deucher
alexdeucher at gmail.com
Fri Dec 6 14:40:46 UTC 2024
On Fri, Dec 6, 2024 at 9:37 AM Alex Deucher <alexdeucher at gmail.com> wrote:
>
> On Fri, Dec 6, 2024 at 9:35 AM Christian König
> <ckoenig.leichtzumerken at gmail.com> wrote:
> >
> > Emitting the cleaner shader must come after the check if a VM switch is
> > necessary or not.
> >
> > Otherwise we will emit the cleaner shader every time and not just when it is
> > necessary because we switched between applications.
> >
> > This can otherwise crash on gang submit and probably decreases performance
> > quite a bit.
> >
> > Signed-off-by: Christian König <christian.koenig at amd.com>
>
> Acked-by: Alex Deucher <alexander.deucher at amd.com>
Would be good to get a fixes tag as well.
Alex
>
> > ---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > index 68dd4130b5ad..db913d533898 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > @@ -674,11 +674,6 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
> > pasid_mapping_needed &= adev->gmc.gmc_funcs->emit_pasid_mapping &&
> > ring->funcs->emit_wreg;
> >
> > - if (adev->gfx.enable_cleaner_shader &&
> > - ring->funcs->emit_cleaner_shader &&
> > - job->enforce_isolation)
> > - ring->funcs->emit_cleaner_shader(ring);
> > -
> > if (!vm_flush_needed && !gds_switch_needed && !need_pipe_sync)
> > return 0;
> >
> > @@ -690,6 +685,11 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
> > if (need_pipe_sync)
> > amdgpu_ring_emit_pipeline_sync(ring);
> >
> > + if (adev->gfx.enable_cleaner_shader &&
> > + ring->funcs->emit_cleaner_shader &&
> > + job->enforce_isolation)
> > + ring->funcs->emit_cleaner_shader(ring);
> > +
> > if (vm_flush_needed) {
> > trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
> > amdgpu_ring_emit_vm_flush(ring, job->vmid, job->vm_pd_addr);
> > --
> > 2.34.1
> >
More information about the amd-gfx
mailing list