net: mctp: Stop selecting flow support for KUnit tests
PATCH 1/1 net: mctp: Stop selecting flow support for KUnit tests
MCTP_TEST selects MCTP_FLOWS, which also enables SKB_EXTENSIONS when no transport requires them. Remove the selection to follow the dependency rule in Documentation/dev-tools/kunit/style.rst.
The two flow-specific tests already skip when MCTP_FLOWS is disabled. The remaining tests can run in either configuration.
---
Validation on net-next 42a9fb3382fc: x86_64 LLVM builds and QEMU runs with MCTP_FLOWS disabled and enabled. Both suites pass. With flow support disabled, only the two flow-specific cases skip. The enabled configuration uses the I2C transport to select MCTP_FLOWS.
net/mctp/Kconfig | 1 - 1 file changed, 1 deletion(-)
net/mctp/Kconfig +0 -1
@@ -14,7 +14,6 @@ menuconfig MCTP config MCTP_TEST bool "MCTP core tests" if !KUNIT_ALL_TESTS - select MCTP_FLOWS depends on MCTP=y && KUNIT=y default KUNIT_ALL_TESTS
base-commit: 42a9fb3382fc2573e92f41d203b095d9a372cfc9
Jeremy Kerr
maintainerHi Karl,
Quoted 2 lines
MCTP_TESTselectsMCTP_FLOWS, which also enablesSKB_EXTENSIONSwhen no transport requires them.
But we want to test the flows support, why disable this (and consequently skip the flow tests in the vast majority of test runs)?
Quoted 2 lines
Remove the selection to follow the dependency
rule inDocumentation/dev-tools/kunit/style.rst.
That suggests "depending on", rather than removing the coverage.
Cheers,
Jeremy
Quoted 5 lines · Jeremy Kerr
Hi Karl,
Quoted 2 lines
MCTP_TESTselectsMCTP_FLOWS, which also enablesSKB_EXTENSIONSwhen no transport requires them.
Quoted 8 lines
But we want to test the flows support, why disable this (and consequently skip the flow tests in the vast majority of test runs)?
Quoted 2 lines
Remove the selection to follow the dependency
rule inDocumentation/dev-tools/kunit/style.rst.That suggests "depending on", rather than removing the coverage.
Hi Jeremy,
Thanks for the review!
OK, I can change that.
I was confused by the existing !MCTP_FLOWS fallbacks, but now understand that you want the suite to retain full flow-test coverage.
Karl
PATCH v2 1/1 net: mctp: Make KUnit tests depend on flow support
In reply to Karl MehltretterMCTP_TEST selects MCTP_FLOWS, which also enables SKB_EXTENSIONS when no transport requires them. Enabling tests should not silently enable additional kernel functionality.
Make the tests depend on MCTP_FLOWS instead, following the dependency rule in Documentation/dev-tools/kunit/style.rst.
This keeps the full flow-test coverage: the suite is available only when flow support is enabled, for example by the I2C transport.
---
Changes in v2:
- Depend on MCTP_FLOWS instead of removing the selection, as Jeremy requested, to retain full flow-test coverage.
- Rebase onto current net-next (014d795c7383).
v1: https://lore.kernel.org/r/[email protected]/
Review: https://lore.kernel.org/r/8edc4e71edceb124e2dca233cddb75e198b53a51.camel@codeconstruct.com.au/
Validation on net-next 014d795c7383: x86_64 GCC 15.2 builds and QEMU run. Both MCTP suites pass all 80 cases, including both flow tests, with no skips. Kconfig checks cover flow support on/off, KUNIT_ALL_TESTS on/off and a module I2C transport.
net/mctp/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mctp/Kconfig +1 -1
@@ -14,7 +14,7 @@ menuconfig MCTP config MCTP_TEST bool "MCTP core tests" if !KUNIT_ALL_TESTS - select MCTP_FLOWS + depends on MCTP_FLOWS depends on MCTP=y && KUNIT=y default KUNIT_ALL_TESTS
base-commit: 014d795c73837ea2339a4ea8e8f82c6e959b845d
Signature · 1 line
2.39.5 (Apple Git-154)
Jeremy Kerr
maintainerRe: [PATCH net-next v2] net: mctp: Make KUnit tests depend on flow support
Hi Karl,
Quoted 6 lines
MCTP_TESTselectsMCTP_FLOWS, which also enablesSKB_EXTENSIONSwhen no transport requires them. Enabling tests should not silently enable additional kernel functionality.Make the tests depend on
MCTP_FLOWSinstead, following the dependency rule inDocumentation/dev-tools/kunit/style.rst.
[...]
Quoted 4 lines
index
d8d3413a37f7..e64d4f7ef6aa100644net/mctp/Kconfig +0
-0@@ -14,7 +14,7 @@ menuconfig MCTP
Quoted 8 lines
configMCTP_TEST
bool "MCTP core tests" if !KUNIT_ALL_TESTS - selectMCTP_FLOWS
+ depends onMCTP_FLOWS
depends on MCTP=y && KUNIT=y defaultKUNIT_ALL_TESTS
Now _the whole suite_ is not going to get enabled for the usual kunit testing, since flows isn't individually selectable.
Quoted 2 lines
This keeps the full flow-test coverage: the suite is available only when flow support is enabled, for example by the I2C transport.
Hardware transports are typically not enabled for kunit test kernels.
Are you attempting to fix an actual problem you're encountering? What's the aim with this change?
Cheers,
Jeremy
Re: [PATCH net-next v2] net: mctp: Make KUnit tests depend on flow support
Quoted 8 lines · Jeremy Kerr
Quoted 2 lines
This keeps the full flow-test coverage: the suite is available only when flow support is enabled, for example by the I2C transport.
Hardware transports are typically not enabled for kunit test kernels.
Are you attempting to fix an actual problem you're encountering? What's the aim with this change?
Hi Jeremy,
It's no real-world MCTP workload bug. This came from a similar issue in my 842 KUnit patch: the test selected the decompressor. Geert pointed out that tests should not silently enable otherwise-unused code:
https://lore.kernel.org/r/CAMuHMdVcZ5cV4-HrjLYfFKh6UshiVxq5eXCNyp0Z1k_SMAvF5g@mail.gmail.com/
My goal is to keep KUNIT_ALL_TESTS from pulling in otherwise-unused production code. An explicit opt-in could preserve the coverage, following CRC_ENABLE_ALL_FOR_KUNIT and CRYPTO_LIB_ENABLE_ALL_FOR_KUNIT:
- MCTP_ENABLE_ALL_FOR_KUNIT depends on KUNIT=y and MCTP=y
- it selects MCTP_FLOWS
- all_tests.config enables it
- MCTP_TEST depends on MCTP_FLOWS
This keeps KUNIT_ALL_TESTS from enabling optional flow code, while the explicit kunit.py run --alltests profile opts into it and retains full flow coverage without requiring a hardware transport.
Would that approach work for you?
Karl
[email protected]
AI reviewRe: [PATCH net-next v2] net: mctp: Make KUnit tests depend on flow support
In reply to Karl MehltretterThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] This patch breaks kunit.py run --alltests and drops the MCTP core KUnit suite from all-tests CI runs.
- [Medium] mctp: core test suite disabled on minimal configs due to hidden Kconfig dependency
--
net: mctp: Make KUnit tests depend on flow support
This patch changes MCTP_TEST so that it depends on MCTP_FLOWS instead of selecting it. The goal is to stop the tests from silently turning on SKB_EXTENSIONS. The suite is then available only when something else, such as the I2C transport, enables flow support.
net/mctp/Kconfig menuconfig MCTP · line 19
Quoted 12 lines
net/mctp/Kconfig +1
-1@@ -14,7 +14,7 @@ menuconfig MCTP config MCTP_TEST bool "MCTP core tests" if !KUNIT_ALL_TESTS - select MCTP_FLOWS + depends on MCTP_FLOWS depends on MCTP=y && KUNIT=y default KUNIT_ALL_TESTS
[Severity: Medium]
Does this make the whole MCTP core suite unreachable on minimal KUnit configs?
MCTP_FLOWS is a bool with no prompt, so it can only be enabled through a select. After this change, the only way to satisfy the new dependency is to pull in a transport that selects it. Today that means I2C, I2C_SLAVE and MCTP_TRANSPORT_I2C.
A .kunitconfig that asks only for the core pieces, something like:
CONFIG_KUNIT=y
CONFIG_NET=y
CONFIG_MCTP=y
CONFIG_MCTP_TEST=y
now resolves MCTP_TEST to n. KunitConfig.validate_config() would then reject the run, because CONFIG_MCTP_TEST=y never reaches the generated .config. In menuconfig the "MCTP core tests" prompt simply disappears, with no hint that an I2C slave transport is needed to get it back.
The commit message says the suite is available only when flow support is enabled. That undersells the cost. The gate is not only on the two flow tests but on every routing and socket case in route-test.c and sock-test.c. Most of those have nothing to do with flows. The configs that lose them are exactly the small ones developers are most likely to use for quick KUnit runs.
The patch also leaves dead code behind. route-test.c still has the !CONFIG_MCTP_FLOWS stubs, such as mctp_test_packet_flow(), which only call kunit_skip(test, "Requires CONFIG_MCTP_FLOWS=y"). With MCTP_TEST now depending on MCTP_FLOWS, those branches can never be compiled.
Which direction do you and Jeremy prefer here? Some options:
- Keep the core suite independent of MCTP_FLOWS and let the existing skip stubs report the flow cases as skipped.
- Move the flow cases into a separate suite that carries the dependency.
- Provide a net/mctp/.kunitconfig that enables the I2C transport bits so the suite is still easy to run.
If the dependency stays as written, should the unreachable kunit_skip() stubs be removed in the same patch?
[Severity: Medium]
Will this break kunit.py run --alltests?
tools/testing/kunit/configs/all_tests.config still contains:
CONFIG_MCTP=y
CONFIG_MCTP_FLOWS=y
That line came in with commit 109a5331143d. It only took effect because MCTP_TEST, enabled via KUNIT_ALL_TESTS=y, selected MCTP_FLOWS.
MCTP_FLOWS has no prompt:
config MCTP_FLOWS
bool
depends on MCTP
select SKB_EXTENSIONS
so a direct assignment in a config fragment is ignored unless something selects the symbol.
After this patch, the only selector left in the tree is MCTP_TRANSPORT_I2C in drivers/net/mctp/Kconfig:
depends on I2C_SLAVE
select MCTP_FLOWS
all_tests.config enables neither I2C_SLAVE nor MCTP_TRANSPORT_I2C, so MCTP_FLOWS resolves to n.
KunitConfig.validate_config() in tools/testing/kunit/kunit_kernel.py would then find CONFIG_MCTP_FLOWS=y missing from the generated .config. It would report "Not all Kconfig options selected in kunitconfig were in the generated .config" and return False. build_config() then fails, so the whole --alltests run would stop at the config step.
Even if validation were skipped, the new "depends on MCTP_FLOWS" would make MCTP_TEST resolve to n there. That drops the whole MCTP core suite (sock-test.c and route-test.c) from all-tests coverage.
Given that, is this statement in the commit message accurate for the in-tree all-tests config?
This keeps the full flow-test coverage: the suite is available only when flow support is enabled, for example by the I2C transport.
Could all_tests.config be updated in the same patch? For example, it could add CONFIG_I2C_SLAVE=y and CONFIG_MCTP_TRANSPORT_I2C=y (CONFIG_I2C=y is already set there). At minimum, the line that can no longer be satisfied could be removed.
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260928205352.30502-1-kmehltretter%40gmail.com
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] The patch removes select MCTP_FLOWS from config MCTP_TEST in net/mctp/Kconfig.
--
net: mctp: Stop selecting flow support for KUnit tests
This commit removes "select MCTP_FLOWS" from MCTP_TEST in net/mctp/Kconfig. The selection also enabled SKB_EXTENSIONS, and KUnit style guidance says tests should not pull in dependencies this way. The two flow-specific tests already skip when MCTP_FLOWS is disabled.
net/mctp/Kconfig menuconfig MCTP · line 17
Quoted 9 lines
net/mctp/Kconfig +0
-1@@ -14,7 +14,6 @@ menuconfig MCTP config MCTP_TEST bool "MCTP core tests" if !KUNIT_ALL_TESTS - select MCTP_FLOWS
[Severity: Medium]
Will this break kunit.py run --alltests? tools/testing/kunit/configs/all_tests.config still asks for flow support:
tools/testing/kunit/configs/all_tests.config:
CONFIG_NET=y
CONFIG_MCTP=y
CONFIG_MCTP_FLOWS=y
Commit 109a5331143d, the one named in the Fixes: tag, added this line together with the select.
MCTP_FLOWS is a bool with no prompt and no default:
net/mctp/Kconfig:
config MCTP_FLOWS
bool
depends on MCTP
select SKB_EXTENSIONS
That means a config fragment cannot turn it on. Only a select can.
After this patch the only selector left is MCTP_TRANSPORT_I2C in drivers/net/mctp/Kconfig. That symbol depends on I2C_SLAVE, and neither one is on by default or set in all_tests.config. So after olddefconfig, MCTP_FLOWS stays unset in the generated .config.
validate_config() in tools/testing/kunit/kunit_kernel.py then calls Kconfig.is_subset_of() in kunit_config.py:
b = other._entries.get(name)
if b is None:
if value == 'n':
continue
return False
This returns False for CONFIG_MCTP_FLOWS=y. The run then stops at config time with "Not all Kconfig options selected in kunitconfig were in the generated .config", before any KUnit suite is built. That affects every suite in the all-tests run, not only the MCTP ones.
Should all_tests.config be updated in this patch as well? One option is to drop CONFIG_MCTP_FLOWS=y. In that case mctp_test_packet_flow() and mctp_test_fragment_flow() in net/mctp/test/route-test.c would always skip in the all-tests configuration.
Another option is to replace the line with CONFIG_I2C_SLAVE=y and CONFIG_MCTP_TRANSPORT_I2C=y. The flow tests would then still run. That matches the validation notes, which say the enabled configuration used the I2C transport to select MCTP_FLOWS.
Since the patch carries a Fixes: tag, a stable backport would bring this mismatch along with it.
Quoted 3 lines
net/mctp/Kconfig +0
-0depends on MCTP=y && KUNIT=y default KUNIT_ALL_TESTS
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260925192510.93840-1-kmehltretter%40gmail.com
Jakub Kicinski
maintainerQuoted 6 lines · On Fri, 25 Sep 2026 21:25:10 +0200 Karl Mehltretter wrote:
MCTP_TESTselectsMCTP_FLOWS, which also enablesSKB_EXTENSIONSwhen no transport requires them. Remove the selection to follow the dependency rule inDocumentation/dev-tools/kunit/style.rst.The two flow-specific tests already skip when
MCTP_FLOWSis disabled. The remaining tests can run in either configuration.
This patch causes the CI's "kunit-all/alltests" job to fail at the build configuration step, before any KUnit test actually runs:
ERROR:root:Not all Kconfig options selected in kunitconfig were in the generated .config. This is probably due to unsatisfied dependencies.
Missing: CONFIG_MCTP_FLOWS=y
tools/testing/kunit/configs/all_tests.config (used by this job) lists CONFIG_MCTP_FLOWS=y explicitly. However, MCTP_FLOWS in net/mctp/Kconfig has no user-visible prompt:
config MCTP_FLOWS
bool
depends on MCTP
select SKB_EXTENSIONS
so it can only be turned on by another symbol's "select". Previously MCTP_TEST selected it, which is what let all_tests.config's explicit "CONFIG_MCTP_FLOWS=y" line take effect. After this patch removes that select, nothing enables MCTP_FLOWS anymore, so olddefconfig silently drops it and the kunit tooling treats the mismatch as fatal, aborting the whole "alltests" run.
Since MCTP_FLOWS is a prompt-less symbol, simply listing it in a kunitconfig fragment isn't enough on its own - it still needs to be selected by something. Could you either:
- keep a select of MCTP_FLOWS from an appropriate config (e.g. from MCTP_TEST guarded to only the flow-specific tests, if that's expressible), or
- update tools/testing/kunit/configs/all_tests.config to select the flow tests explicitly (e.g. via a symbol that can select MCTP_FLOWS), or
- give MCTP_FLOWS a real prompt so it can be enabled directly from a config fragment.
Let me know if you'd like the exact CI log for the failure.