From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,ryan.roberts@arm.com,avagin@google.com,akpm@linux-foundation.org
Subject: [folded-merged] selftests-mm-check-that-pagemap_scan-returns-correct-categories-fix.patch removed from -mm tree
Date: Sun, 10 Dec 2023 16:42:14 -0800 [thread overview]
Message-ID: <20231211004214.D4D58C433C8@smtp.kernel.org> (raw)
The quilt patch titled
Subject: selftests/mm: don't fail if pagemap_scan isn't supported
has been removed from the -mm tree. Its filename was
selftests-mm-check-that-pagemap_scan-returns-correct-categories-fix.patch
This patch was dropped because it was folded into selftests-mm-check-that-pagemap_scan-returns-correct-categories.patch
------------------------------------------------------
From: Andrei Vagin <avagin@google.com>
Subject: selftests/mm: don't fail if pagemap_scan isn't supported
Date: Fri, 17 Nov 2023 10:11:27 -0800
This change allows to run tests on old kernels.
Link: https://lkml.kernel.org/r/20231117181127.2574897-1-avagin@google.com
Reported-by: Ryan Roberts <ryan.roberts@arm.com>
Closes: https://lore.kernel.org/lkml/696a0a99-eb42-4e13-be14-58a88c9c33f7@arm.com/
Signed-off-by: Andrei Vagin <avagin@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/mm/vm_util.c | 51 +++++++++++++++++++------
1 file changed, 39 insertions(+), 12 deletions(-)
--- a/tools/testing/selftests/mm/vm_util.c~selftests-mm-check-that-pagemap_scan-returns-correct-categories-fix
+++ a/tools/testing/selftests/mm/vm_util.c
@@ -29,15 +29,13 @@ uint64_t pagemap_get_entry(int fd, char
return entry;
}
-static uint64_t pagemap_scan_get_categories(int fd, char *start)
+static uint64_t __pagemap_scan_get_categories(int fd, char *start, struct page_region *r)
{
struct pm_scan_arg arg;
- struct page_region r;
- long ret;
arg.start = (uintptr_t)start;
arg.end = (uintptr_t)(start + psize());
- arg.vec = (uintptr_t)&r;
+ arg.vec = (uintptr_t)r;
arg.vec_len = 1;
arg.flags = 0;
arg.size = sizeof(struct pm_scan_arg);
@@ -49,7 +47,15 @@ static uint64_t pagemap_scan_get_categor
PAGE_IS_HUGE | PAGE_IS_SOFT_DIRTY;
arg.return_mask = arg.category_anyof_mask;
- ret = ioctl(fd, PAGEMAP_SCAN, &arg);
+ return ioctl(fd, PAGEMAP_SCAN, &arg);
+}
+
+static uint64_t pagemap_scan_get_categories(int fd, char *start)
+{
+ struct page_region r;
+ long ret;
+
+ ret = __pagemap_scan_get_categories(fd, start, &r);
if (ret < 0)
ksft_exit_fail_msg("PAGEMAP_SCAN failed: %s\n", strerror(errno));
if (ret == 0)
@@ -57,18 +63,39 @@ static uint64_t pagemap_scan_get_categor
return r.categories;
}
+/* `start` is any valid address. */
+static bool pagemap_scan_supported(int fd, char *start)
+{
+ static int supported = -1;
+ int ret;
+
+ if (supported != -1)
+ return supported;
+
+ /* Provide an invalid address in order to trigger EFAULT. */
+ ret = __pagemap_scan_get_categories(fd, start, (struct page_region *) ~0UL);
+ if (ret == 0)
+ ksft_exit_fail_msg("PAGEMAP_SCAN succedded unexpectedly\n");
+
+ supported = errno == EFAULT;
+
+ return supported;
+}
+
static bool page_entry_is(int fd, char *start, char *desc,
uint64_t pagemap_flags, uint64_t pagescan_flags)
{
- bool m, s;
+ bool m = pagemap_get_entry(fd, start) & pagemap_flags;
+
+ if (pagemap_scan_supported(fd, start)) {
+ bool s = pagemap_scan_get_categories(fd, start) & pagescan_flags;
- m = pagemap_get_entry(fd, start) & pagemap_flags;
- s = pagemap_scan_get_categories(fd, start) & pagescan_flags;
- if (m == s)
- return m;
+ if (m == s)
+ return m;
- ksft_exit_fail_msg(
- "read and ioctl return unmatched results for %s: %d %d", desc, m, s);
+ ksft_exit_fail_msg(
+ "read and ioctl return unmatched results for %s: %d %d", desc, m, s);
+ }
return m;
}
_
Patches currently in -mm which might be from avagin@google.com are
fs-proc-task_mmu-report-soft_dirty-bits-through-the-pagemap_scan-ioctl.patch
selftests-mm-check-that-pagemap_scan-returns-correct-categories.patch
reply other threads:[~2023-12-11 0:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20231211004214.D4D58C433C8@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=avagin@google.com \
--cc=mm-commits@vger.kernel.org \
--cc=ryan.roberts@arm.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 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.