drm/amdgpu: only update spm vmid at first time
Subsystems (2)
PATCH 1/1 drm/amdgpu: only update spm vmid at first time
Original idea is from Monk which only update spm vmid at first time which can release the frequent r/w register burden under virtualization.
v2: set spm_vmid_updated to false when job timedout
Signed-off-by Yintian Tao <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3 -0
@@ -50,6 +50,9 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job)DRM_ERROR ("Process information: process %s pid %d thread %s pid %d\n" , ti.process_name, ti.tgid, ti.task_name, ti.pid); +if (job->vm) + job->vm->spm_vmid_updated = false; +if (amdgpu_device_should_recover_gpu (ring->adev)) {amdgpu_device_gpu_recover (ring->adev, job); }else {
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6 -2
@@ -1080,11 +1080,14 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,struct dma_fence *fence =NULL ;bool pasid_mapping_needed = false;unsigned patch_offset =0 ; -bool update_spm_vmid_needed = (job->vm && (job->vm->reserved_vmid[vmhub] !=NULL )); +bool update_spm_vmid_needed = (job->vm && (job->vm->reserved_vmid[vmhub] !=NULL ) && + !job->vm->spm_vmid_updated);int r; -if (update_spm_vmid_needed && adev->gfx.rlc.funcs->update_spm_vmid) +if (update_spm_vmid_needed && adev->gfx.rlc.funcs->update_spm_vmid) { adev->gfx.rlc.funcs->update_spm_vmid (adev, job->vmid); + job->vm->spm_vmid_updated = true; + }if (amdgpu_vmid_had_gpu_reset (adev, id)) { gds_switch_needed = true;
@@ -2797,6 +2800,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,int r, i; vm->va =RB_ROOT_CACHED ; + vm->spm_vmid_updated = false;for (i =0 ; i <AMDGPU_MAX_VMHUBS ; i++) vm->reserved_vmid[i] =NULL ;INIT_LIST_HEAD (&vm->evicted);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -0
@@ -319,6 +319,8 @@ struct amdgpu_vm {bool bulk_moveable;/* Flag to indicate if VM is used for compute */ bool is_compute_context; +/* flag to represent whether spm vmid has been updated */ +bool spm_vmid_updated; };struct amdgpu_vm_manager {
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx