* + selftests-fix-arch-normalization-to-handle-command-line-argument.patch added to mm-nonmm-unstable branch
@ 2026-03-09 21:06 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-03-09 21:06 UTC (permalink / raw)
To: mm-commits, shuah, richard.weiyang, aleksey.oladko, akpm
The patch titled
Subject: selftests: fix ARCH normalization to handle command-line argument
has been added to the -mm mm-nonmm-unstable branch. Its filename is
selftests-fix-arch-normalization-to-handle-command-line-argument.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-fix-arch-normalization-to-handle-command-line-argument.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
Subject: selftests: fix ARCH normalization to handle command-line argument
Date: Mon, 9 Mar 2026 20:51:45 +0000
Several selftests Makefiles (e.g. prctl, breakpoints, etc) attempt to
normalize the ARCH variable by converting x86_64 and i.86 to x86.
However, it uses the conditional assignment operator '?='.
When ARCH is passed as a command-line argument (e.g., during an rpmbuild
process), the '?=' operator ignores the shell command and the sed
transformation. This leads to an incorrect ARCH value being used, which
causes build failures
# make -C tools/testing/selftests TARGETS=prctl ARCH=x86_64
make: Entering directory '/build/tools/testing/selftests'
make[1]: Entering directory '/build/tools/testing/selftests/prctl'
make[1]: *** No targets. Stop.
make[1]: Leaving directory '/build/tools/testing/selftests/prctl'
make: *** [Makefile:197: all] Error 2
Change the assignment to use 'override' and ':=' to ensure the
normalization logic is applied regardless of how the ARCH variable was
initially defined.
Link: https://lkml.kernel.org/r/20260309205145.572778-1-aleksey.oladko@virtuozzo.com
Signed-off-by: Aleksei Oladko <aleksey.oladko@virtuozzo.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/breakpoints/Makefile | 4 ++--
tools/testing/selftests/ipc/Makefile | 8 ++++----
tools/testing/selftests/prctl/Makefile | 4 ++--
tools/testing/selftests/sparc64/Makefile | 4 ++--
tools/testing/selftests/thermal/intel/power_floor/Makefile | 4 ++--
tools/testing/selftests/thermal/intel/workload_hint/Makefile | 4 ++--
6 files changed, 14 insertions(+), 14 deletions(-)
--- a/tools/testing/selftests/breakpoints/Makefile~selftests-fix-arch-normalization-to-handle-command-line-argument
+++ a/tools/testing/selftests/breakpoints/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
# Taken from perf makefile
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
TEST_GEN_PROGS := step_after_suspend_test
--- a/tools/testing/selftests/ipc/Makefile~selftests-fix-arch-normalization-to-handle-command-line-argument
+++ a/tools/testing/selftests/ipc/Makefile
@@ -1,12 +1,12 @@
# SPDX-License-Identifier: GPL-2.0
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/)
ifeq ($(ARCH),i386)
- ARCH := x86
+ override ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
endif
ifeq ($(ARCH),x86_64)
- ARCH := x86
+ override ARCH := x86
CFLAGS := -DCONFIG_X86_64 -D__x86_64__
endif
--- a/tools/testing/selftests/prctl/Makefile~selftests-fix-arch-normalization-to-handle-command-line-argument
+++ a/tools/testing/selftests/prctl/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
--- a/tools/testing/selftests/sparc64/Makefile~selftests-fix-arch-normalization-to-handle-command-line-argument
+++ a/tools/testing/selftests/sparc64/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/x86_64/x86/)
ifneq ($(ARCH),sparc64)
nothing:
--- a/tools/testing/selftests/thermal/intel/power_floor/Makefile~selftests-fix-arch-normalization-to-handle-command-line-argument
+++ a/tools/testing/selftests/thermal/intel/power_floor/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_GEN_PROGS := power_floor_test
--- a/tools/testing/selftests/thermal/intel/workload_hint/Makefile~selftests-fix-arch-normalization-to-handle-command-line-argument
+++ a/tools/testing/selftests/thermal/intel/workload_hint/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_GEN_PROGS := workload_hint_test
_
Patches currently in -mm which might be from aleksey.oladko@virtuozzo.com are
selftests-fix-arch-normalization-to-handle-command-line-argument.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-09 21:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 21:06 + selftests-fix-arch-normalization-to-handle-command-line-argument.patch added to mm-nonmm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.