drm/amdgpu: install stub fence into potential unused fence pointers
Subsystems (2)
PATCH 1/1 drm/amdgpu: install stub fence into potential unused fence pointers
When using cpu to update page tables, vm update fences are unused. Install stub fence into these fence pointers instead of NULL to avoid NULL dereference when calling dma_fence_wait() on them.
Suggested-by Christian König <[email protected]>
Signed-off-by Lang Yu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -2
@@ -1444,6 +1444,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,amdgpu_vm_bo_base_init (&bo_va->base, vm, bo); bo_va->ref_count =1 ; + bo_va->last_pt_update =dma_fence_get_stub ();INIT_LIST_HEAD (&bo_va->valids);INIT_LIST_HEAD (&bo_va->invalids);
@@ -2144,7 +2145,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) vm->update_funcs = &amdgpu_vm_cpu_funcs; else vm->update_funcs = &amdgpu_vm_sdma_funcs; - vm->last_update =NULL ; + + vm->last_update =dma_fence_get_stub (); vm->last_unlocked =dma_fence_get_stub (); vm->last_tlb_flush =dma_fence_get_stub (); vm->generation =0 ;
@@ -2267,7 +2269,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm) goto unreserve_bo;dma_fence_put (vm->last_update); - vm->last_update =NULL ; + vm->last_update =dma_fence_get_stub (); vm->is_compute_context = true;/* Free the shadow bo for compute VM */
Signature · 1 line
2.25.1
Am 05.05.23 um 14:44 schrieb Lang Yu:
Quoted 6 lines
When using cpu to update page tables, vm update fences are unused. Install stub fence into these fence pointers instead of NULL to avoid NULL dereference when calling
dma_fence_wait()on them.Suggested-by Christian König <[email protected]>Signed-off-by Lang Yu <[email protected]>
Reviewed-by Christian König <[email protected]>
Quoted 35 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4
-2@@ -1444,6 +1444,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,amdgpu_vm_bo_base_init (&bo_va->base, vm, bo); bo_va->ref_count =1 ; + bo_va->last_pt_update =dma_fence_get_stub ();INIT_LIST_HEAD (&bo_va->valids);INIT_LIST_HEAD (&bo_va->invalids);@@ -2144,7 +2145,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) vm->update_funcs = &amdgpu_vm_cpu_funcs; else vm->update_funcs = &amdgpu_vm_sdma_funcs; - vm->last_update =NULL ; + + vm->last_update =dma_fence_get_stub (); vm->last_unlocked =dma_fence_get_stub (); vm->last_tlb_flush =dma_fence_get_stub (); vm->generation =0 ;@@ -2267,7 +2269,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm) goto unreserve_bo;dma_fence_put (vm->last_update); - vm->last_update =NULL ; + vm->last_update =dma_fence_get_stub (); vm->is_compute_context = true;/* Free the shadow bo for compute VM */