All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Philip Yang <Philip.Yang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Felix.Kuehling@amd.com
Subject: Re: [PATCH 2/3] drm/amdgpu: amdgpu_vm_fini hold vm lock to access vm->va
Date: Thu, 15 May 2025 14:18:49 +0200	[thread overview]
Message-ID: <f59f0e01-eeed-43bc-83dd-c0b269b45965@amd.com> (raw)
In-Reply-To: <20250514171004.4259-3-Philip.Yang@amd.com>

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@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++) {


  reply	other threads:[~2025-05-15 12:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 17:10 [PATCH 0/3] Remove process exit error message Philip Yang
2025-05-14 17:10 ` [PATCH 1/3] drm/amdgpu: seq64 memory unmap uses uninterruptible lock Philip Yang
2025-05-21  7:06   ` Christian König
2025-05-14 17:10 ` [PATCH 2/3] drm/amdgpu: amdgpu_vm_fini hold vm lock to access vm->va Philip Yang
2025-05-15 12:18   ` Christian König [this message]
2025-05-15 14:40   ` Chen, Xiaogang
2025-05-15 19:47     ` Philip Yang
2025-05-14 17:10 ` [PATCH 3/3] drm/amdkfd: destroy_pdds release pdd->drm_file at end Philip Yang
2025-05-15 14:29   ` Chen, Xiaogang
2025-05-15 20:45     ` Philip Yang
2025-05-15 21:31       ` Chen, Xiaogang
2025-05-16 13:07         ` Philip Yang
2025-05-16 15:19           ` Chen, Xiaogang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f59f0e01-eeed-43bc-83dd-c0b269b45965@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.