Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sasha Levin" <sashal@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	linux-kbuild@vger.kernel.org
Cc: "Shuah Khan" <shuah@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Jiri Olsa" <jolsa@kernel.org>, "Ian Rogers" <irogers@google.com>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"James Clark" <james.clark@linaro.org>,
	linux-perf-users@vger.kernel.org,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Thorsten Leemhuis" <linux@leemhuis.info>,
	"Shuah Khan" <skhan@linuxfoundation.org>
Subject: Re: [PATCH v3 5/7] tools: build kernel selftests in tools_build
Date: Tue, 03 Nov 2026 02:13:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-194453@kernel.org> (raw)
In-Reply-To: <20261102021253.2545235-6-sashal@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tools: missing shared Makefile dependencies in selftest-shared rule
--

commit 730c01fcefa10c1ac883951ece76358d414b16b5
Author: Sasha Levin <sashal@kernel.org>

tools: build kernel selftests in tools_build

This commit adds a Kconfig sub-menu and Makefile rules to build selected
kernel selftests in parallel as part of tools_build, tracking shared headers
and makefiles to trigger clean rebuilds when dependencies change.

> diff --git a/tools/Makefile.kbuild b/tools/Makefile.kbuild
> index 4b3ea73bc8ab9..590440121c8c9 100644
> --- a/tools/Makefile.kbuild
> +++ b/tools/Makefile.kbuild

[ ... ]

> @@ -89,6 +90,119 @@ PHONY += perf

[ ... ]

> +$(selftest-shared): FORCE
> +	$(Q)mkdir -p $(@D); \
> +	newest=$$(find $(CURDIR)/usr/include $(toolsdir)/include $(toolsdir)/arch $(toolsdir)/testing/selftests \
> +		-type f \( -name '*.h' -o -name '*.mk' -o -name Makefile \) -printf '%T@\n' | \
> +		sort -n | tail -n 1); \
> +	touch -d "@$${newest:-0}" $@

[Severity: Medium]
As reported by Sashiko on RFC v2 [1], in tools/Makefile.kbuild, the
$(selftest-shared) rule searches $(CURDIR)/usr/include, $(toolsdir)/include,
$(toolsdir)/arch, and $(toolsdir)/testing/selftests for files matching *.h,
*.mk, or Makefile.

Several selftests enabled by this patch include shared makefile fragments
outside those paths and filename patterns:

- tools/testing/selftests/kexec/Makefile and
  tools/testing/selftests/vDSO/Makefile include
  ../../../scripts/Makefile.arch (i.e. $(toolsdir)/scripts/Makefile.arch).

- tools/testing/selftests/rseq/Makefile,
  tools/testing/selftests/thermal/intel/power_floor/Makefile, and
  tools/testing/selftests/thermal/intel/workload_hint/Makefile include
  $(top_srcdir)/scripts/subarch.include (i.e.
  $(abs_srctree)/scripts/subarch.include).

Since neither file is covered by the find command in $(selftest-shared) or
listed in $(selftest-extra-$*), and lib.mk does not list Makefiles as
prerequisites of built test binaries, won't modifying
tools/scripts/Makefile.arch or scripts/subarch.include fail to update
$(selftest-shared) and leave stale selftest build artifacts during incremental
builds?

[1] https://lore.kernel.org/r/sashiko-outbox-175556@kernel.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261102021253.2545235-1-sashal@kernel.org?part=5

  reply	other threads:[~2026-11-03  2:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  2:12 [PATCH v3 0/7] kbuild: build the userspace tools in tools/ with the kernel Sasha Levin
2026-11-02  2:12 ` [PATCH v3 1/7] kbuild: factor the userspace ABI flags out into KBUILD_USERABI Sasha Levin
2026-11-02  2:12 ` [PATCH v3 2/7] kbuild: add "make tools_build" to build userspace tools from tools/ Sasha Levin
2026-11-03  2:13   ` sashiko-bot
2026-11-02  2:12 ` [PATCH v3 3/7] perf build: Add MINIMAL=1 to build without optional features Sasha Levin
2026-11-02  2:12 ` [PATCH v3 4/7] tools: build perf in tools_build Sasha Levin
2026-11-02  2:12 ` [PATCH v3 5/7] tools: build kernel selftests " Sasha Levin
2026-11-03  2:13   ` sashiko-bot [this message]
2026-11-02  2:12 ` [PATCH v3 6/7] kbuild: build the tools selected in tools/Kconfig as part of "make all" Sasha Levin
2026-11-03  2:13   ` sashiko-bot
2026-11-02  2:12 ` [PATCH v3 7/7] Documentation: describe building tools with the kernel Sasha Levin
2026-11-04 20:10 ` [PATCH v3 0/7] kbuild: build the userspace tools in tools/ " Arnaldo Carvalho de Melo

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=sashiko-outbox-194453@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux@leemhuis.info \
    --cc=linux@weissschuh.net \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sashal@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox