[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eab05949-efc8-4c04-ace1-b4435ec894e6@redhat.com>
Date: Thu, 30 Jan 2025 10:28:00 +0100
From: David Hildenbrand <david@...hat.com>
To: Alistair Popple <apopple@...dia.com>
Cc: linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-mm@...ck.org,
nouveau@...ts.freedesktop.org, Andrew Morton <akpm@...ux-foundation.org>,
Jérôme Glisse <jglisse@...hat.com>,
Jonathan Corbet <corbet@....net>, Alex Shi <alexs@...nel.org>,
Yanteng Si <si.yanteng@...ux.dev>, Karol Herbst <kherbst@...hat.com>,
Lyude Paul <lyude@...hat.com>, Danilo Krummrich <dakr@...nel.org>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>,
Pasha Tatashin <pasha.tatashin@...een.com>, Peter Xu <peterx@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>
Subject: Re: [PATCH v1 2/4] mm/mmu_notifier: drop owner from
MMU_NOTIFY_EXCLUSIVE
On 30.01.25 06:34, Alistair Popple wrote:
> On Wed, Jan 29, 2025 at 12:58:00PM +0100, David Hildenbrand wrote:
>> We no longer get a MMU_NOTIFY_EXCLUSIVE on conversion with the owner set
>> that one has to filter out: if there already *is* a device-exclusive
>> entry (e.g., other device, we don't have that information), GUP will
>> convert it back to an ordinary PTE and notify via
>> remove_device_exclusive_entry().
>
> What tree is this against? I tried applying to v6.13 and Linus current master
> but neither applied cleanly.
See the cover letter. This is on top of the fixes series, which is based
on mm-unstable from yesterday.
>
>> Signed-off-by: David Hildenbrand <david@...hat.com>
>> ---
>> drivers/gpu/drm/nouveau/nouveau_svm.c | 6 +-----
>> include/linux/mmu_notifier.h | 4 +---
>> include/linux/rmap.h | 2 +-
>> lib/test_hmm.c | 2 +-
>> mm/rmap.c | 3 +--
>> 5 files changed, 5 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
>> index 39e3740980bb..4758fee182b4 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_svm.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
>> @@ -510,10 +510,6 @@ static bool nouveau_svm_range_invalidate(struct mmu_interval_notifier *mni,
>> struct svm_notifier *sn =
>> container_of(mni, struct svm_notifier, notifier);
>>
>> - if (range->event == MMU_NOTIFY_EXCLUSIVE &&
>> - range->owner == sn->svmm->vmm->cli->drm->dev)
>> - return true;
>
> I think this will cause a live-lock because make_device_exclusive_range()
> will call the notifier which without the filtering will increment the sequence
> count and cause endless retries of the loop in nouveau_atomic_range_fault().
> The notifier needs to be able to figure out if it was called in response to
> something this thread did (ie. make_device_exclusive_range) and can therefore
> ignore the invalidation, or from some other thread.
Yes, as discussed in the other patch, this must stay to inform secondary
MMUs about the conversion *to* device exclusive.
>
> Looking at hmm_test I see that doesn't use the sequence counter to ensure
> the PTE remains valid whilst it is mapped. I think that is probably wrong, so
> apologies if that lead you astray.
Yes, the hmm_test does not completely follow the same model the nouveau
implementation does; so it might not be completely correct.
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists