Skip to content

kbuild: fix config make targets being merged as fragment data - #3205

Merged
nuclearcat merged 2 commits into
kernelci:mainfrom
nuclearcat:fix-kselftest-merge-fragment
Sep 9, 2026
Merged

kbuild: fix config make targets being merged as fragment data#3205
nuclearcat merged 2 commits into
kernelci:mainfrom
nuclearcat:fix-kselftest-merge-fragment

Conversation

@nuclearcat

Copy link
Copy Markdown
Member

The kselftest build fragment is a single entry, make:kselftest-merge
(kernelci-pipeline config/fragments.yaml), which tuxmake accepts as a magic
--kconfig-add value (kernelci/tuxmake#275, documented since kernelci/tuxmake#280).

_parse_fragments() writes every fragment entry into fragments/N.config and
passes that file to --kconfig-add, so the directive reaches kconfig as
fragment content and gets merged as unexpected data:

.config:5652:warning: unexpected data: make:kselftest-merge

No kselftest config has been merged since the fragment was switched over, on
either backend. The resulting kernels are missing everything
tools/testing/selftests/*/config asks for — CONFIG_IOMMUFD,
CONFIG_FAULT_INJECTION, CONFIG_USER_NS, CONFIG_BPF_SYSCALL,
CONFIG_VETH, ... — which wipes out whole suites rather than individual tests.

Observed effect in production: kselftest-iommu has 1 pass in 18376 runs
all-time, and accounted for ~43k of the ~61k test-level failures in the
04-07 Sep window (70%), pushing the overall test failure rate from ~3.2% to
9.8%. Every subtest dies in fixture setup on a missing /dev/iommu:

# # iommufd.c:66:simple_close:Expected -1 (-1) != self->fd (-1)

with # CONFIG_IOMMUFD is not set in the build's .config, on hardware whose
IOMMU is otherwise fine (DMAR: dmar0 ..., iommu: Default domain type: Translated).

Changes

  1. kbuild: pass config make targets through to tuxmake — split make:
    directives out of fragment content and keep them as separate kconfig
    additions, ordered with the fragment files so merge order is preserved, then
    pass them to tuxmake verbatim. _fragment_files becomes _kconfig_adds
    since it no longer holds only files. The make backend skips them, unchanged,
    so this commit stands on its own.
  2. kbuild: run config make targets in the make backend — emit
    make <target> in place of the merge_config.sh call. kselftest-merge
    merges into the .config built so far and runs its own olddefconfig, so it
    drops into the existing sequence.

Result

tuxmake: --kconfig-add=.../0.config --kconfig-add=.../1.config \
         --kconfig-add=make:kselftest-merge --kconfig-add=.../3.config

make:    make x86_64_defconfig
         merge_config.sh -m .config .../0.config
         merge_config.sh -m .config .../1.config
         make kselftest-merge
         merge_config.sh -m .config .../3.config
         make olddefconfig

Testing

ruff check and ruff format clean; tests/test_kbuild.py passes (13 tests,
4 new in TestFragments: directive not written to a fragment file, mixed
config/directive fragments split correctly, tuxmake passthrough, make-backend
ordering).

No kernelci-pipeline change is needed — config/fragments.yaml was already
correct; only the consumer was dropping the directive.

Draft: worth a build on staging to confirm CONFIG_IOMMUFD lands in
x86_64_defconfig+lab-setup+x86-board+kselftest before merging, and to check
that the now-effective kselftest-merge doesn't pull in config that upsets
other suites (it is all-or-nothing across every subsystem).

A fragment entry of the form 'make:<target>' names a kernel make target
that generates config, and tuxmake accepts it as a magic --kconfig-add
value. _parse_fragments() instead wrote every fragment entry into a
fragment file and passed that file to --kconfig-add, so the directive
reached kconfig as fragment content, which merged it as:

  .config:5652:warning: unexpected data: make:kselftest-merge

The kselftest fragment consists of exactly that one entry, so no
kselftest config has been merged since it was switched over. The
resulting kernels lack CONFIG_IOMMUFD, CONFIG_USER_NS, CONFIG_BPF_SYSCALL
and everything else tools/testing/selftests/*/config asks for, which
fails whole suites: kselftest-iommu has not passed a single one of its
18376 runs, every subtest dying in fixture setup on a missing /dev/iommu.

Split 'make:' directives out of the fragment content and keep them as
separate kconfig additions, ordered with the fragment files so merge
order is preserved, then pass them to tuxmake verbatim. The make backend
skips them for now.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
The make backend built its .config with merge_config.sh per fragment and
had no way to act on a 'make:<target>' entry, so it skipped them and lost
whatever config the target would have generated, exactly as the tuxmake
backend did before it learned to forward them.

Run the target instead. It merges into the .config produced so far and is
emitted in fragment order, so 'make:kselftest-merge' behaves like the
merge_config.sh call it replaces.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat
nuclearcat marked this pull request as ready for review September 7, 2026 07:01
@nuclearcat
nuclearcat added this pull request to the merge queue Sep 9, 2026
Merged via the queue into kernelci:main with commit ce1cdfb Sep 9, 2026
3 checks passed
@nuclearcat
nuclearcat deleted the fix-kselftest-merge-fragment branch September 9, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant