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>
Subject: Re: [PATCH v4 4/7] tools: build perf in tools_build
Date: Fri, 13 Nov 2026 19:55:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-213586@kernel.org> (raw)
In-Reply-To: <20261112195427.3411746-5-sashal@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] tools: missing python-config and Python 3.9 check in
TOOLS_BUILD_PERF_LIBS
- [Medium] tools: TOOLS_BUILD_PERF_LIBS probe mismatches tools/perf
pkg-config and link checks
--
commit c19562a2a39be79f326367f65fd8b1eb86f840c4
Author: Sasha Levin <sashal@kernel.org>
tools: build perf in tools_build
This commit adds CONFIG_TOOLS_BUILD_PERF and CONFIG_TOOLS_BUILD_PERF_MINIMAL
to build tools/perf as part of tools_build.
> diff --git a/tools/Kconfig b/tools/Kconfig
> index 04896e6b0ca51..ab1e15beb9fe3 100644
> --- a/tools/Kconfig
> +++ b/tools/Kconfig
> @@ -60,6 +60,30 @@ config TOOLS_BUILD_IIO
> help
> Build tools/iio (lsiio, iio_event_monitor, iio_generic_buffer).
>
> +config TOOLS_BUILD_PERF
> + bool "perf"
> + help
> + Build tools/perf. As in a standalone perf build, optional
> + features are enabled when the libraries they need are installed.
> +
> +# What perf does not build without, unless it is built with MINIMAL=1
> +config TOOLS_BUILD_PERF_LIBS
> + def_bool $(success,command -v $(CROSS_COMPILE)pkg-config || command -v pkg-config) && \
> + $(success,echo 'int main(void) { return 0; }' | $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag) `$(CROSS_COMPILE)pkg-config --cflags --libs libtraceevent 2>/dev/null || pkg-config --cflags --libs libtraceevent` -include libelf.h -include trace-seq.h -x c - -o /dev/null -lelf)
[Severity: Medium]
Can TOOLS_BUILD_PERF_LIBS evaluate to y when tools/perf feature detection for
libtraceevent or libelf will fail?
During a cross-build where $(CROSS_COMPILE)pkg-config is installed on the host
but target libtraceevent.pc is missing, $(CROSS_COMPILE)pkg-config fails and
the || fallback runs the host pkg-config, returning host flags, whereas
tools/perf/Makefile.perf uses $(CROSS_COMPILE)pkg-config exclusively when
present. Conversely, when $(CROSS_COMPILE)pkg-config is absent,
tools/perf/Makefile.perf exports PKG_CONFIG_LIBDIR for the target multiarch
directories, while the Kconfig check runs host pkg-config with no
PKG_CONFIG_LIBDIR set.
In addition, because pkg-config runs inside backticks without an explicit
-ltraceevent on the compiler command line, a failing pkg-config expands to an
empty string and still succeeds if trace-seq.h is in the include path.
Passing --libs before -x c - and compiling an empty main() without calling
symbols such as elf_begin() or trace_seq_init() also succeeds with static
archives even when transitive dependencies required by tools/build/feature/
checks are missing.
> +
> +config TOOLS_BUILD_PERF_MINIMAL
> + bool "Build perf with all optional features disabled" if TOOLS_BUILD_PERF_LIBS && !COMPILE_TEST
> + depends on TOOLS_BUILD_PERF
> + default !TOOLS_BUILD_PERF_LIBS || COMPILE_TEST
[Severity: Medium]
Does building perf with CONFIG_TOOLS_BUILD_PERF_MINIMAL=n fail when
python3-config is missing or Python is older than 3.9?
Without MINIMAL=1 (which sets NO_JEVENTS=1), x86_64 and arm64 perf builds
enable jevents generation:
tools/perf/Makefile.config:
...
override PYTHON_CONFIG := $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO))
override PYTHON := $(call get-executable-or-default,PYTHON,$(subst -config,,$(PYTHON_CONFIG)))
...
ifneq ($(NO_JEVENTS),1)
NO_JEVENTS := 0
ifndef PYTHON
$(error ERROR: No python interpreter needed for jevents generation. Install python or build with NO_JEVENTS=1.)
else
ifneq ($(PYTHON_39_GOOD), 1)
$(error ERROR: Python interpreter needed for jevents generation too old (older than 3.9). Install a newer python or build with NO_JEVENTS=1.)
endif
endif
endif
Because Makefile.config derives PYTHON from PYTHON_CONFIG (python3-config or
python-config, typically packaged in python3-dev / python3-devel rather than
the base python3 package) and TOOLS_BUILD_PERF_LIBS does not check for it or
Python >= 3.9, TOOLS_BUILD_PERF_MINIMAL defaults to n and the perf build
aborts when pkg-config, libelf, and libtraceevent are installed without
python3-config.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112195427.3411746-1-sashal@kernel.org?part=4
next prev parent reply other threads:[~2026-11-13 19:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 19:54 [PATCH v4 0/7] kbuild: build the userspace tools in tools/ with the kernel Sasha Levin
2026-11-12 19:54 ` [PATCH v4 1/7] kbuild: factor the userspace ABI flags out into KBUILD_USERABI Sasha Levin
2026-11-13 19:55 ` sashiko-bot
2026-11-12 19:54 ` [PATCH v4 2/7] kbuild: add "make tools_build" to build userspace tools from tools/ Sasha Levin
2026-11-13 19:55 ` sashiko-bot
2026-11-12 19:54 ` [PATCH v4 3/7] perf build: Add MINIMAL=1 to build without optional features Sasha Levin
2026-11-13 19:55 ` sashiko-bot
2026-11-12 19:54 ` [PATCH v4 4/7] tools: build perf in tools_build Sasha Levin
2026-11-13 19:55 ` sashiko-bot [this message]
2026-11-12 19:54 ` [PATCH v4 5/7] tools: build kernel selftests " Sasha Levin
2026-11-13 19:55 ` sashiko-bot
2026-11-12 19:54 ` [PATCH v4 6/7] kbuild: build the tools selected in tools/Kconfig as part of "make all" Sasha Levin
2026-11-13 19:55 ` sashiko-bot
2026-11-12 19:54 ` [PATCH v4 7/7] Documentation: describe building tools with the kernel Sasha Levin
2026-11-13 19:55 ` sashiko-bot
2026-11-12 20:23 ` [PATCH v4 0/7] kbuild: build the userspace tools in tools/ " Andrew Morton
2026-11-13 1:52 ` Sasha Levin
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-213586@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 \
/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.