From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Bhardwaj, Rajneesh" <rajneesh.bhardwaj@amd.com>,
Felix Kuehling <felix.kuehling@amd.com>,
amd-gfx@lists.freedesktop.org, "Deucher,
Alexander" <Alexander.Deucher@amd.com>
Subject: Re: [PATCH] drm/amdgpu: move lockdep assert to the right place.
Date: Fri, 4 Feb 2022 19:50:33 +0100 [thread overview]
Message-ID: <cc241e74-40a6-7b87-d80d-a338361abd01@gmail.com> (raw)
In-Reply-To: <df73c8a3-0c85-0402-01e4-38e6bec5af17@amd.com>
Am 04.02.22 um 19:47 schrieb Bhardwaj, Rajneesh:
>
> On 2/4/2022 1:32 PM, Christian König wrote:
>> Am 04.02.22 um 19:12 schrieb Bhardwaj, Rajneesh:
>>> [Sorry for top posting]
>>>
>>> Hi Christian
>>>
>>> I think you forgot the below hunk, without which the issue is not
>>> fixed completely on a multi GPU system.
>>
>> No, that is perfectly intentional. While removing a bo_va structure
>> it can happen that there are still mappings attached to it (for
>> example because the application crashed).
>
>
> OK. but for me, at boot time, I see flood of warning messages coming
> from amdgpu_vm_bo_del so the previous patch doesn't help.
Do you have a backtrace? That should not happen.
Could be that we have this buggy at a couple of different places.
Regards,
Christian.
>
>
>>
>> Because of this locking the VM before the remove is mandatory. Only
>> while adding a bo_va structure we can avoid that.
>>
>> Regards,
>> Christian.
>>
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> index dcc80d6e099e..6f68fc9da56a 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> @@ -2670,8 +2670,6 @@ void amdgpu_vm_bo_del(struct amdgpu_device *adev,
>>> struct amdgpu_vm *vm = bo_va->base.vm;
>>> struct amdgpu_vm_bo_base **base;
>>>
>>> - dma_resv_assert_held(vm->root.bo->tbo.base.resv);
>>> -
>>> if (bo) {
>>> dma_resv_assert_held(bo->tbo.base.resv);
>>> if (bo->tbo.base.resv == vm->root.bo->tbo.base.resv)
>>>
>>>
>>> If you chose to include the above hunk, please feel free to add
>>>
>>> Reviewed-and-tested-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
>>>
>>> On 2/4/2022 11:27 AM, Felix Kuehling wrote:
>>>>
>>>> Am 2022-02-04 um 03:52 schrieb Christian König:
>>>>> Since newly added BOs don't have any mappings it's ok to add them
>>>>> without holding the VM lock. Only when we add per VM BOs the lock is
>>>>> mandatory.
>>>>>
>>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>>> Reported-by: Bhardwaj, Rajneesh <Rajneesh.Bhardwaj@amd.com>
>>>>
>>>> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
>>>>
>>>>
>>>>> ---
>>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
>>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>>>> index fdc6a1fd74af..dcc80d6e099e 100644
>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>>>> @@ -375,6 +375,8 @@ static void amdgpu_vm_bo_base_init(struct
>>>>> amdgpu_vm_bo_base *base,
>>>>> if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv)
>>>>> return;
>>>>> + dma_resv_assert_held(vm->root.bo->tbo.base.resv);
>>>>> +
>>>>> vm->bulk_moveable = false;
>>>>> if (bo->tbo.type == ttm_bo_type_kernel && bo->parent)
>>>>> amdgpu_vm_bo_relocated(base);
>>>>> @@ -2260,8 +2262,6 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct
>>>>> amdgpu_device *adev,
>>>>> {
>>>>> struct amdgpu_bo_va *bo_va;
>>>>> - dma_resv_assert_held(vm->root.bo->tbo.base.resv);
>>>>> -
>>>>> bo_va = kzalloc(sizeof(struct amdgpu_bo_va), GFP_KERNEL);
>>>>> if (bo_va == NULL) {
>>>>> return NULL;
>>
next prev parent reply other threads:[~2022-02-04 18:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-04 8:52 [PATCH] drm/amdgpu: move lockdep assert to the right place Christian König
2022-02-04 14:28 ` Deucher, Alexander
2022-02-04 16:27 ` Felix Kuehling
2022-02-04 18:12 ` Bhardwaj, Rajneesh
2022-02-04 18:32 ` Christian König
2022-02-04 18:47 ` Bhardwaj, Rajneesh
2022-02-04 18:50 ` Christian König [this message]
2022-02-04 19:15 ` Bhardwaj, Rajneesh
2022-02-07 7:24 ` Christian König
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=cc241e74-40a6-7b87-d80d-a338361abd01@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Alexander.Deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=rajneesh.bhardwaj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox