All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@kernel.org>
Cc: "Shuah Khan" <shuah@kernel.org>, "Dan Rue" <dan.rue@linaro.org>,
	"Björn Töpel" <bjorn@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-kselftest@vger.kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] kbuild: sort the config fragments in kselftest-merge
Date: Thu,  3 Dec 2026 13:48:37 -0500	[thread overview]
Message-ID: <20261203184837.390792-1-sashal@kernel.org> (raw)

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


             reply	other threads:[~2026-12-03 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 18:48 Sasha Levin [this message]
2026-12-04 18:33 ` [PATCH] kbuild: sort the config fragments in kselftest-merge Nicolas Schier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203184837.390792-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dan.rue@linaro.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.