[PATCH 2/3] drm/amdgpu: amdgpu_vm_fini hold vm lock to access vm->va
Christian König
christian.koenig at amd.com
Thu May 15 12:18:49 UTC 2025
On 5/14/25 19:10, Philip Yang wrote:
> Move vm root bo unreserve after vm->va mapping free because we should
> hold vm lock to access vm->va.
That should be unnecessary since we are about to destroy the VM.
If anybody is concurrently using it at that point we are completely busted anyway.
Regards,
Christian.
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 3911c78f8282..fb5baa6ec32d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2740,10 +2740,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
> }
>
> amdgpu_vm_pt_free_root(adev, vm);
> - amdgpu_bo_unreserve(root);
> - amdgpu_bo_unref(&root);
> - WARN_ON(vm->root.bo);
> -
> amdgpu_vm_fini_entities(vm);
>
> if (!RB_EMPTY_ROOT(&vm->va.rb_root)) {
> @@ -2758,6 +2754,10 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
> kfree(mapping);
> }
>
> + amdgpu_bo_unreserve(root);
> + amdgpu_bo_unref(&root);
> + WARN_ON(vm->root.bo);
> +
> dma_fence_put(vm->last_update);
>
> for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) {
More information about the amd-gfx
mailing list