linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/12] selftests/mm: Some cleanups from trying to run them
@ 2025-03-11 13:18 Brendan Jackman
  2025-03-11 13:18 ` [PATCH v4 01/12] selftests/mm: Report errno when things fail in gup_longterm Brendan Jackman
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Brendan Jackman @ 2025-03-11 13:18 UTC (permalink / raw)
  To: Lorenzo Stoakes, Andrew Morton, Shuah Khan
  Cc: Dev Jain, linux-mm, linux-kselftest, linux-kernel,
	Brendan Jackman, Mateusz Guzik

I never had much luck running mm selftests so I spent a few hours
digging into why.

Looks like most of the reason is missing SKIP checks, so this series is
just adding a bunch of those that I found. I did not do anything like
all of them, just the ones I spotted in gup_longterm, gup_test, mmap,
userfaultfd and memfd_secret.

It's a bit unfortunate to have to skip those tests when ftruncate()
fails, but I don't have time to dig deep enough into it to actually make
them pass. I have observed the issue on 9pfs and heard rumours that NFS
has a similar problem.

I'm now able to run these test groups successfully:

- mmap
- gup_test
- compaction
- migration
- page_frag
- userfaultfd
- mlock

I've never gone past "Waiting for hugetlb memory to get depleted", in
the hugetlb tests. I don't know if they are stuck or if they would
eventually work if I was patient enough (testing on a 1G machine). I
have not investigated further.

I had some issues with mlock tests failing due to -ENOSRCH from
mlock2(), I can no longer reproduce that though, things work OK now.

Of the remaining tests there may be others that work fine, but there's
no convenient way to survey the whole output of run_vmtests.sh so I'm
just going test by test here.

In my spare moments I am slowly chipping away at a setup to run these
tests continuously in a reasonably hermetic QEMU environment via
virtme-ng:

https://github.com/bjackman/linux/blob/5fad4b9c592290f38e0f8bc73c9abb9c99d8787c/README.md

Hopefully that will eventually offer a way to provide a "canned"
environment where the tests are known to work, which can be fairly
easily reproduced by any developer.

Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
Changes in v4:
- NOT ADDRESSED: still using errno==ENOENT as a hacky way to detect
  buggy filesystems:
  https://lore.kernel.org/all/CA+i-1C3srkh44tN8dMQ5aD-jhoksUkdEpa+mMfdDtDrPAUv7gQ@mail.gmail.com/
- Added some incomplete cleanups for the mlock tests.
- Fixed divide-by-zero error when running uffd-stress on <32cpu systems.
- Fixed misnamed nr_threads variable (now nr_parallel).
- Fixed reporting io_uring errors (retval instead of errno).
- Link to v3: https://lore.kernel.org/r/20250228-mm-selftests-v3-0-958e3b6f0203@google.com

Changes in v3:
- Added fix for userfaultfd tests.
- Dropped attempts to use sudo.
- Fixed garbage printf in uffd-stress.
  (Added EXTRA_CFLAGS=-Werror FORCE_TARGETS=1 to my scripts to prevent
   such errors happening again).
- Fixed missing newlines in ksft_test_result_skip() calls.
- Link to v2: https://lore.kernel.org/r/20250221-mm-selftests-v2-0-28c4d66383c5@google.com

Changes in v2 (Thanks to Dev for the reviews):
- Improve and cleanup some error messages
- Add some extra SKIPs
- Fix misnaming of nr_cpus variable in uffd tests
- Link to v1: https://lore.kernel.org/r/20250220-mm-selftests-v1-0-9bbf57d64463@google.com

---
Brendan Jackman (12):
      selftests/mm: Report errno when things fail in gup_longterm
      selftests/mm: Skip uffd-stress if userfaultfd not available
      selftests/mm: Skip uffd-wp-mremap if userfaultfd not available
      selftests/mm/uffd: Rename nr_cpus -> nr_parallel
      selftests/mm: Print some details when uffd-stress gets bad params
      selftests/mm: Don't fail uffd-stress if too many CPUs
      selftests/mm: Skip map_populate on weird filesystems
      selftests/mm: Skip gup_longterm tests on weird filesystems
      selftests/mm: Drop unnecessary sudo usage
      selftests/mm: Ensure uffd-wp-mremap gets pages of each size
      selftests/mm: Skip mlock tests if nobody user can't read it
      selftests/mm/mlock: Print error on failure

 tools/testing/selftests/mm/gup_longterm.c      | 45 +++++++++++++++++---------
 tools/testing/selftests/mm/map_populate.c      |  7 ++++
 tools/testing/selftests/mm/mlock-random-test.c |  4 +--
 tools/testing/selftests/mm/mlock2.h            |  8 ++++-
 tools/testing/selftests/mm/run_vmtests.sh      | 27 ++++++++++++++--
 tools/testing/selftests/mm/uffd-common.c       |  8 ++---
 tools/testing/selftests/mm/uffd-common.h       |  2 +-
 tools/testing/selftests/mm/uffd-stress.c       | 42 +++++++++++++++---------
 tools/testing/selftests/mm/uffd-unit-tests.c   |  2 +-
 tools/testing/selftests/mm/uffd-wp-mremap.c    |  5 ++-
 10 files changed, 105 insertions(+), 45 deletions(-)
---
base-commit: dcb38e6757f1b7944af9347ce6b54263d3666478
change-id: 20250220-mm-selftests-2d7d0542face

Best regards,
-- 
Brendan Jackman <jackmanb@google.com>



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-03-11 13:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-11 13:18 [PATCH v4 00/12] selftests/mm: Some cleanups from trying to run them Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 01/12] selftests/mm: Report errno when things fail in gup_longterm Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 02/12] selftests/mm: Skip uffd-stress if userfaultfd not available Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 03/12] selftests/mm: Skip uffd-wp-mremap " Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 04/12] selftests/mm/uffd: Rename nr_cpus -> nr_parallel Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 05/12] selftests/mm: Print some details when uffd-stress gets bad params Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 06/12] selftests/mm: Don't fail uffd-stress if too many CPUs Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 07/12] selftests/mm: Skip map_populate on weird filesystems Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 08/12] selftests/mm: Skip gup_longterm tests " Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 09/12] selftests/mm: Drop unnecessary sudo usage Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 10/12] selftests/mm: Ensure uffd-wp-mremap gets pages of each size Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 11/12] selftests/mm: Skip mlock tests if nobody user can't read it Brendan Jackman
2025-03-11 13:18 ` [PATCH v4 12/12] selftests/mm/mlock: Print error on failure Brendan Jackman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox