All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf build: Add MINIMAL=1 to build without optional features
@ 2026-10-18 13:53 Sasha Levin
  2026-10-18 13:57 ` sashiko-bot
  2026-10-21 23:17 ` Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Sasha Levin @ 2026-10-18 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Ian Rogers, Adrian Hunter, James Clark,
	linux-perf-users, linux-kernel, Sasha Levin

Turning off every optional feature takes a long list of NO_* variables,
and the list has to follow features as they are added and renamed. The
one in tests/make for make_minimal has fallen behind: it leaves
libtraceevent, jevents, slang, AIO, LZMA, zlib, libLLVM and Rust to be
detected, so a make_minimal build still needs libtraceevent and python.

Add MINIMAL=1, which turns off every optional feature, the BPF
skeletons, and the shellcheck, mypy and pylint runs. perf then builds,
natively or cross, with no library beyond the C library and without
python, pkg-config, clang or rustc, and the result does not depend on
what is installed on the build machine.

A MINIMAL=1 build also leaves out the notices that post unwind and
python support are disabled, which it asked for, and the one about the
pkg-config search path for cross builds, as pkg-config is not needed
then.

It is handled in Makefile.perf rather than Makefile.config, as
Makefile.config is included after the pkg-config, shellcheck, mypy and
pylint setup.

Use it for make_minimal in tests/make.

Suggested-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/CAP-5=fWFY-tpJz2vcBZvurwdZY5gwd8cuTemE9q1rtZ0Vi0dng@mail.gmail.com
Assisted-by: LLM
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
The kbuild series that builds perf with MINIMAL=1 carries the mainline
version of this patch:
https://lore.kernel.org/r/20261016143143.3613501-1-sashal@kernel.org

 tools/perf/Makefile.config |  8 ++++++--
 tools/perf/Makefile.perf   | 42 ++++++++++++++++++++++++++++++++++++--
 tools/perf/tests/make      |  8 +-------
 3 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index b4764f69f47f4..4af7934887539 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -753,7 +753,9 @@ dwarf-post-unwind-text := BUG
 # setup DWARF post unwinder
 ifdef NO_LIBUNWIND
   ifdef NO_LIBDW
-    $(warning Disabling post unwind, no support found.)
+    ifneq ($(MINIMAL),1)
+      $(warning Disabling post unwind, no support found.)
+    endif
     dwarf-post-unwind := 0
   else
     dwarf-post-unwind-text := libdw
@@ -828,7 +830,9 @@ endif
 
 PYTHON_EXTENSION_SUFFIX := '.so'
 ifdef NO_PYTHON_MODULE
-  $(call disable-python,Python support disabled by user)
+  ifneq ($(MINIMAL),1)
+    $(call disable-python,Python support disabled by user)
+  endif
 else
 
   ifndef PYTHON
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 2d9379fea2672..5297fc15a3c9e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -129,6 +129,9 @@ include ../scripts/utilities.mak
 # Define NO_MYPY if you do not want to run mypy during build
 #
 # Define NO_PYLINT if you do not want to run pylint during build
+#
+# Define MINIMAL=1 to build without any optional feature, needing only a C
+# compiler and library, flex and bison
 
 # As per kernel Makefile, avoid funny character set dependencies
 unexport LC_ALL
@@ -174,6 +177,39 @@ endef
 
 LD += $(EXTRA_LDFLAGS)
 
+# MINIMAL=1 is handled here rather than in Makefile.config, which is included
+# after the pkg-config, shellcheck, mypy and pylint setup below
+ifeq ($(MINIMAL),1)
+  NO_LIBELF := 1
+  NO_LIBDW := 1
+  NO_LIBTRACEEVENT := 1
+  NO_JEVENTS := 1
+  NO_PYTHON_MODULE := 1
+  NO_LIBBPF := 1
+  BUILD_BPF_SKEL := 0
+  NO_SLANG := 1
+  NO_DEMANGLE := 1
+  NO_BACKTRACE := 1
+  NO_AIO := 1
+  NO_ZLIB := 1
+  NO_LZMA := 1
+  NO_LIBZSTD := 1
+  NO_LIBNUMA := 1
+  NO_LIBLLVM := 1
+  NO_CAPSTONE := 1
+  NO_LIBPFM4 := 1
+  NO_LIBDEBUGINFOD := 1
+  NO_BABELTRACE2 := 1
+  NO_SDT := 1
+  NO_JVMTI := 1
+  NO_RUST := 1
+  NO_PERF_READ_VDSO32 := 1
+  NO_PERF_READ_VDSOX32 := 1
+  NO_SHELLCHECK := 1
+  NO_MYPY := 1
+  NO_PYLINT := 1
+endif
+
 # Some distros provide the command $(CROSS_COMPILE)pkg-config for
 # searching packges installed with Multiarch. Use it for cross
 # compilation if it is existed.
@@ -195,8 +231,10 @@ else
       PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/
       PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/
       export PKG_CONFIG_LIBDIR
-      $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,)
-      $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.)
+      ifneq ($(MINIMAL),1)
+        $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,)
+        $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.)
+      endif
     endif
   endif
 endif
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 7524de5228029..bef5599b95d6f 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -119,13 +119,7 @@ make_install_prefix       := install prefix=/tmp/krava
 make_install_prefix_slash := install prefix=/tmp/krava/
 make_static         := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 NO_LIBTRACEEVENT=1 NO_LIBELF=1
 
-# all the NO_* variable combined
-make_minimal        := NO_PYTHON_MODULE=1
-make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_BACKTRACE=1
-make_minimal        += NO_LIBNUMA=1 NO_LIBBIONIC=1 NO_LIBDW=1
-make_minimal        += NO_LIBBPF=1
-make_minimal        += NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
-make_minimal        += NO_CAPSTONE=1
+make_minimal        := MINIMAL=1
 
 # binutils 2_42 and newer have bfd_thread_init()
 new_libbfd := $(shell echo '#include <bfd.h>' | $(CC) -E -x c - | grep bfd_thread_init)

base-commit: 1c90f0a3c8a1c4e38f9edd97af9e20848805a7fb
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf build: Add MINIMAL=1 to build without optional features
  2026-10-18 13:53 [PATCH] perf build: Add MINIMAL=1 to build without optional features Sasha Levin
@ 2026-10-18 13:57 ` sashiko-bot
  2026-10-21 23:17 ` Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-10-18 13:57 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-perf-users

> Turning off every optional feature takes a long list of NO_* variables,
> and the list has to follow features as they are added and renamed. The
> one in tests/make for make_minimal has fallen behind: it leaves
> libtraceevent, jevents, slang, AIO, LZMA, zlib, libLLVM and Rust to be
> detected, so a make_minimal build still needs libtraceevent and python.
> 
> Add MINIMAL=1, which turns off every optional feature, the BPF
> skeletons, and the shellcheck, mypy and pylint runs. perf then builds,
> natively or cross, with no library beyond the C library and without
> python, pkg-config, clang or rustc, and the result does not depend on
> what is installed on the build machine.
> 
> A MINIMAL=1 build also leaves out the notices that post unwind and
> python support are disabled, which it asked for, and the one about the
> pkg-config search path for cross builds, as pkg-config is not needed
> then.
> 
> It is handled in Makefile.perf rather than Makefile.config, as
> Makefile.config is included after the pkg-config, shellcheck, mypy and
> pylint setup.
> 
> Use it for make_minimal in tests/make.
> 
> Suggested-by: Ian Rogers <irogers@google.com>
> Link: https://lore.kernel.org/r/CAP-5=fWFY-tpJz2vcBZvurwdZY5gwd8cuTemE9q1rtZ0Vi0dng@mail.gmail.com
> Assisted-by: LLM
> Signed-off-by: Sasha Levin <sashal@kernel.org>

Sashiko has reviewed this patch and found no issues.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf build: Add MINIMAL=1 to build without optional features
  2026-10-18 13:53 [PATCH] perf build: Add MINIMAL=1 to build without optional features Sasha Levin
  2026-10-18 13:57 ` sashiko-bot
@ 2026-10-21 23:17 ` Namhyung Kim
  2026-10-22  1:40   ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2026-10-21 23:17 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, James Clark, linux-perf-users, linux-kernel

On Sun, Oct 18, 2026 at 09:53:21AM -0400, Sasha Levin wrote:
> Turning off every optional feature takes a long list of NO_* variables,
> and the list has to follow features as they are added and renamed. The
> one in tests/make for make_minimal has fallen behind: it leaves
> libtraceevent, jevents, slang, AIO, LZMA, zlib, libLLVM and Rust to be
> detected, so a make_minimal build still needs libtraceevent and python.
> 
> Add MINIMAL=1, which turns off every optional feature, the BPF
> skeletons, and the shellcheck, mypy and pylint runs. perf then builds,
> natively or cross, with no library beyond the C library and without
> python, pkg-config, clang or rustc, and the result does not depend on
> what is installed on the build machine.
> 
> A MINIMAL=1 build also leaves out the notices that post unwind and
> python support are disabled, which it asked for, and the one about the
> pkg-config search path for cross builds, as pkg-config is not needed
> then.
> 
> It is handled in Makefile.perf rather than Makefile.config, as
> Makefile.config is included after the pkg-config, shellcheck, mypy and
> pylint setup.
> 
> Use it for make_minimal in tests/make.
> 
> Suggested-by: Ian Rogers <irogers@google.com>
> Link: https://lore.kernel.org/r/CAP-5=fWFY-tpJz2vcBZvurwdZY5gwd8cuTemE9q1rtZ0Vi0dng@mail.gmail.com
> Assisted-by: LLM
> Signed-off-by: Sasha Levin <sashal@kernel.org>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> ---
> The kbuild series that builds perf with MINIMAL=1 carries the mainline
> version of this patch:
> https://lore.kernel.org/r/20261016143143.3613501-1-sashal@kernel.org
> 
>  tools/perf/Makefile.config |  8 ++++++--
>  tools/perf/Makefile.perf   | 42 ++++++++++++++++++++++++++++++++++++--
>  tools/perf/tests/make      |  8 +-------
>  3 files changed, 47 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index b4764f69f47f4..4af7934887539 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -753,7 +753,9 @@ dwarf-post-unwind-text := BUG
>  # setup DWARF post unwinder
>  ifdef NO_LIBUNWIND
>    ifdef NO_LIBDW
> -    $(warning Disabling post unwind, no support found.)
> +    ifneq ($(MINIMAL),1)
> +      $(warning Disabling post unwind, no support found.)
> +    endif
>      dwarf-post-unwind := 0
>    else
>      dwarf-post-unwind-text := libdw
> @@ -828,7 +830,9 @@ endif
>  
>  PYTHON_EXTENSION_SUFFIX := '.so'
>  ifdef NO_PYTHON_MODULE
> -  $(call disable-python,Python support disabled by user)
> +  ifneq ($(MINIMAL),1)
> +    $(call disable-python,Python support disabled by user)
> +  endif
>  else
>  
>    ifndef PYTHON
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 2d9379fea2672..5297fc15a3c9e 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -129,6 +129,9 @@ include ../scripts/utilities.mak
>  # Define NO_MYPY if you do not want to run mypy during build
>  #
>  # Define NO_PYLINT if you do not want to run pylint during build
> +#
> +# Define MINIMAL=1 to build without any optional feature, needing only a C
> +# compiler and library, flex and bison
>  
>  # As per kernel Makefile, avoid funny character set dependencies
>  unexport LC_ALL
> @@ -174,6 +177,39 @@ endef
>  
>  LD += $(EXTRA_LDFLAGS)
>  
> +# MINIMAL=1 is handled here rather than in Makefile.config, which is included
> +# after the pkg-config, shellcheck, mypy and pylint setup below
> +ifeq ($(MINIMAL),1)
> +  NO_LIBELF := 1
> +  NO_LIBDW := 1
> +  NO_LIBTRACEEVENT := 1
> +  NO_JEVENTS := 1
> +  NO_PYTHON_MODULE := 1
> +  NO_LIBBPF := 1
> +  BUILD_BPF_SKEL := 0
> +  NO_SLANG := 1
> +  NO_DEMANGLE := 1
> +  NO_BACKTRACE := 1
> +  NO_AIO := 1
> +  NO_ZLIB := 1
> +  NO_LZMA := 1
> +  NO_LIBZSTD := 1
> +  NO_LIBNUMA := 1
> +  NO_LIBLLVM := 1
> +  NO_CAPSTONE := 1
> +  NO_LIBPFM4 := 1
> +  NO_LIBDEBUGINFOD := 1
> +  NO_BABELTRACE2 := 1
> +  NO_SDT := 1
> +  NO_JVMTI := 1
> +  NO_RUST := 1
> +  NO_PERF_READ_VDSO32 := 1
> +  NO_PERF_READ_VDSOX32 := 1
> +  NO_SHELLCHECK := 1
> +  NO_MYPY := 1
> +  NO_PYLINT := 1
> +endif
> +
>  # Some distros provide the command $(CROSS_COMPILE)pkg-config for
>  # searching packges installed with Multiarch. Use it for cross
>  # compilation if it is existed.
> @@ -195,8 +231,10 @@ else
>        PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/
>        PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/
>        export PKG_CONFIG_LIBDIR
> -      $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,)
> -      $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.)
> +      ifneq ($(MINIMAL),1)
> +        $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,)
> +        $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.)
> +      endif
>      endif
>    endif
>  endif
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> index 7524de5228029..bef5599b95d6f 100644
> --- a/tools/perf/tests/make
> +++ b/tools/perf/tests/make
> @@ -119,13 +119,7 @@ make_install_prefix       := install prefix=/tmp/krava
>  make_install_prefix_slash := install prefix=/tmp/krava/
>  make_static         := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 NO_LIBTRACEEVENT=1 NO_LIBELF=1
>  
> -# all the NO_* variable combined
> -make_minimal        := NO_PYTHON_MODULE=1
> -make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_BACKTRACE=1
> -make_minimal        += NO_LIBNUMA=1 NO_LIBBIONIC=1 NO_LIBDW=1
> -make_minimal        += NO_LIBBPF=1
> -make_minimal        += NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
> -make_minimal        += NO_CAPSTONE=1
> +make_minimal        := MINIMAL=1
>  
>  # binutils 2_42 and newer have bfd_thread_init()
>  new_libbfd := $(shell echo '#include <bfd.h>' | $(CC) -E -x c - | grep bfd_thread_init)
> 
> base-commit: 1c90f0a3c8a1c4e38f9edd97af9e20848805a7fb
> -- 
> 2.53.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf build: Add MINIMAL=1 to build without optional features
  2026-10-21 23:17 ` Namhyung Kim
@ 2026-10-22  1:40   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-22  1:40 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Sasha Levin, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, linux-perf-users, linux-kernel

On Wed, Oct 21, 2026 at 04:17:29PM -0700, Namhyung Kim wrote:
> On Sun, Oct 18, 2026 at 09:53:21AM -0400, Sasha Levin wrote:
> > Turning off every optional feature takes a long list of NO_* variables,
> > and the list has to follow features as they are added and renamed. The
> > one in tests/make for make_minimal has fallen behind: it leaves
> > libtraceevent, jevents, slang, AIO, LZMA, zlib, libLLVM and Rust to be
> > detected, so a make_minimal build still needs libtraceevent and python.
> > 
> > Add MINIMAL=1, which turns off every optional feature, the BPF
> > skeletons, and the shellcheck, mypy and pylint runs. perf then builds,
> > natively or cross, with no library beyond the C library and without
> > python, pkg-config, clang or rustc, and the result does not depend on
> > what is installed on the build machine.
> > 
> > A MINIMAL=1 build also leaves out the notices that post unwind and
> > python support are disabled, which it asked for, and the one about the
> > pkg-config search path for cross builds, as pkg-config is not needed
> > then.
> > 
> > It is handled in Makefile.perf rather than Makefile.config, as
> > Makefile.config is included after the pkg-config, shellcheck, mypy and
> > pylint setup.
> > 
> > Use it for make_minimal in tests/make.
> > 
> > Suggested-by: Ian Rogers <irogers@google.com>
> > Link: https://lore.kernel.org/r/CAP-5=fWFY-tpJz2vcBZvurwdZY5gwd8cuTemE9q1rtZ0Vi0dng@mail.gmail.com
> > Assisted-by: LLM
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Not tested but:

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-22  1:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 13:53 [PATCH] perf build: Add MINIMAL=1 to build without optional features Sasha Levin
2026-10-18 13:57 ` sashiko-bot
2026-10-21 23:17 ` Namhyung Kim
2026-10-22  1:40   ` Arnaldo Carvalho de Melo

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.