* [PATCH 0/5] selftests: target selection fixes for cross and LLVM builds @ 2026-10-14 20:01 Sasha Levin 2026-10-14 20:01 ` [PATCH 4/5] selftests/kexec: select tests using the target compiler Sasha Levin 0 siblings, 1 reply; 3+ messages in thread From: Sasha Levin @ 2026-10-14 20:01 UTC (permalink / raw) To: Shuah Khan Cc: Sasha Levin, Ivan Orlov, Rafael J. Wysocki, Srinivas Pandruvada, Daniel Lezcano, linux-pm, David Woodhouse, Nageswara R Sastry, kexec, Willy Tarreau, Thomas Weißschuh, Wake Liu, linux-kselftest, linux-kernel A few suites select their tests from the build host instead of the target, or depend on the host C library in ways that break cross builds. This series fixes the ones found while building the selftests for several architectures: - prctl and the Intel thermal suites build nothing when CROSS_COMPILE is set, even for x86, and prctl restricts two generic tests to x86. - set-anon-vma-name-test fails instead of skipping on kernels built without CONFIG_ANON_VMA_NAME. - kexec only recognizes the ppc64le spelling of PowerPC and decides about the x86-64 jump test from the build host. - size links a custom _start against the static C library, which fails on ARM with clang and on LoongArch; it now uses nolibc. The patches are independent of each other. Sasha Levin (5): selftests/prctl: build generated tests for the target architecture selftests/prctl: skip the anonymous VMA naming test when unsupported selftests/thermal: allow cross builds of the Intel tests selftests/kexec: select tests using the target compiler selftests/size: use nolibc startup and syscall wrappers tools/testing/selftests/kexec/Makefile | 26 ++++++++------- tools/testing/selftests/prctl/Makefile | 18 +++++----- .../selftests/prctl/set-anon-vma-name-test.c | 3 ++ tools/testing/selftests/size/Makefile | 9 ++++- tools/testing/selftests/size/get_size.c | 33 +++++-------------- .../thermal/intel/power_floor/Makefile | 12 +++---- .../thermal/intel/workload_hint/Makefile | 12 +++---- 7 files changed, 52 insertions(+), 61 deletions(-) base-commit: 4eb2586bd40db27d77cc5b724ca9386ed0c71d53 -- 2.53.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 4/5] selftests/kexec: select tests using the target compiler 2026-10-14 20:01 [PATCH 0/5] selftests: target selection fixes for cross and LLVM builds Sasha Levin @ 2026-10-14 20:01 ` Sasha Levin 2026-10-14 20:08 ` sashiko-bot 0 siblings, 1 reply; 3+ messages in thread From: Sasha Levin @ 2026-10-14 20:01 UTC (permalink / raw) To: Shuah Khan Cc: Sasha Levin, David Woodhouse, Nageswara R Sastry, kexec, linux-kselftest, linux-kernel The kexec Makefile recognizes PowerPC only through the ppc64le spelling of ARCH, so the canonical ARCH=powerpc used for cross builds omits the tests. The x86 jump test is selected with IS_64_BIT from scripts/Makefile.arch, which describes the build host rather than the compiler being used. On other architectures the Makefile includes no lib.mk rules at all, so installation and runlist generation fail with missing targets. Select x86 and PowerPC from the target ARCH when it is given and from the host's SUBARCH otherwise, without assigning ARCH, so that lib.mk keeps choosing the compiler's native clang target. Ask the selected compiler, including USERCFLAGS, whether it targets a 64-bit x86 ABI and whether it targets little-endian 64-bit PowerPC. lib.mk expands the generated program list before it appends USERCFLAGS to CFLAGS, so the flags are passed explicitly to keep both probes consistent. If the compiler cannot be run, select the jump test so that the build fails instead of silently dropping it. Include lib.mk unconditionally so that unsupported targets build, install and emit an empty runlist. Fixes: 65e38e32a959 ("selftests/kexec: Enable secureboot tests for PowerPC") Fixes: 7615b94b6371 ("selftests/kexec: Add x86_64 selftest for kexec-jump and exception handling") Signed-off-by: Sasha Levin <sashal@kernel.org> --- tools/testing/selftests/kexec/Makefile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/kexec/Makefile b/tools/testing/selftests/kexec/Makefile index 874cfdd3b75b3..97d5dd10208a1 100644 --- a/tools/testing/selftests/kexec/Makefile +++ b/tools/testing/selftests/kexec/Makefile @@ -1,20 +1,22 @@ # SPDX-License-Identifier: GPL-2.0-only # Makefile for kexec tests -ARCH ?= $(shell uname -m 2>/dev/null || echo not) -ARCH_PROCESSED := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/) +top_srcdir = ../../../.. +include $(top_srcdir)/scripts/subarch.include +ARCH_PROCESSED := $(shell echo $(or $(ARCH),$(SUBARCH)) | sed -e s/i.86/x86/ -e s/x86_64/x86/) -ifeq ($(ARCH_PROCESSED),$(filter $(ARCH_PROCESSED),x86 ppc64le)) -TEST_PROGS := test_kexec_load.sh test_kexec_file_load.sh -TEST_FILES := kexec_common_lib.sh +PROBE_CC = $(filter-out -fuse-ld=%,$(CC)) $(CFLAGS) $(USERCFLAGS) -E -P -x c - +CC_IS_64BIT = $(shell echo __SIZEOF_LONG__ | $(PROBE_CC) || echo 8) +PPC64LE = $(shell printf '\043if defined(__powerpc64__) && __BYTE_ORDER__ == \ + __ORDER_LITTLE_ENDIAN__\n1\n\043endif\n' | $(PROBE_CC)) -include ../../../scripts/Makefile.arch - -ifeq ($(IS_64_BIT)$(ARCH_PROCESSED),1x86) -TEST_PROGS += test_kexec_jump.sh -TEST_GEN_PROGS := test_kexec_jump +ifeq ($(ARCH_PROCESSED),x86) +TEST_PROGS = test_kexec_load.sh test_kexec_file_load.sh \ + $(if $(filter 8,$(CC_IS_64BIT)),test_kexec_jump.sh) +TEST_GEN_PROGS = $(if $(filter 8,$(CC_IS_64BIT)),test_kexec_jump) +else ifneq (,$(filter powerpc ppc64le,$(ARCH_PROCESSED))) +TEST_PROGS = $(if $(filter 1,$(PPC64LE)),test_kexec_load.sh test_kexec_file_load.sh) endif +TEST_FILES = $(if $(TEST_PROGS),kexec_common_lib.sh) include ../lib.mk - -endif -- 2.53.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] selftests/kexec: select tests using the target compiler 2026-10-14 20:01 ` [PATCH 4/5] selftests/kexec: select tests using the target compiler Sasha Levin @ 2026-10-14 20:08 ` sashiko-bot 0 siblings, 0 replies; 3+ messages in thread From: sashiko-bot @ 2026-10-14 20:08 UTC (permalink / raw) To: Sasha Levin, Shuah Khan; +Cc: David Woodhouse, Nageswara R Sastry, kexec > The kexec Makefile recognizes PowerPC only through the ppc64le spelling > of ARCH, so the canonical ARCH=powerpc used for cross builds omits the > tests. The x86 jump test is selected with IS_64_BIT from > scripts/Makefile.arch, which describes the build host rather than the > compiler being used. On other architectures the Makefile includes no > lib.mk rules at all, so installation and runlist generation fail with > missing targets. > > Select x86 and PowerPC from the target ARCH when it is given and from > the host's SUBARCH otherwise, without assigning ARCH, so that lib.mk > keeps choosing the compiler's native clang target. Ask the selected > compiler, including USERCFLAGS, whether it targets a 64-bit x86 ABI > and whether it targets little-endian 64-bit PowerPC. lib.mk expands the > generated program list before it appends USERCFLAGS to CFLAGS, so the > flags are passed explicitly to keep both probes consistent. If the > compiler cannot be run, select the jump test so that the build fails > instead of silently dropping it. Include lib.mk unconditionally so that > unsupported targets build, install and emit an empty runlist. > > Fixes: 65e38e32a959 ("selftests/kexec: Enable secureboot tests for PowerPC") > Fixes: 7615b94b6371 ("selftests/kexec: Add x86_64 selftest for kexec-jump and exception handling") > Signed-off-by: Sasha Levin <sashal@kernel.org> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/20261014200127.1363472-1-sashal@kernel.org?part=4 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-14 20:08 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-10-14 20:01 [PATCH 0/5] selftests: target selection fixes for cross and LLVM builds Sasha Levin 2026-10-14 20:01 ` [PATCH 4/5] selftests/kexec: select tests using the target compiler Sasha Levin 2026-10-14 20:08 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox