Browse Source

drm/amdgpu: fix amdgpu_vm_fini

We should not remove mappings in rbtree_postorder_for_each_entry_safe
because that rebalances the tree.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Christian König 6 years ago
parent
commit
0af5c656fd
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

+ 3 - 1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

@@ -3234,8 +3234,10 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	}
 	}
 	rbtree_postorder_for_each_entry_safe(mapping, tmp,
 	rbtree_postorder_for_each_entry_safe(mapping, tmp,
 					     &vm->va.rb_root, rb) {
 					     &vm->va.rb_root, rb) {
+		/* Don't remove the mapping here, we don't want to trigger a
+		 * rebalance and the tree is about to be destroyed anyway.
+		 */
 		list_del(&mapping->list);
 		list_del(&mapping->list);
-		amdgpu_vm_it_remove(mapping, &vm->va);
 		kfree(mapping);
 		kfree(mapping);
 	}
 	}
 	list_for_each_entry_safe(mapping, tmp, &vm->freed, list) {
 	list_for_each_entry_safe(mapping, tmp, &vm->freed, list) {