All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: "Thomas Weißschuh" <thomas@t-8ch.de>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	linux-kbuild@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 4/6] tools: build kernel selftests in tools_build
Date: Thu, 15 Oct 2026 22:45:16 -0400	[thread overview]
Message-ID: <atGPvKj_8pq2VPzh@laps> (raw)
In-Reply-To: <8ee33f00-bd8f-4cf2-90c4-2961f443af60@t-8ch.de>

On Tue, Oct 13, 2026 at 10:41:00PM +0200, Thomas Weißschuh wrote:
>On 2026-10-11 19:36:43-0400, Sasha Levin wrote:
>> Add a "Kernel selftests" sub-menu with one entry per selftests directory
>> that builds with only a C library and does not write into the source
>> tree. Each is built as "make kselftest-all" builds it, with KHDR_INCLUDES
>> pointing at the UAPI headers installed in the object tree, but by its own
>> make, so the selected ones build in parallel. Selftests whose Makefile
>> does not use KHDR_INCLUDES still build against the C library's copy of
>> the UAPI headers.
>>
>> The selftests do not track header dependencies, so a selftest is built
>> again from scratch when its own directory, a header or makefile any
>> selftest may share, or a kernel source it includes directly (the vDSO
>> test includes the architecture's vDSO code) is newer than its last
>> build.
>>
>> Selftests that need libraries beyond the C library, a vmlinux with BTF,
>> or a sanitizer runtime are left out for now.
>>
>> Assisted-by: LLM
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>>  tools/Kconfig         | 239 ++++++++++++++++++++++++++++++++++++++++++
>>  tools/Makefile.kbuild | 100 ++++++++++++++++++
>>  2 files changed, 339 insertions(+)
>
>(...)
>
>> diff --git a/tools/Makefile.kbuild b/tools/Makefile.kbuild
>> index 62fd494253eca..c31347258d0a9 100644
>> --- a/tools/Makefile.kbuild
>> +++ b/tools/Makefile.kbuild
>> @@ -92,6 +92,106 @@ PHONY += perf
>>  perf: FORCE
>>  	$(call build,$(outdir)/perf,-C $(toolsdir)/perf -f Makefile.perf O=$(outdir)/perf $(perf-flags) $(perf-flags-y),,TOOLS_BUILD_PERF)
>
>(...)
>
>> +# Unlike tools/build, the selftests do not track header dependencies. A
>> +# selftest is built again from scratch when its own directory, a header or
>> +# makefile any selftest may share, or a kernel source it includes directly
>> +# is newer than its last build.
>> +selftest-shared := $(outdir)/selftests/.shared
>> +selftest-extra-vDSO := $(abs_srctree)/arch/$(SRCARCH)
>
>Can we not fix the selftests to properly track header dependencies?
>That has been an annoyance of mine for quite some time.
>It would also get rid of a whole bunch of hackery here.

Ugh... I suppose? The current check is also incomplete: it misses headers
outside the paths it watches, such as include/linux/annotate.h, which the vDSO
test pulls in, or tools/arch/x86/include/uapi, used by ir and proc.

I'll see if I can fix it up... 

-- 
Thanks,
Sasha

  reply	other threads:[~2026-10-16  2:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 23:36 [RFC PATCH 0/6] kbuild: build the userspace tools in tools/ with the kernel Sasha Levin
2026-10-11 23:36 ` [RFC PATCH 1/6] kbuild: factor the userspace ABI flags out into KBUILD_USERABI Sasha Levin
2026-10-11 23:39   ` sashiko-bot
2026-10-13 20:31   ` Thomas Weißschuh
2026-10-11 23:36 ` [RFC PATCH 2/6] kbuild: add "make tools_build" to build userspace tools from tools/ Sasha Levin
2026-10-11 23:45   ` sashiko-bot
2026-10-13 20:38   ` Thomas Weißschuh
2026-10-15 18:52     ` Sasha Levin
2026-10-11 23:36 ` [RFC PATCH 3/6] tools: build perf in tools_build Sasha Levin
2026-10-11 23:43   ` sashiko-bot
2026-10-12 22:07   ` Ian Rogers
2026-10-13 17:08     ` Sasha Levin
2026-10-13 20:21       ` Arnaldo Carvalho de Melo
2026-10-15 19:26         ` Sasha Levin
2026-10-15 21:26           ` Ian Rogers
2026-10-15 22:35           ` Arnaldo Melo
2026-10-11 23:36 ` [RFC PATCH 4/6] tools: build kernel selftests " Sasha Levin
2026-10-11 23:46   ` sashiko-bot
2026-10-13 19:29   ` Shuah Khan
2026-10-16  2:46     ` Sasha Levin
2026-10-13 20:41   ` Thomas Weißschuh
2026-10-16  2:45     ` Sasha Levin [this message]
2026-10-11 23:36 ` [RFC PATCH 5/6] kbuild: build the tools selected in tools/Kconfig as part of "make all" Sasha Levin
2026-10-11 23:44   ` sashiko-bot
2026-10-11 23:36 ` [RFC PATCH 6/6] Documentation: describe building tools with the kernel Sasha Levin
2026-10-11 23:39   ` sashiko-bot

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=atGPvKj_8pq2VPzh@laps \
    --to=sashal@kernel.org \
    --cc=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=shuah@kernel.org \
    --cc=thomas@t-8ch.de \
    /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.