* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 6:04 [PATCH] kbuild: unset sub_make_done before calling kselftest build system Thomas Weißschuh
@ 2026-07-03 6:14 ` sashiko-bot
2026-07-03 8:26 ` Petr Mladek
2026-07-03 8:25 ` Petr Mladek
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: sashiko-bot @ 2026-07-03 6:14 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: live-patching, linux-kernel, linux-kselftest, Miroslav Benes,
Thomas Weißschuh, shuah, Zelin Deng, linux-kbuild,
Petr Mladek
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete fix and inconsistent state: The patch correctly unsets `sub_make_done` for the `kselftest` targets to allow Kbuild command-line reevaluation when building external kernel modules. However, it fails to apply the same logic to the `tools/` and `tools/%` targets, introducing a discrepancy between build entry points.
--
commit 06c418388d65deb3d8494a6e8e7071c0e709186b
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
kbuild: unset sub_make_done before calling kselftest build system
This commit unsets sub_make_done before invoking the kselftest build system to
ensure Kbuild reevaluates command-line flags when building test modules. It
mirrors a previous fix done for scripts/install.sh.
> diff --git a/Makefile b/Makefile
> index b9c5792c79e01..f717a4dc96d6a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1591,10 +1591,10 @@ tools/%: FORCE
>
> PHONY += kselftest
> kselftest: headers
> - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests run_tests
[Severity: Medium]
Will make tools/selftests still fail after this change?
The tools/ and tools/% targets in Makefile delegate to the tools build
system, which can also trigger external kernel module builds (like bpf_testmod).
Because sub_make_done is not unset for these targets, invoking commands like
make tools/selftests or make tools/all will skip Kbuild's M= argument parsing.
Should sub_make_done also be unset in the tools/ and tools/% targets to maintain
consistency across the build entry points?
> kselftest-%: headers FORCE
> - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
> + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests $*
>
> PHONY += kselftest-merge
> kselftest-merge:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260703-makefile-unset-submake-done-v1-1-6899248f3d6a@linutronix.de?part=1
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 6:14 ` sashiko-bot
@ 2026-07-03 8:26 ` Petr Mladek
2026-07-03 9:32 ` Thomas Weißschuh
0 siblings, 1 reply; 11+ messages in thread
From: Petr Mladek @ 2026-07-03 8:26 UTC (permalink / raw)
To: sashiko-reviews
Cc: Nathan Chancellor, Nicolas Schier, live-patching, linux-kernel,
linux-kselftest, Miroslav Benes, Thomas Weißschuh, shuah,
Zelin Deng, linux-kbuild
On Fri 2026-07-03 06:14:48, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Incomplete fix and inconsistent state: The patch correctly unsets `sub_make_done` for the `kselftest` targets to allow Kbuild command-line reevaluation when building external kernel modules. However, it fails to apply the same logic to the `tools/` and `tools/%` targets, introducing a discrepancy between build entry points.
> --
>
> commit 06c418388d65deb3d8494a6e8e7071c0e709186b
> Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
>
> kbuild: unset sub_make_done before calling kselftest build system
>
> This commit unsets sub_make_done before invoking the kselftest build system to
> ensure Kbuild reevaluates command-line flags when building test modules. It
> mirrors a previous fix done for scripts/install.sh.
>
> > diff --git a/Makefile b/Makefile
> > index b9c5792c79e01..f717a4dc96d6a 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1591,10 +1591,10 @@ tools/%: FORCE
> >
> > PHONY += kselftest
> > kselftest: headers
> > - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> > + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests run_tests
>
> [Severity: Medium]
> Will make tools/selftests still fail after this change?
>
> The tools/ and tools/% targets in Makefile delegate to the tools build
> system, which can also trigger external kernel module builds (like bpf_testmod).
>
> Because sub_make_done is not unset for these targets, invoking commands like
> make tools/selftests or make tools/all will skip Kbuild's M= argument parsing.
>
> Should sub_make_done also be unset in the tools/ and tools/% targets to maintain
> consistency across the build entry points?
This might make sense. I see that the tools: and tools/%: targets are
defined right above the kselftest*: ones. And they are even advertised
in "make help" or "make tools/help".
Well it probably should be done in a separate patch. It would be better
for bisecting potential regressions. Thomas, Zelin, what do you think, please?
Best Regards,
Petr
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 8:26 ` Petr Mladek
@ 2026-07-03 9:32 ` Thomas Weißschuh
2026-07-03 10:06 ` Petr Mladek
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Weißschuh @ 2026-07-03 9:32 UTC (permalink / raw)
To: Petr Mladek
Cc: sashiko-reviews, Nathan Chancellor, Nicolas Schier, live-patching,
linux-kernel, linux-kselftest, Miroslav Benes, shuah, Zelin Deng,
linux-kbuild
On Fri, Jul 03, 2026 at 10:26:07AM +0200, Petr Mladek wrote:
> On Fri 2026-07-03 06:14:48, sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > - [Medium] Incomplete fix and inconsistent state: The patch correctly unsets `sub_make_done` for the `kselftest` targets to allow Kbuild command-line reevaluation when building external kernel modules. However, it fails to apply the same logic to the `tools/` and `tools/%` targets, introducing a discrepancy between build entry points.
> > --
> >
> > commit 06c418388d65deb3d8494a6e8e7071c0e709186b
> > Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> >
> > kbuild: unset sub_make_done before calling kselftest build system
> >
> > This commit unsets sub_make_done before invoking the kselftest build system to
> > ensure Kbuild reevaluates command-line flags when building test modules. It
> > mirrors a previous fix done for scripts/install.sh.
> >
> > > diff --git a/Makefile b/Makefile
> > > index b9c5792c79e01..f717a4dc96d6a 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -1591,10 +1591,10 @@ tools/%: FORCE
> > >
> > > PHONY += kselftest
> > > kselftest: headers
> > > - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> > > + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> >
> > [Severity: Medium]
> > Will make tools/selftests still fail after this change?
> >
> > The tools/ and tools/% targets in Makefile delegate to the tools build
> > system, which can also trigger external kernel module builds (like bpf_testmod).
> >
> > Because sub_make_done is not unset for these targets, invoking commands like
> > make tools/selftests or make tools/all will skip Kbuild's M= argument parsing.
> >
> > Should sub_make_done also be unset in the tools/ and tools/% targets to maintain
> > consistency across the build entry points?
>
> This might make sense. I see that the tools: and tools/%: targets are
> defined right above the kselftest*: ones. And they are even advertised
> in "make help" or "make tools/help".
I am not sure how the tools/ targets can reach back into kbuild.
The example with bpf_testmod above is bogus, as tools/* is only for
top-level tools directories. Subdirectories in tools/testing/selftests/
don't seem to be reachable.
> Well it probably should be done in a separate patch. It would be better
> for bisecting potential regressions. Thomas, Zelin, what do you think, please?
If we do it for consistency it should be its own patch, agreed.
Thomas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 9:32 ` Thomas Weißschuh
@ 2026-07-03 10:06 ` Petr Mladek
2026-07-03 19:24 ` Nicolas Schier
0 siblings, 1 reply; 11+ messages in thread
From: Petr Mladek @ 2026-07-03 10:06 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: sashiko-reviews, Nathan Chancellor, Nicolas Schier, live-patching,
linux-kernel, linux-kselftest, Miroslav Benes, shuah, Zelin Deng,
linux-kbuild
On Fri 2026-07-03 11:32:30, Thomas Weißschuh wrote:
> On Fri, Jul 03, 2026 at 10:26:07AM +0200, Petr Mladek wrote:
> > On Fri 2026-07-03 06:14:48, sashiko-bot@kernel.org wrote:
> > > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > > - [Medium] Incomplete fix and inconsistent state: The patch correctly unsets `sub_make_done` for the `kselftest` targets to allow Kbuild command-line reevaluation when building external kernel modules. However, it fails to apply the same logic to the `tools/` and `tools/%` targets, introducing a discrepancy between build entry points.
> > > --
> > >
> > > commit 06c418388d65deb3d8494a6e8e7071c0e709186b
> > > Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > >
> > > kbuild: unset sub_make_done before calling kselftest build system
> > >
> > > This commit unsets sub_make_done before invoking the kselftest build system to
> > > ensure Kbuild reevaluates command-line flags when building test modules. It
> > > mirrors a previous fix done for scripts/install.sh.
> > >
> > > > diff --git a/Makefile b/Makefile
> > > > index b9c5792c79e01..f717a4dc96d6a 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -1591,10 +1591,10 @@ tools/%: FORCE
> > > >
> > > > PHONY += kselftest
> > > > kselftest: headers
> > > > - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> > > > + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> > >
> > > [Severity: Medium]
> > > Will make tools/selftests still fail after this change?
> > >
> > > The tools/ and tools/% targets in Makefile delegate to the tools build
> > > system, which can also trigger external kernel module builds (like bpf_testmod).
> > >
> > > Because sub_make_done is not unset for these targets, invoking commands like
> > > make tools/selftests or make tools/all will skip Kbuild's M= argument parsing.
> > >
> > > Should sub_make_done also be unset in the tools/ and tools/% targets to maintain
> > > consistency across the build entry points?
> >
> > This might make sense. I see that the tools: and tools/%: targets are
> > defined right above the kselftest*: ones. And they are even advertised
> > in "make help" or "make tools/help".
>
> I am not sure how the tools/ targets can reach back into kbuild.
> The example with bpf_testmod above is bogus, as tools/* is only for
> top-level tools directories. Subdirectories in tools/testing/selftests/
> don't seem to be reachable.
I see.
> > Well it probably should be done in a separate patch. It would be better
> > for bisecting potential regressions. Thomas, Zelin, what do you think, please?
>
> If we do it for consistency it should be its own patch, agreed.
I would keep it as is until anyone reports a real problem.
Thanks a lot for explanation.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 10:06 ` Petr Mladek
@ 2026-07-03 19:24 ` Nicolas Schier
0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Schier @ 2026-07-03 19:24 UTC (permalink / raw)
To: Petr Mladek
Cc: Thomas Weißschuh, sashiko-reviews, Nathan Chancellor,
live-patching, linux-kernel, linux-kselftest, Miroslav Benes,
shuah, Zelin Deng, linux-kbuild
On Fri, Jul 03, 2026 at 12:06:46PM +0200, Petr Mladek wrote:
> On Fri 2026-07-03 11:32:30, Thomas Weißschuh wrote:
> > On Fri, Jul 03, 2026 at 10:26:07AM +0200, Petr Mladek wrote:
> > > On Fri 2026-07-03 06:14:48, sashiko-bot@kernel.org wrote:
> > > > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > > > - [Medium] Incomplete fix and inconsistent state: The patch correctly unsets `sub_make_done` for the `kselftest` targets to allow Kbuild command-line reevaluation when building external kernel modules. However, it fails to apply the same logic to the `tools/` and `tools/%` targets, introducing a discrepancy between build entry points.
> > > > --
> > > >
> > > > commit 06c418388d65deb3d8494a6e8e7071c0e709186b
> > > > Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > > >
> > > > kbuild: unset sub_make_done before calling kselftest build system
> > > >
> > > > This commit unsets sub_make_done before invoking the kselftest build system to
> > > > ensure Kbuild reevaluates command-line flags when building test modules. It
> > > > mirrors a previous fix done for scripts/install.sh.
> > > >
> > > > > diff --git a/Makefile b/Makefile
> > > > > index b9c5792c79e01..f717a4dc96d6a 100644
> > > > > --- a/Makefile
> > > > > +++ b/Makefile
> > > > > @@ -1591,10 +1591,10 @@ tools/%: FORCE
> > > > >
> > > > > PHONY += kselftest
> > > > > kselftest: headers
> > > > > - $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> > > > > + $(Q)unset sub_make_done; $(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> > > >
> > > > [Severity: Medium]
> > > > Will make tools/selftests still fail after this change?
> > > >
> > > > The tools/ and tools/% targets in Makefile delegate to the tools build
> > > > system, which can also trigger external kernel module builds (like bpf_testmod).
> > > >
> > > > Because sub_make_done is not unset for these targets, invoking commands like
> > > > make tools/selftests or make tools/all will skip Kbuild's M= argument parsing.
> > > >
> > > > Should sub_make_done also be unset in the tools/ and tools/% targets to maintain
> > > > consistency across the build entry points?
> > >
> > > This might make sense. I see that the tools: and tools/%: targets are
> > > defined right above the kselftest*: ones. And they are even advertised
> > > in "make help" or "make tools/help".
> >
> > I am not sure how the tools/ targets can reach back into kbuild.
> > The example with bpf_testmod above is bogus, as tools/* is only for
> > top-level tools directories. Subdirectories in tools/testing/selftests/
> > don't seem to be reachable.
>
> I see.
>
> > > Well it probably should be done in a separate patch. It would be better
> > > for bisecting potential regressions. Thomas, Zelin, what do you think, please?
> >
> > If we do it for consistency it should be its own patch, agreed.
>
> I would keep it as is until anyone reports a real problem.
Ack.
Thomas, thanks for fix!
Reviewed-by: Nicolas Schier <nsc@kernel.org>
--
Nicolas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 6:04 [PATCH] kbuild: unset sub_make_done before calling kselftest build system Thomas Weißschuh
2026-07-03 6:14 ` sashiko-bot
@ 2026-07-03 8:25 ` Petr Mladek
2026-07-03 19:25 ` Nicolas Schier
2026-07-04 1:59 ` Zelin Deng
2026-07-03 8:39 ` Miroslav Benes
2026-07-07 12:09 ` Petr Mladek
3 siblings, 2 replies; 11+ messages in thread
From: Petr Mladek @ 2026-07-03 8:25 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
Miroslav Benes, live-patching, shuah, linux-kselftest, Zelin Deng
On Fri 2026-07-03 08:04:08, Thomas Weißschuh wrote:
> The kselftest build system may recourse back into kbuild when building
> test modules. In that case kbuild needs to parse the new flags passed
> from the command line, instead of using the ones inherited from the
> kbuild invocation.
>
> Force that command line reevaluation.
>
> The same was done for scripts/install.sh in commit 14ccc638b02f9ec
> ("kbuild: cancel sub_make_done for the install target to fix DKMS")
>
> Reported-by: Zelin Deng <zelin.deng@linux.alibaba.com>
> Closes: https://lore.kernel.org/all/20260525083721.27857-1-zelin.deng@linux.alibaba.com/
It is great that you added references to the related commit and
the original thread.
> Fixes: c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
I believe that this is reasonable solution:
Acked-by: Petr Mladek <pmladek@suse.com>
Zelin, could you please provide your Tested-by, please?
Best Regards,
Petr
PS: I could take this via livepatching tree. But feel free to take it
via kbuild tree. I am going to wait few days until the discussion
settles down.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 8:25 ` Petr Mladek
@ 2026-07-03 19:25 ` Nicolas Schier
2026-07-04 1:59 ` Zelin Deng
1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Schier @ 2026-07-03 19:25 UTC (permalink / raw)
To: Petr Mladek
Cc: Thomas Weißschuh, Nathan Chancellor, linux-kbuild,
linux-kernel, Miroslav Benes, live-patching, shuah,
linux-kselftest, Zelin Deng
On Fri, Jul 03, 2026 at 10:25:15AM +0200, Petr Mladek wrote:
[...]
>
> PS: I could take this via livepatching tree. But feel free to take it
> via kbuild tree. I am going to wait few days until the discussion
> settles down.
Yes, take it via livepatching tree, thanks!
Kind regards,
Nicolas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 8:25 ` Petr Mladek
2026-07-03 19:25 ` Nicolas Schier
@ 2026-07-04 1:59 ` Zelin Deng
1 sibling, 0 replies; 11+ messages in thread
From: Zelin Deng @ 2026-07-04 1:59 UTC (permalink / raw)
To: Petr Mladek
Cc: Thomas Weißschuh, Nathan Chancellor, Nicolas Schier,
linux-kbuild, linux-kernel, Miroslav Benes, live-patching, shuah,
linux-kselftest
On Fri, Jul 03, 2026 at 10:25:15AM +0200, Petr Mladek wrote:
> On Fri 2026-07-03 08:04:08, Thomas Weißschuh wrote:
> > The kselftest build system may recourse back into kbuild when building
> > test modules. In that case kbuild needs to parse the new flags passed
> > from the command line, instead of using the ones inherited from the
> > kbuild invocation.
> >
> > Force that command line reevaluation.
> >
> > The same was done for scripts/install.sh in commit 14ccc638b02f9ec
> > ("kbuild: cancel sub_make_done for the install target to fix DKMS")
> >
> > Reported-by: Zelin Deng <zelin.deng@linux.alibaba.com>
> > Closes: https://lore.kernel.org/all/20260525083721.27857-1-zelin.deng@linux.alibaba.com/
>
> It is great that you added references to the related commit and
> the original thread.
>
> > Fixes: c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
>
> I believe that this is reasonable solution:
>
> Acked-by: Petr Mladek <pmladek@suse.com>
>
> Zelin, could you please provide your Tested-by, please?
Sorry for late response, I just started a vacation.
Sure I had verified, and
Tested-by: Zelin Deng <zelin.deng@linux.alibaba.com>
>
> Best Regards,
> Petr
>
> PS: I could take this via livepatching tree. But feel free to take it
> via kbuild tree. I am going to wait few days until the discussion
> settles down.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 6:04 [PATCH] kbuild: unset sub_make_done before calling kselftest build system Thomas Weißschuh
2026-07-03 6:14 ` sashiko-bot
2026-07-03 8:25 ` Petr Mladek
@ 2026-07-03 8:39 ` Miroslav Benes
2026-07-07 12:09 ` Petr Mladek
3 siblings, 0 replies; 11+ messages in thread
From: Miroslav Benes @ 2026-07-03 8:39 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
Miroslav Benes, Petr Mladek, live-patching, shuah,
linux-kselftest, Zelin Deng
On Fri, 03 Jul 2026 08:04:08 +0200, Thomas Weißschuh <thomas.weissschuh@linutronix.de> wrote:
> kbuild: unset sub_make_done before calling kselftest build system
Acked-by: Miroslav Benes <mbenes@suse.cz>
--
Miroslav
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: unset sub_make_done before calling kselftest build system
2026-07-03 6:04 [PATCH] kbuild: unset sub_make_done before calling kselftest build system Thomas Weißschuh
` (2 preceding siblings ...)
2026-07-03 8:39 ` Miroslav Benes
@ 2026-07-07 12:09 ` Petr Mladek
3 siblings, 0 replies; 11+ messages in thread
From: Petr Mladek @ 2026-07-07 12:09 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
Miroslav Benes, live-patching, shuah, linux-kselftest, Zelin Deng
On Fri 2026-07-03 08:04:08, Thomas Weißschuh wrote:
> The kselftest build system may recourse back into kbuild when building
> test modules. In that case kbuild needs to parse the new flags passed
> from the command line, instead of using the ones inherited from the
> kbuild invocation.
>
> Force that command line reevaluation.
>
> The same was done for scripts/install.sh in commit 14ccc638b02f9ec
> ("kbuild: cancel sub_make_done for the install target to fix DKMS")
>
> Reported-by: Zelin Deng <zelin.deng@linux.alibaba.com>
> Closes: https://lore.kernel.org/all/20260525083721.27857-1-zelin.deng@linux.alibaba.com/
> Fixes: c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
JFYI, the patch has been committed into livepatching.git,
branch for-7.3/trivial.
The problem does not look serious enough to deserve rushing into
an 7.2-rcX. Also it is touching the global Makefile so it should
spent some time in linux-next. Let me know if you would prefer
to get it faster into the mainline.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 11+ messages in thread