The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] kbuild: sort the config fragments in kselftest-merge
@ 2026-12-03 18:48 Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2026-12-03 18:48 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Shuah Khan, Dan Rue, Björn Töpel, linux-kbuild,
	linux-kselftest, bpf, linux-kernel

kselftest-merge passes the selftest config fragments to merge_config.sh
in the order find(1) returns them, which is the directory order of the
filesystem. Where two fragments select different members of a choice,
the result depends on which of them is merged last, so the same tree can
give different configurations on different machines.

Two choices are affected today:

 - bpf/config.aarch64 and bpf/config.s390x select HZ_100, while
   net/packetdrill/config selects HZ_1000;
 - bpf/config, exec/config and ftrace/config select DEBUG_INFO_DWARF4,
   while vsock/config selects DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT.

KernelCI builds its selftest kernels with this target. Its arm64 builds
of v7.4-rc5-100-g0810bd27d7bb and v7.4-rc5-103-gd06ce6f1eb5e merged the
fragments in different orders, and the two configurations differ only in
the timer frequency: HZ is 100 in the first and 1000 in the second.

Sort the list. The Makefile sets LC_COLLATE=C, so the order is the same
everywhere. The shell glob that find replaced was sorted as well.

Fixes: 6d3db46c8e33 ("kbuild: teach kselftest-merge to find nested config files")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Based on mainline (d06ce6f1eb5e). It also applies to next-20261202.

Tested with arm64 and x86_64 defconfig and LLVM=1. Merging the fragments
by hand in sorted and in reverse order gives configs that differ in the
HZ and DWARF choices on arm64, and in the DWARF choice on x86_64. With
this patch kselftest-merge gives the sorted one, also with
LC_ALL=en_US.UTF-8 in the environment.

The conflicting fragments are not changed. With the sorted order both
architectures get HZ_1000 and DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT.

The two KernelCI builds, with the .config next to each log:

  https://files.kernelci.org/kbuild-gcc-14-arm64-6b1087cd37f1074a9a2871b8/build.log.gz
  https://files.kernelci.org/kbuild-gcc-14-arm64-6b10cf3037f1074a9a2b95c6/build.log.gz

 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 3bd24ea8ff893..2327a97a061c0 100644
--- a/Makefile
+++ b/Makefile
@@ -1657,6 +1657,7 @@ PHONY += kselftest-merge
 kselftest-merge:
 	$(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
 	$(Q)find $(srctree)/tools/testing/selftests -name config -o -name config.$(UTS_MACHINE) | \
+		sort | \
 		xargs $(srctree)/scripts/kconfig/merge_config.sh -y -m $(objtree)/.config
 	$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 18:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 18:48 [PATCH] kbuild: sort the config fragments in kselftest-merge Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox