From: Philip Yang <yangp@amd.com>
To: "Chen, Xiaogang" <xiaogang.chen@amd.com>,
Philip Yang <Philip.Yang@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Felix.Kuehling@amd.com, christian.koenig@amd.com
Subject: Re: [PATCH 2/3] drm/amdgpu: amdgpu_vm_fini hold vm lock to access vm->va
Date: Thu, 15 May 2025 15:47:03 -0400 [thread overview]
Message-ID: <db5c63a3-9f36-add2-1b05-b536ed7d3f7d@amd.com> (raw)
In-Reply-To: <10185695-34f8-4ed3-81d4-69ab109263f1@amd.com>
On 2025-05-15 10:40, Chen, Xiaogang wrote:
>
> On 5/14/2025 12:10 PM, Philip Yang wrote:
>> Move vm root bo unreserve after vm->va mapping free because we should
>> hold vm lock to access vm->va.
>>
>> 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);
>> +
>
> if the places of unresrved/unref vm root here do matter putting them
> at end of this function may look more reasonable.
No, this change doesn't fix any issue, as Christian stated, we should
not have concurrent using of vm inside this function, hold root bo lock
is only required by assert in amdgpu_vm_pt_free_root. I will drop this
patch.
Regards,
Philip
>
> Regards
>
> Xiaogang
>
>
>> dma_fence_put(vm->last_update);
>> for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) {
next prev parent reply other threads:[~2025-05-15 19:47 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
2025-05-15 14:40 ` Chen, Xiaogang
2025-05-15 19:47 ` Philip Yang [this message]
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=db5c63a3-9f36-add2-1b05-b536ed7d3f7d@amd.com \
--to=yangp@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Philip.Yang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=xiaogang.chen@amd.com \
/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.