[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240618-exclusive-gup-v1-4-30472a19c5d1@quicinc.com>
Date: Tue, 18 Jun 2024 17:05:10 -0700
From: Elliot Berman <quic_eberman@...cinc.com>
To: Andrew Morton <akpm@...ux-foundation.org>, Shuah Khan <shuah@...nel.org>,
David Hildenbrand <david@...hat.com>,
Matthew Wilcox <willy@...radead.org>, <maz@...nel.org>
CC: <kvm@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <pbonzini@...hat.com>,
Elliot Berman
<quic_eberman@...cinc.com>
Subject: [PATCH RFC 4/5] mm/gup-test: Verify exclusive pinned
Add test that pages have the exclusive pin bias when providing
FOLL_EXCLUSIVE.
Signed-off-by: Elliot Berman <quic_eberman@...cinc.com>
---
mm/gup_test.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/mm/gup_test.c b/mm/gup_test.c
index eeb3f4d87c510..9c6b8c93e44a7 100644
--- a/mm/gup_test.c
+++ b/mm/gup_test.c
@@ -66,6 +66,26 @@ static void verify_dma_pinned(unsigned int cmd, struct page **pages,
}
}
+static void verify_exclusive_pinned(unsigned int gup_flags, struct page **pages,
+ unsigned long nr_pages)
+{
+ unsigned long i;
+ const struct folio *folio;
+
+ if (!(gup_flags & FOLL_EXCLUSIVE))
+ return;
+
+ for (i = 0; i < nr_pages; i++) {
+ folio = page_folio(pages[i]);
+
+ if (WARN(!folio_maybe_exclusive_pinned(folio),
+ "pages[%lu] is not exclusive pinned\n", i)) {
+ dump_page(&folio->page, "gup_test failure");
+ break;
+ }
+ }
+}
+
static void dump_pages_test(struct gup_test *gup, struct page **pages,
unsigned long nr_pages)
{
@@ -185,6 +205,8 @@ static int __gup_test_ioctl(unsigned int cmd,
*/
verify_dma_pinned(cmd, pages, nr_pages);
+ verify_exclusive_pinned(gup->gup_flags, pages, nr_pages);
+
if (cmd == DUMP_USER_PAGES_TEST)
dump_pages_test(gup, pages, nr_pages);
--
2.34.1
Powered by blists - more mailing lists