From: David Hildenbrand <david@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-mm@kvack.org, nouveau@lists.freedesktop.org,
"David Hildenbrand" <david@redhat.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Jonathan Corbet" <corbet@lwn.net>, "Alex Shi" <alexs@kernel.org>,
"Yanteng Si" <si.yanteng@linux.dev>,
"Karol Herbst" <kherbst@redhat.com>,
"Lyude Paul" <lyude@redhat.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
"Vlastimil Babka" <vbabka@suse.cz>,
"Jann Horn" <jannh@google.com>,
"Pasha Tatashin" <pasha.tatashin@soleen.com>,
"Peter Xu" <peterx@redhat.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Jason Gunthorpe" <jgg@nvidia.com>
Subject: [PATCH v1 2/4] mm/mmu_notifier: drop owner from MMU_NOTIFY_EXCLUSIVE
Date: Wed, 29 Jan 2025 12:58:00 +0100 [thread overview]
Message-ID: <20250129115803.2084769-3-david@redhat.com> (raw)
In-Reply-To: <20250129115803.2084769-1-david@redhat.com>
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().
Signed-off-by: David Hildenbrand <david@redhat.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;
-
/*
* serializes the update to mni->invalidate_seq done by caller and
* prevents invalidation of the PTE from progressing while HW is being
@@ -609,7 +605,7 @@ static int nouveau_atomic_range_fault(struct nouveau_svmm *svmm,
notifier_seq = mmu_interval_read_begin(¬ifier->notifier);
mmap_read_lock(mm);
- page = make_device_exclusive(mm, start, drm->dev, &folio);
+ page = make_device_exclusive(mm, start, &folio);
mmap_read_unlock(mm);
if (IS_ERR(page)) {
ret = -EINVAL;
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index d4e714661826..bac2385099dd 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -44,9 +44,7 @@ struct mmu_interval_notifier;
* owner field matches the driver's device private pgmap owner.
*
* @MMU_NOTIFY_EXCLUSIVE: to signal a device driver that the device will no
- * longer have exclusive access to the page. When sent during creation of an
- * exclusive range the owner will be initialised to the value provided by the
- * caller of make_device_exclusive(), otherwise the owner will be NULL.
+ * longer have exclusive access to the page.
*/
enum mmu_notifier_event {
MMU_NOTIFY_UNMAP = 0,
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 86425d42c1a9..3b216b91d2e5 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -664,7 +664,7 @@ void try_to_migrate(struct folio *folio, enum ttu_flags flags);
void try_to_unmap(struct folio *, enum ttu_flags flags);
struct page *make_device_exclusive(struct mm_struct *mm, unsigned long addr,
- void *owner, struct folio **foliop);
+ struct folio **foliop);
/* Avoid racy checks */
#define PVMW_SYNC (1 << 0)
diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 1c0a58279db9..8520c1d1b21b 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -786,7 +786,7 @@ static int dmirror_exclusive(struct dmirror *dmirror,
struct folio *folio;
struct page *page;
- page = make_device_exclusive(mm, addr, &folio, NULL);
+ page = make_device_exclusive(mm, addr, &folio);
if (IS_ERR(page)) {
ret = PTR_ERR(page);
break;
diff --git a/mm/rmap.c b/mm/rmap.c
index 4acc9f6d743a..d99dbf59adc6 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -2397,7 +2397,6 @@ void try_to_migrate(struct folio *folio, enum ttu_flags flags)
* make_device_exclusive() - Mark an address for exclusive use by a device
* @mm: mm_struct of associated target process
* @addr: the virtual address to mark for exclusive device access
- * @owner: passed to MMU_NOTIFY_EXCLUSIVE range notifier to allow filtering
* @foliop: folio pointer will be stored here on success.
*
* This function looks up the page mapped at the given address, grabs a
@@ -2421,7 +2420,7 @@ void try_to_migrate(struct folio *folio, enum ttu_flags flags)
* Returns: pointer to mapped page on success, otherwise a negative error.
*/
struct page *make_device_exclusive(struct mm_struct *mm, unsigned long addr,
- void *owner, struct folio **foliop)
+ struct folio **foliop)
{
struct folio *folio, *fw_folio;
struct vm_area_struct *vma;
--
2.48.1
next prev parent reply other threads:[~2025-01-29 11:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 11:57 [PATCH v1 0/4] mm: cleanups for device-exclusive entries (hmm) David Hildenbrand
2025-01-29 11:57 ` [PATCH v1 1/4] lib/test_hmm: make dmirror_atomic_map() consume a single page David Hildenbrand
2025-01-30 0:29 ` Alistair Popple
2025-01-29 11:58 ` David Hildenbrand [this message]
2025-01-30 5:34 ` [PATCH v1 2/4] mm/mmu_notifier: drop owner from MMU_NOTIFY_EXCLUSIVE Alistair Popple
2025-01-30 9:28 ` David Hildenbrand
2025-01-30 13:29 ` Simona Vetter
2025-01-30 15:26 ` David Hildenbrand
2025-01-29 11:58 ` [PATCH v1 3/4] mm/memory: pass folio and pte to restore_exclusive_pte() David Hildenbrand
2025-01-30 5:37 ` Alistair Popple
2025-01-29 11:58 ` [PATCH v1 4/4] mm/memory: document restore_exclusive_pte() David Hildenbrand
2025-01-30 0:27 ` Alistair Popple
2025-01-30 9:37 ` David Hildenbrand
2025-01-30 13:31 ` Simona Vetter
2025-01-30 15:29 ` David Hildenbrand
2025-01-31 0:14 ` Alistair Popple
2025-01-31 17:20 ` Simona Vetter
2025-01-30 10:43 ` Simona Vetter
2025-01-31 0:20 ` Alistair Popple
2025-01-31 9:15 ` David Hildenbrand
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=20250129115803.2084769-3-david@redhat.com \
--to=david@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=apopple@nvidia.com \
--cc=corbet@lwn.net \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jannh@google.com \
--cc=jgg@nvidia.com \
--cc=jglisse@redhat.com \
--cc=kherbst@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=pasha.tatashin@soleen.com \
--cc=peterx@redhat.com \
--cc=si.yanteng@linux.dev \
--cc=simona@ffwll.ch \
--cc=vbabka@suse.cz \
/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.