Commit 019b277b authored by Muhammad Usama Anjum's avatar Muhammad Usama Anjum Committed by Andrew Morton

selftests: mm: skip whole test instead of failure

Some architectures don't support userfaultfd.  Skip running the whole test
on them instead of registering the failure.

Link: https://lkml.kernel.org/r/20231103182343.2874015-1-usama.anjum@collabora.com
Fixes: 46fd75d4 ("selftests: mm: add pagemap ioctl tests")
Reported-by: default avatarRyan Roberts <ryan.roberts@arm.com>
Closes: https://lore.kernel.org/all/f8463381-2697-49e9-9460-9dc73452830d@arm.comSigned-off-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 85c2ceaa
...@@ -94,19 +94,19 @@ int init_uffd(void) ...@@ -94,19 +94,19 @@ int init_uffd(void)
uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK | UFFD_USER_MODE_ONLY); uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK | UFFD_USER_MODE_ONLY);
if (uffd == -1) if (uffd == -1)
ksft_exit_fail_msg("uffd syscall failed\n"); return uffd;
uffdio_api.api = UFFD_API; uffdio_api.api = UFFD_API;
uffdio_api.features = UFFD_FEATURE_WP_UNPOPULATED | UFFD_FEATURE_WP_ASYNC | uffdio_api.features = UFFD_FEATURE_WP_UNPOPULATED | UFFD_FEATURE_WP_ASYNC |
UFFD_FEATURE_WP_HUGETLBFS_SHMEM; UFFD_FEATURE_WP_HUGETLBFS_SHMEM;
if (ioctl(uffd, UFFDIO_API, &uffdio_api)) if (ioctl(uffd, UFFDIO_API, &uffdio_api))
ksft_exit_fail_msg("UFFDIO_API\n"); return -1;
if (!(uffdio_api.api & UFFDIO_REGISTER_MODE_WP) || if (!(uffdio_api.api & UFFDIO_REGISTER_MODE_WP) ||
!(uffdio_api.features & UFFD_FEATURE_WP_UNPOPULATED) || !(uffdio_api.features & UFFD_FEATURE_WP_UNPOPULATED) ||
!(uffdio_api.features & UFFD_FEATURE_WP_ASYNC) || !(uffdio_api.features & UFFD_FEATURE_WP_ASYNC) ||
!(uffdio_api.features & UFFD_FEATURE_WP_HUGETLBFS_SHMEM)) !(uffdio_api.features & UFFD_FEATURE_WP_HUGETLBFS_SHMEM))
ksft_exit_fail_msg("UFFDIO_API error %llu\n", uffdio_api.api); return -1;
return 0; return 0;
} }
...@@ -1479,6 +1479,10 @@ int main(void) ...@@ -1479,6 +1479,10 @@ int main(void)
struct stat sbuf; struct stat sbuf;
ksft_print_header(); ksft_print_header();
if (init_uffd())
return ksft_exit_pass();
ksft_set_plan(115); ksft_set_plan(115);
page_size = getpagesize(); page_size = getpagesize();
...@@ -1488,9 +1492,6 @@ int main(void) ...@@ -1488,9 +1492,6 @@ int main(void)
if (pagemap_fd < 0) if (pagemap_fd < 0)
return -EINVAL; return -EINVAL;
if (init_uffd())
ksft_exit_fail_msg("uffd init failed\n");
/* 1. Sanity testing */ /* 1. Sanity testing */
sanity_tests_sd(); sanity_tests_sd();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment