From: "Christian König" <christian.koenig@amd.com>
To: "Andrey Grodzovsky" <Andrey.Grodzovsky@amd.com>,
"Thomas Hellström (Intel)" <thomas_os@shipmail.org>
Cc: "daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
"michel@daenzer.net" <michel@daenzer.net>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 1/6] drm/ttm: Add unampping of the entire device address space
Date: Wed, 10 Jun 2020 16:05:04 +0200 [thread overview]
Message-ID: <ce6f6109-67df-e3d0-d56e-3f5c27df40a0@amd.com> (raw)
In-Reply-To: <b415e3d1-eed9-9b11-b8c1-c85c7b57eb93@amd.com>
[-- Attachment #1.1: Type: text/plain, Size: 4178 bytes --]
Am 10.06.20 um 15:54 schrieb Andrey Grodzovsky:
>
>
> On 6/10/20 6:15 AM, Thomas Hellström (Intel) wrote:
>>
>>
>> On 6/9/20 7:21 PM, Koenig, Christian wrote:
>>>
>>>
>>> Am 09.06.2020 18:37 schrieb "Grodzovsky, Andrey"
>>> <Andrey.Grodzovsky@amd.com>:
>>>
>>>
>>> On 6/5/20 2:40 PM, Christian König wrote:
>>> > Am 05.06.20 um 16:29 schrieb Andrey Grodzovsky:
>>> >>
>>> >> On 5/11/20 2:45 AM, Christian König wrote:
>>> >>> Am 09.05.20 um 20:51 schrieb Andrey Grodzovsky:
>>> >>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>>> >>>> ---
>>> >>>> drivers/gpu/drm/ttm/ttm_bo.c | 22 +++++++++++++++++++++-
>>> >>>> include/drm/ttm/ttm_bo_driver.h | 2 ++
>>> >>>> 2 files changed, 23 insertions(+), 1 deletion(-)
>>> >>>>
>>> >>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c
>>> >>>> b/drivers/gpu/drm/ttm/ttm_bo.c
>>> >>>> index c5b516f..eae61cc 100644
>>> >>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>> >>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>> >>>> @@ -1750,9 +1750,29 @@ void ttm_bo_unmap_virtual(struct
>>> >>>> ttm_buffer_object *bo)
>>> >>>> ttm_bo_unmap_virtual_locked(bo);
>>> >>>> ttm_mem_io_unlock(man);
>>> >>>> }
>>> >>>> +EXPORT_SYMBOL(ttm_bo_unmap_virtual);
>>> >>>> +void ttm_bo_unmap_virtual_address_space(struct
>>> ttm_bo_device *bdev)
>>> >>>> +{
>>> >>>> + struct ttm_mem_type_manager *man;
>>> >>>> + int i;
>>> >>>> -EXPORT_SYMBOL(ttm_bo_unmap_virtual);
>>> >>>
>>> >>>> + for (i = 0; i < TTM_NUM_MEM_TYPES; i++) {
>>> >>>> + man = &bdev->man[i];
>>> >>>> + if (man->has_type && man->use_type)
>>> >>>> + ttm_mem_io_lock(man, false);
>>> >>>> + }
>>> >>>
>>> >>> You should drop that it will just result in a deadlock
>>> warning for
>>> >>> Nouveau and has no effect at all.
>>> >>>
>>> >>> Apart from that looks good to me,
>>> >>> Christian.
>>> >>
>>> >>
>>> >> As I am considering to re-include this in V2 of the
>>> patchsets, can
>>> >> you clarify please why this will have no effect at all ?
>>> >
>>> > The locks are exclusive for Nouveau to allocate/free the io
>>> address
>>> > space.
>>> >
>>> > Since we don't do this here we don't need the locks.
>>> >
>>> > Christian.
>>>
>>>
>>> So basically calling unmap_mapping_range doesn't require any extra
>>> locking around it and whatever locks are taken within the function
>>> should be enough ?
>>>
>>>
>>>
>>> I think so, yes.
>>>
>>> Christian.
>>
>> Yes, that's true. However, without the bo reservation, nothing stops
>> a PTE from being immediately re-faulted back again. Even while
>> unmap_mapping_range() is running.
>>
>
> Can you explain more on this - specifically, which function to reserve
> the BO, why BO reservation would prevent re-fault of the PTE ?
>
Thomas is talking about ttm_bo_reserver()/ttm_bo_unreserve(), but we
don't need this because we unmap everything because the whole device is
gone and not just manipulate a single BO.
>
>> So the device removed flag needs to be advertized before this
>> function is run,
>>
>
> I indeed intend to call this right after calling drm_dev_unplug from
> amdgpu_pci_remove while adding drm_dev_enter/exit in ttm_bo_vm_fault
> (or in amdgpu specific wrapper since I don't see how can I access
> struct drm_device from ttm_bo_vm_fault) and this in my understanding
> should stop a PTE from being re-faulted back as you pointed out - so
> again I don't see how bo reservation would prevent it so it looks
> like I am missing something...
>
>
>> (perhaps with a memory barrier pair).
>>
>
> drm_dev_unplug and drm_dev_enter/exit are RCU synchronized and so I
> don't think require any extra memory barriers for visibility of the
> removed flag being set
>
As far as I can see that should be perfectly sufficient.
Christian.
>
> Andrey
>
>
>> That should probably be added to the function documentation.
>>
>> (Other than that, please add a commit message if respinning).
>>
>> /Thomas
>>
>>
>>
[-- Attachment #1.2: Type: text/html, Size: 10609 bytes --]
[-- Attachment #2: Type: text/plain, Size: 154 bytes --]
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-06-10 14:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 17:21 [PATCH 1/6] drm/ttm: Add unampping of the entire device address space Koenig, Christian
2020-06-10 10:15 ` Thomas Hellström (Intel)
2020-06-10 13:54 ` Andrey Grodzovsky
2020-06-10 14:05 ` Christian König [this message]
2020-06-10 15:30 ` Daniel Vetter
2020-06-10 20:30 ` Thomas Hellström (Intel)
2020-06-10 21:16 ` Daniel Vetter
2020-06-11 6:12 ` Thomas Hellström (Intel)
2020-06-11 8:24 ` Daniel Vetter
2020-06-11 15:15 ` Andrey Grodzovsky
2020-06-12 6:52 ` Daniel Vetter
2020-06-10 21:19 ` Andrey Grodzovsky
2020-06-11 6:35 ` Thomas Hellström (Intel)
2020-06-11 15:06 ` Andrey Grodzovsky
2020-06-12 6:54 ` Daniel Vetter
2020-06-10 14:07 ` Thomas Hellström (Intel)
-- strict thread matches above, loose matches on Subject: below --
2020-05-09 18:51 [PATCH 0/6] RFC Support hot device unplug in amdgpu Andrey Grodzovsky
2020-05-09 18:51 ` [PATCH 1/6] drm/ttm: Add unampping of the entire device address space Andrey Grodzovsky
2020-05-11 6:45 ` Christian König
2020-06-05 14:29 ` Andrey Grodzovsky
2020-06-05 18:40 ` Christian König
2020-06-09 16:37 ` Andrey Grodzovsky
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=ce6f6109-67df-e3d0-d56e-3f5c27df40a0@amd.com \
--to=christian.koenig@amd.com \
--cc=Andrey.Grodzovsky@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=michel@daenzer.net \
--cc=thomas_os@shipmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox