linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>
To: linux-mm@kvack.org
Cc: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>,
	linux-kernel-mentees@lists.linux.dev, akpm@linux-foundation.org,
	shuah@kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [RFC] selftests/mm: Skip tests dependent on a binary not built
Date: Fri, 23 May 2025 21:43:12 +0300	[thread overview]
Message-ID: <20250523184312.2647781-1-khaledelnaggarlinux@gmail.com> (raw)

Hello.

Running the mm selftests from the kernel's root directory
on an x86_64 debian machine using:

  make defconfig
  sudo make kselftest TARGETS=mm

the tests run normally till we reach one which stalls
for 180 seconds and times out according to the following logs:

```
 -----------------------------------------------
 running ./charge_reserved_hugetlb.sh -cgroup-v2
 -----------------------------------------------
 CLEANUP DONE
 CLEANUP DONE
  
 Test normal case.
 private=, populate=, method=0, reserve=
 nr hugepages = 10
 writing cgroup limit: 20971520
 writing reseravation limit: 20971520

 Starting:
 hugetlb_usage=0
 reserved_usage=0
 expect_failure is 0
 Putting task in cgroup 'hugetlb_cgroup_test'
 Method is 0
 >>> write_hugetlb_memory.sh: line 22: ./write_to_hugetlbfs: No such file or directory <<<
 Waiting for hugetlb memory reservation to reach size 10485760.
 0
 Waiting for hugetlb memory reservation to reach size 10485760.
 0
 ...
 Waiting for hugetlb memory reservation to reach size 10485760.
 0
 Waiting for hugetlb memory reservation to reach size 10485760.
 0

 not ok 1 selftests: mm: run_vmtests.sh # TIMEOUT 180 seconds
 make[3]: Leaving directory '/linux/tools/testing/selftests/mm'
```

Logs show that the executable "write_to_hugetlbfs" is missing, causing
the test to hang waiting for hugepage reservations.

The executable not found means it was not built by the Make system.
It is mentioned in Makefile:136-142, and only built if ARCH is 64-bit

```
   ifneq (,$(filter $(ARCH),arm64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390))
   TEST_GEN_FILES += va_high_addr_switch
   ifneq ($(ARCH),riscv64)
   TEST_GEN_FILES += virtual_address_range
   endif
   TEST_GEN_FILES += write_to_hugetlbfs
   endif
```

So, for some reason, the top-level Makefile provides ARCH as x86.

My proposed solution is similar to existing virtual_address_range check
that is to check for the binary, and if it is not found, skip these 2
test cases: charge_reserved_hugetlb.sh and hugetlb_reparenting_test.sh
since they directly and indirectly depend on write_to_hugetlbfs binary.

This is just a workaround, the root issue of different ARCH detection
when running tests from the kernel root directory should still be
addressed. I am not sure how to approach it and open for your suggestions.

Note that this issue does not happen when ran from selftests/mm using
something like

  sudo make -C tools/testing/selftests/mm

because then mm/Makefile's ARCH detection runs correctly (x86_64)

Kindly review and share your thoughts.

Signed-off-by: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>
---
 tools/testing/selftests/mm/run_vmtests.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index dddd1dd8af14..cdbcfdb62f8a 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -375,8 +375,13 @@ CATEGORY="process_mrelease" run_test ./mrelease_test
 CATEGORY="mremap" run_test ./mremap_test

 CATEGORY="hugetlb" run_test ./thuge-gen
+
+# the following depend on write_to_hugetlbfs binary
+if [ -x ./write_to_hugetlbfs ]; then
 CATEGORY="hugetlb" run_test ./charge_reserved_hugetlb.sh -cgroup-v2
 CATEGORY="hugetlb" run_test ./hugetlb_reparenting_test.sh -cgroup-v2
+fi
+
 if $RUN_DESTRUCTIVE; then
 nr_hugepages_tmp=$(cat /proc/sys/vm/nr_hugepages)
 enable_soft_offline=$(cat /proc/sys/vm/enable_soft_offline)
--
2.47.2



             reply	other threads:[~2025-05-23 18:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 18:43 Khaled Elnaggar [this message]
2025-05-23 21:09 ` [RFC] selftests/mm: Skip tests dependent on a binary not built Shuah Khan
2025-05-23 21:33   ` Khaled Elnaggar
2025-06-02 23:22 ` [PATCH RESEND] selftests/mm/run_vmtests.sh: skip hugevm tests if write_to_hugetlbfs is missing Khaled Elnaggar
2025-06-03  2:12   ` Andrew Morton
2025-06-04 22:35     ` Khaled Elnaggar

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=20250523184312.2647781-1-khaledelnaggarlinux@gmail.com \
    --to=khaledelnaggarlinux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).