Skip to content

Commit b735874

Browse files
Lang Yusmb49
authored andcommitted
drm/amdgpu: install stub fence into potential unused fence pointers
BugLink: https://bugs.launchpad.net/bugs/2039110 [ Upstream commit 187916e ] 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 <christian.koenig@amd.com> Signed-off-by: Lang Yu <Lang.Yu@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 85f058c commit b735874

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
13601360
amdgpu_vm_bo_base_init(&bo_va->base, vm, bo);
13611361

13621362
bo_va->ref_count = 1;
1363+
bo_va->last_pt_update = dma_fence_get_stub();
13631364
INIT_LIST_HEAD(&bo_va->valids);
13641365
INIT_LIST_HEAD(&bo_va->invalids);
13651366

@@ -2081,7 +2082,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
20812082
vm->update_funcs = &amdgpu_vm_cpu_funcs;
20822083
else
20832084
vm->update_funcs = &amdgpu_vm_sdma_funcs;
2084-
vm->last_update = NULL;
2085+
2086+
vm->last_update = dma_fence_get_stub();
20852087
vm->last_unlocked = dma_fence_get_stub();
20862088
vm->last_tlb_flush = dma_fence_get_stub();
20872089

@@ -2206,7 +2208,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
22062208
goto unreserve_bo;
22072209

22082210
dma_fence_put(vm->last_update);
2209-
vm->last_update = NULL;
2211+
vm->last_update = dma_fence_get_stub();
22102212
vm->is_compute_context = true;
22112213

22122214
/* Free the shadow bo for compute VM */

0 commit comments

Comments
 (0)