Skip to contentSkip to conversation

drm/amdgpu: fix amdgpu_vm_bo_insert_map to let bo gets update

PATCH In review Sunil Khatri 2 participants 3 messages Oct 16

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: fix amdgpu_vm_bo_insert_map to let bo gets update

In function amdgpu_vm_bo_insert_map, amdgpu_vm_bo_needs_update is skipped due to amdgpu_vm_is_bo_always_valid but it should not skip for bo's which are allocate have it's own dma_resv object or NULL.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index de992405ed718..3eb778add39be 100644
@@ -1798,7 +1798,7 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev,
 	if (mapping->flags & AMDGPU_VM_PAGE_PRT)
 		amdgpu_vm_prt_get(adev);
 
-	if (amdgpu_vm_is_bo_always_valid(vm, bo) && !bo_va->base.moved)
+	if (!bo_va->base.moved)
 		amdgpu_vm_bo_needs_update(&bo_va->base);
 
 	trace_amdgpu_vm_bo_map(bo_va, mapping);
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu: identify the root PD by pointer in amdgpu_vm_bo_needs_update

bo->tbo.type == ttm_bo_type_kernel && !bo->parent also matches other kernel BOs with no parent, not just vm->root.bo, routing them to idle instead of needs_update. Compare against vm->root.bo directly.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index 3eb778add39be..de44b9408c103 100644
@@ -230,7 +230,7 @@ static void amdgpu_vm_bo_needs_update(struct amdgpu_vm_bo_base *vm_bo)
 	 * idle state.
 	 */
 	lists = amdgpu_vm_bo_lock_lists(vm_bo);
-	if (bo && bo->tbo.type == ttm_bo_type_kernel && !bo->parent) {
+	if (bo == vm_bo->vm->root.bo) {
 		vm_bo->moved = false;
 		list_move(&vm_bo->vm_status, &lists->idle);
 	} else {
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/2
#2 lore raw
In reply to Sunil Khatri
Quoted 5 lines · Sunil Khatri

In function amdgpu_vm_bo_insert_map, amdgpu_vm_bo_needs_update is skipped due to amdgpu_vm_is_bo_always_valid but it should not skip for bo's which are allocate have it's own dma_resv object or NULL.

Quoted 17 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index de992405ed718..3eb778add39be 100644
@@ -1798,7 +1798,7 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev,
 	if (mapping->flags & AMDGPU_VM_PAGE_PRT)
 		amdgpu_vm_prt_get(adev);
 
-	if (amdgpu_vm_is_bo_always_valid(vm, bo) && !bo_va->base.moved)
+	if (!bo_va->base.moved)
 		amdgpu_vm_bo_needs_update(&bo_va->base);
 
 	trace_amdgpu_vm_bo_map(bo_va, mapping);