selftests/rseq: select only implemented architecture variants
Subsystems (2)
PATCH 1/1 selftests/rseq: select only implemented architecture variants
The rseq headers implement a limited set of targets, and only the little-endian ARM, arm64 and RISC-V variants. Building the suite for LoongArch or for the unsupported endian variants fails in the architecture dispatch of rseq.h.
Ask the target compiler which architecture it builds for before selecting the tests and scripts, so that unsupported targets build, install and emit an empty runlist through the ordinary lib.mk rules. Pass USERCFLAGS to the probe as well, since lib.mk expands the generated program lists before it appends USERCFLAGS to CFLAGS, and filter out only the linker options that the preprocessor would warn about. If the compiler cannot be run, select the tests so that the build fails instead of turning the problem into an empty suite.
This does not add LoongArch support and does not address the remaining compiler-specific build failures on supported targets.
--- tools/testing/selftests/rseq/Makefile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
tools/testing/selftests/rseq/Makefile +15 -3
@@ -18,10 +18,22 @@ LDLIBS += -lpthread -ldl # still track changes to header files and depend on shared object. OVERRIDE_TARGETS = 1 -TEST_GEN_PROGS = basic_test basic_percpu_ops_test basic_percpu_ops_mm_cid_test \ +comma := , +RSEQ_ARCH_SUPPORTED = $(shell printf '\043if defined(__x86_64__) || defined(__i386__) || \ + defined(__ARMEL__) || defined(__AARCH64EL__) || \ + defined(__PPC__) || defined(__mips__) || defined(__s390__) || \ + defined(__or1k__) || (defined(__riscv) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)\n1\n\043endif\n' | \ + $(filter-out -fuse-ld=%,$(CC)) $(filter-out -L% -Wl$(comma)%,$(CFLAGS) $(USERCFLAGS)) \ + -E -P -x c - || echo 1) + +TEST_GEN_PROGS = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_GEN_PROGS)) +TEST_GEN_PROGS_EXTENDED = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_GEN_PROGS_EXTENDED)) +TEST_PROGS = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_PROGS)) + +RSEQ_TEST_GEN_PROGS = basic_test basic_percpu_ops_test basic_percpu_ops_mm_cid_test \ param_test_benchmark param_test_mm_cid_benchmark -TEST_GEN_PROGS_EXTENDED = librseq.so \ +RSEQ_TEST_GEN_PROGS_EXTENDED = librseq.so \ param_test \ param_test_compare_twice \ param_test_mm_cid \
@@ -31,7 +43,7 @@ TEST_GEN_PROGS_EXTENDED = librseq.so \ slice_test \ check_optimized -TEST_PROGS = run_param_test.sh run_syscall_errors_test.sh run_legacy_check.sh run_timeslice_test.sh +RSEQ_TEST_PROGS = run_param_test.sh run_syscall_errors_test.sh run_legacy_check.sh run_timeslice_test.sh TEST_FILES := settings
base-commit: 4eb2586bd40db27d77cc5b724ca9386ed0c71d53
Signature · 1 line
2.53.0
Ping, this still applies on 7.4-rc1. KernelCI still fails to build the rseq suite on loongarch (RSEQ_SIG undeclared), since rseq.h has no loongarch support.
Signature · 2 lines
Thanks, Sasha
[tip: core/rseq] selftests/rseq: Select only implemented architecture variants
In reply to Sasha LevinThe following commit has been merged into the core/rseq branch of tip:
The following commit has been merged into the core/rseq branch of tip:
Commit-ID: 9ad0f2d93caf9b1b70c3f239e72b241313caa21f Gitweb: https://git.kernel.org/tip/9ad0f2d93caf9b1b70c3f239e72b241313caa21f Author: Sasha Levin <[email protected]> AuthorDate: Wed, 14 Oct 2026 16:01:57 -04:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Sun, 08 Nov 2026 13:41:53 +01:00
selftests/rseq: Select only implemented architecture variants
The rseq headers implement a limited set of targets, and only the little-endian ARM, arm64 and RISC-V variants. Building the suite for LoongArch or for the unsupported endian variants fails in the architecture dispatch of rseq.h.
Ask the target compiler which architecture it builds for before selecting the tests and scripts, so that unsupported targets build, install and emit an empty runlist through the ordinary lib.mk rules. Pass USERCFLAGS to the probe as well, since lib.mk expands the generated program lists before it appends USERCFLAGS to CFLAGS, and filter out only the linker options that the preprocessor would warn about. If the compiler cannot be run, select the tests so that the build fails instead of turning the problem into an empty suite.
This does not add LoongArch support and does not address the remaining compiler-specific build failures on supported targets.
--- tools/testing/selftests/rseq/Makefile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
tools/testing/selftests/rseq/Makefile +15 -3
@@ -18,10 +18,22 @@ LDLIBS += -lpthread -ldl # still track changes to header files and depend on shared object. OVERRIDE_TARGETS = 1 -TEST_GEN_PROGS = basic_test basic_percpu_ops_test basic_percpu_ops_mm_cid_test \ +comma := , +RSEQ_ARCH_SUPPORTED = $(shell printf '\043if defined(__x86_64__) || defined(__i386__) || \ + defined(__ARMEL__) || defined(__AARCH64EL__) || \ + defined(__PPC__) || defined(__mips__) || defined(__s390__) || \ + defined(__or1k__) || (defined(__riscv) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)\n1\n\043endif\n' | \ + $(filter-out -fuse-ld=%,$(CC)) $(filter-out -L% -Wl$(comma)%,$(CFLAGS) $(USERCFLAGS)) \ + -E -P -x c - || echo 1) + +TEST_GEN_PROGS = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_GEN_PROGS)) +TEST_GEN_PROGS_EXTENDED = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_GEN_PROGS_EXTENDED)) +TEST_PROGS = $(if $(filter 1,$(RSEQ_ARCH_SUPPORTED)),$(RSEQ_TEST_PROGS)) + +RSEQ_TEST_GEN_PROGS = basic_test basic_percpu_ops_test basic_percpu_ops_mm_cid_test \ param_test_benchmark param_test_mm_cid_benchmark -TEST_GEN_PROGS_EXTENDED = librseq.so \ +RSEQ_TEST_GEN_PROGS_EXTENDED = librseq.so \ param_test \ param_test_compare_twice \ param_test_mm_cid \
@@ -31,7 +43,7 @@ TEST_GEN_PROGS_EXTENDED = librseq.so \ slice_test \ check_optimized -TEST_PROGS = run_param_test.sh run_syscall_errors_test.sh run_legacy_check.sh run_timeslice_test.sh +RSEQ_TEST_PROGS = run_param_test.sh run_syscall_errors_test.sh run_legacy_check.sh run_timeslice_test.sh TEST_FILES := settings