Skip to content

Commit f4df208

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: fix when the cleaner shader is emitted
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. v2: squash in fix from Srini (Alex) Signed-off-by: Christian König <[email protected]> Fixes: ee7a846 ("drm/amdgpu: Emit cleaner shader at end of IB submission") Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent ee2003d commit f4df208

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,12 +674,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
674674
pasid_mapping_needed &= adev->gmc.gmc_funcs->emit_pasid_mapping &&
675675
ring->funcs->emit_wreg;
676676

677-
if (adev->gfx.enable_cleaner_shader &&
678-
ring->funcs->emit_cleaner_shader &&
679-
job->enforce_isolation)
680-
ring->funcs->emit_cleaner_shader(ring);
681-
682-
if (!vm_flush_needed && !gds_switch_needed && !need_pipe_sync)
677+
if (!vm_flush_needed && !gds_switch_needed && !need_pipe_sync &&
678+
!(job->enforce_isolation && !job->vmid))
683679
return 0;
684680

685681
amdgpu_ring_ib_begin(ring);
@@ -690,6 +686,11 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
690686
if (need_pipe_sync)
691687
amdgpu_ring_emit_pipeline_sync(ring);
692688

689+
if (adev->gfx.enable_cleaner_shader &&
690+
ring->funcs->emit_cleaner_shader &&
691+
job->enforce_isolation)
692+
ring->funcs->emit_cleaner_shader(ring);
693+
693694
if (vm_flush_needed) {
694695
trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
695696
amdgpu_ring_emit_vm_flush(ring, job->vmid, job->vm_pd_addr);

0 commit comments

Comments
 (0)