Skip to contentSkip to conversation

drm/amdgpu: Fix SDMA TO after GPU reset v2

PATCH Superseded Andrey Grodzovsky 2 participants 2 messages Sep 11, 2018 1 message not in the archive

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix SDMA TO after GPU reset v2

After GPU reset amdgpu_vm_clear_bo triggers VM flush but job->vm_pd_addr is not set causing SDMA TO.

v2:
Per advise by Christian König avoid flushing VM for jobs where job->vm_pd_addr wasn't explicitly set.

Fixes cbd5285 drm/amdgpu: move setting the GART addr into TTM.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
index 34e54d4..755f733 100644
@@ -73,6 +73,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
 	amdgpu_sync_create(&(*job)->sync);
 	amdgpu_sync_create(&(*job)->sched_sync);
 	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
+	(*job)->vm_pd_addr = AMDGPU_BO_INVALID_OFFSET;
 
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index f5a9600..30beb52 100644
@@ -865,7 +865,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_
 	if (need_pipe_sync)
 		amdgpu_ring_emit_pipeline_sync(ring);
 
-	if (vm_flush_needed) {
+	if (vm_flush_needed && job->vm_pd_addr != AMDGPU_BO_INVALID_OFFSET) {
 		trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
 		amdgpu_ring_emit_vm_flush(ring, job->vmid, job->vm_pd_addr);
 	}
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1536677012-20921-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 11.09.2018 um 16:43 schrieb Andrey Grodzovsky:

Quoted 31 lines

After GPU reset amdgpu_vm_clear_bo triggers VM flush but job->vm_pd_addr is not set causing SDMA TO.

v2:
Per advise by Christian König avoid flushing VM for jobs where job->vm_pd_addr wasn't explicitly set.

Fixes cbd5285 drm/amdgpu: move setting the GART addr into TTM.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
index 34e54d4..755f733 100644
@@ -73,6 +73,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
  	amdgpu_sync_create(&(*job)->sync);
  	amdgpu_sync_create(&(*job)->sched_sync);
  	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
+	(*job)->vm_pd_addr = AMDGPU_BO_INVALID_OFFSET;
 
  	return 0;
  }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index f5a9600..30beb52 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ · line 868

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -865,7 +865,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_
  	if (need_pipe_sync)
  		amdgpu_ring_emit_pipeline_sync(ring);
 
-	if (vm_flush_needed) {
+	if (vm_flush_needed && job->vm_pd_addr != AMDGPU_BO_INVALID_OFFSET) {

IIRC we had a shortcut a bit above where vm_flush_needed is assigned.

You could do something like "vm_flush_needed &= job->vm_pd_addr != AMDGPU_BO_INVALID_OFFSET" and same the whole prefixing stuff here as well.

Apart from looks good to me and BTW that is quite a good catch.

Thanks,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ · line 871

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
  		trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
  		amdgpu_ring_emit_vm_flush(ring, job->vmid, job->vm_pd_addr);
  	}

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx