Skip to contentSkip to conversation

kernel-selftest: update mm (formerly vm) test category

PATCH New Joao Marcos Costa 1 participant 5 messages Apr 20

lore
Share & tools
lore
#0 lore raw

cover kernel-selftest: update mm (formerly vm) test category

Hello,

After a recent change in libhugetlbfs recipe, my attention was drawn (in the mailing list) to the impact this could have in recipes suchs as memcached and kernel-selftest.

This patch series includes my latest changes regarding kernel-selftest, and the memcached recipe will be handled in a follow-up series.

I tested this with both clang and gcc, in qemuriscv64. As you can see in the traces below, 'mm' collection of tests is available and can be executed:

root@qemuriscv64:~# /usr/kernel-selftest/run_kselftest.sh --list
firmware:fw_run_tests.sh
mm:run_vmtests.sh
cpufreq:main.sh
cpu-hotplug:cpu-on-off-test.sh
rtc:rtctest
ptp:testptp
ptp:phc.sh
timers:posix_timers
timers:nanosleep
timers:nsleep-lat
timers:set-timer-lat
timers:mqueue-lat
timers:inconsistency-check
timers:raw_skew
timers:threadtest
timers:rtcpie
root@qemuriscv64:~# /usr/kernel-selftest/run_kselftest.sh -c mm
(...)
# ok 60 test_page_frag.sh aligned # SKIP
# # -unnin--./test_---e_f---.s--non-li-ned
# # running ./test_page_frag.sh nonaligned
# # -unnin--./test_---e_f---.s--non-li-ned
# # ./test_page_frag.sh: You need to compile page_frag_test module
# # [SKIP]
# ok 61 test_page_frag.sh nonaligned # SKIP
# # SUMMARY: PASS=25 SKIP=20 FAIL=16
# 1..61
ok 1 selftests: mm: run_vmtests.sh # SKIP

Best regards,

João Marcos Costa (4):
kernel-selftest: rename vm selftests to mm
kernel-selftest: drop libhugetlbfs
kernel-selftest: fix mm selftests dependencies
kernel-selftest: add missing sources if mm is enabled

 .../kernel-selftest/kernel-selftest.bb        | 23 +++---
 ...s-down-full-CC-and-CFLAGS-to-check_c.patch | 76 +++++++++++++++++++
 2 files changed, 89 insertions(+), 10 deletions(-)
 create mode 100644 meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/4 kernel-selftest: rename vm selftests to mm

Since v6.10 [1], this category of selftests was renamed to 'mm'.

Update the recipe accordingly.

I left a mention to the previous name (i.e., 'vm') just in case.

[1]: https://github.com/torvalds/linux/commit/baa489fabd01596d5426d6e112b34ba5fb59ab82

---
 .../kernel-selftest/kernel-selftest.bb           | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +8 -8
index 430b5974b3..d90720de06 100644
@@ -17,7 +17,7 @@ SRC_URI += "file://run-ptest \
             file://0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch \
             "
 
-# now we just test bpf and vm
+# now we just test bpf and mm (formerly known as vm)
 # we will append other kernel selftest in the future
 # bpf was added in 4.10 with: https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d
 # if you have older kernel than that you need to remove it from PACKAGECONFIG
@@ -25,20 +25,20 @@ PACKAGECONFIG ??= "firmware"
 # bpf needs working clang compiler anyway
 PACKAGECONFIG:append:toolchain-clang:x86-64 = " bpf"
 PACKAGECONFIG:remove:x86 = "bpf"
-PACKAGECONFIG:remove:arm = "bpf vm"
+PACKAGECONFIG:remove:arm = "bpf mm"
 # host ptrace.h is used to compile BPF target but mips ptrace.h is needed
 # progs/loop1.c:21:9: error: incomplete definition of type 'struct user_pt_regs'
 # m = PT_REGS_RC(ctx);
-# vm tests need libhugetlbfs starting 5.8+ (https://lkml.org/lkml/2020/4/22/1654)
-PACKAGECONFIG:remove:qemumips = "bpf vm"
+# mm tests  need libhugetlbfs starting 5.8+ (https://lkml.org/lkml/2020/4/22/1654)
+PACKAGECONFIG:remove:qemumips = "bpf mm"
 
 # riscv does not support libhugetlbfs yet
-PACKAGECONFIG:remove:riscv64 = "bpf vm"
-PACKAGECONFIG:remove:riscv32 = "bpf vm"
+PACKAGECONFIG:remove:riscv64 = "bpf mm"
+PACKAGECONFIG:remove:riscv32 = "bpf mm"
 
 PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native,"
 PACKAGECONFIG[firmware] = ",,libcap, bash"
-PACKAGECONFIG[vm] = ",,libcap libhugetlbfs,libgcc bash"
+PACKAGECONFIG[mm] = ",,libcap libhugetlbfs,libgcc bash"
 
 do_patch[depends] += "virtual/kernel:do_shared_workdir"
 do_compile[depends] += "virtual/kernel:do_install"
@@ -48,7 +48,7 @@ inherit linux-kernel-base module-base kernel-arch ptest siteinfo
 DEBUG_PREFIX_MAP:remove = "-fcanon-prefix-map"
 
 TEST_LIST = "\
-    ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware vm', d)} \
+    ${@bb.utils.filter('PACKAGECONFIG', 'bpf firmware mm', d)} \
     cpufreq \
     cpu-hotplug \
     rtc \
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/4 kernel-selftest: drop libhugetlbfs

In reply to Joao Marcos Costa

The support of libhugetlbfs was removed from mainline Linux a while ago, since v6.1 [1].

Since libhugetlbfs was the main reason to remove 'mm' selftests for some specific architectures, the respective operations should only remove bpf.

Update the recipe to remove libhugetlbfs as a dependency of mm, and thus unblock this test category for some targets.

[1] https://github.com/torvalds/linux/commit/6f83d6c74ea5a5b267be85206822da280cae110a

---
 .../recipes-kernel/kernel-selftest/kernel-selftest.bb | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +4 -7
index d90720de06..08b0c60c6c 100644
@@ -29,16 +29,13 @@ PACKAGECONFIG:remove:arm = "bpf mm"
 # host ptrace.h is used to compile BPF target but mips ptrace.h is needed
 # progs/loop1.c:21:9: error: incomplete definition of type 'struct user_pt_regs'
 # m = PT_REGS_RC(ctx);
-# mm tests  need libhugetlbfs starting 5.8+ (https://lkml.org/lkml/2020/4/22/1654)
-PACKAGECONFIG:remove:qemumips = "bpf mm"
-
-# riscv does not support libhugetlbfs yet
-PACKAGECONFIG:remove:riscv64 = "bpf mm"
-PACKAGECONFIG:remove:riscv32 = "bpf mm"
+PACKAGECONFIG:remove:qemumips = "bpf"
+PACKAGECONFIG:remove:riscv64 = "bpf"
+PACKAGECONFIG:remove:riscv32 = "bpf"
 
 PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native,"
 PACKAGECONFIG[firmware] = ",,libcap, bash"
-PACKAGECONFIG[mm] = ",,libcap libhugetlbfs,libgcc bash"
+PACKAGECONFIG[mm] = ",,libcap, libgcc bash"
 
 do_patch[depends] += "virtual/kernel:do_shared_workdir"
 do_compile[depends] += "virtual/kernel:do_install"
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/4 kernel-selftest: fix mm selftests dependencies

In reply to Joao Marcos Costa

Add numa (numactl), as required by rmap, migration, and others.

Add liburing, otherwise some tests would be disabled.

Moreover, liburing's availability is checked in a shell script executed prior to the compilation of the individual test cases. This script, however, does not read CFLAGS.

Backport a fix [1] from mainline to address this issue.

[1] https://github.com/torvalds/linux/commit/7f532d19c8be76ad2fcd7ab6b0c9eb618f70966b

---
 .../kernel-selftest/kernel-selftest.bb        |  7 +-
 ...s-down-full-CC-and-CFLAGS-to-check_c.patch | 76 +++++++++++++++++++
 2 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +6 -1
index 08b0c60c6c..1e18caedda 100644
@@ -12,9 +12,14 @@ S = "${UNPACKDIR}"
 SRC_URI:append:libc-musl = "\
                       file://userfaultfd.patch \
                       "
+
+# Fix liburing detection (from Linux v7.0)
+MM_PATCH = "file://0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch"
+
 SRC_URI += "file://run-ptest \
             file://COPYING \
             file://0001-selftests-timers-Fix-clock_adjtime-for-newer-32-bit-.patch \
+            ${@bb.utils.contains('PACKAGECONFIG', 'mm', '${MM_PATCH}', '', d)} \
             "
 
 # now we just test bpf and mm (formerly known as vm)
@@ -35,7 +40,7 @@ PACKAGECONFIG:remove:riscv32 = "bpf"
 
 PACKAGECONFIG[bpf] = ",,elfutils elfutils-native libcap libcap-ng rsync-native python3-docutils-native,"
 PACKAGECONFIG[firmware] = ",,libcap, bash"
-PACKAGECONFIG[mm] = ",,libcap, libgcc bash"
+PACKAGECONFIG[mm] = ",,libcap liburing numactl, libgcc bash"
 
 do_patch[depends] += "virtual/kernel:do_shared_workdir"
 do_compile[depends] += "virtual/kernel:do_install"
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/0001-selftests-mm-pass-down-full-CC-and-CFLAGS-to-check_c.patch new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/4 kernel-selftest: add missing sources if mm is enabled

In reply to Joao Marcos Costa

Some headers come from 'mm' (in the top source directory, i.e. the root of Linux's sources), as in the exampels below:

Makefile:LOCAL_HDRS += $(selfdir)/mm/local_config.h $(top_srcdir)/mm/gup_test.h cow.c:#include "../../../../mm/gup_test.h"
gup_longterm.c:#include "../../../../mm/gup_test.h" gup_test.c:#include <mm/gup_test.h>
hmm-tests.c:#include <mm/gup_test.h>
uffd-unit-tests.c:#include "../../../../mm/gup_test.h"

Add this directory to KERNEL_SELFTEST_SRC if 'mm' PACKAGECONFIG is enabled.

---
 meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb | 1 +
 1 file changed, 1 insertion(+)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest.bb +1 -0
index 1e18caedda..5c001696d0 100644
@@ -80,6 +80,7 @@ KERNEL_SELFTEST_SRC ?= "Makefile \
                         tools \
                         scripts \
                         arch \
+                        ${@bb.utils.filter('PACKAGECONFIG', 'mm', d)} \
                         LICENSES \
 "
 do_compile() {
Signature · 1 line
2.43.0