Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] perf build: Respect V=1 for Python extension builds
@ 2026-06-08 15:15 Jens Remus
  2026-06-08 15:28 ` sashiko-bot
  2026-06-08 15:32 ` Ian Rogers
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Remus @ 2026-06-08 15:15 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, linux-perf-users,
	linux-kernel
  Cc: Jens Remus, Jan Polensky, Thomas Richter, Heiko Carstens

Make util/setup.py respect the verbose build flag (V=1) by conditionally
passing --quiet only when not in verbose mode.

This eases debugging of Python extension compilation issues and aligns
with the existing perf build system behavior.

Tested-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---

Notes (jremus):
    This patch applies on top of tip:perf/core:
    
      git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git  perf/core

 tools/perf/Makefile.perf | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index cee19c923c06..c5a338ada6f1 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -402,6 +402,10 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 
 python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
 
+ifneq ($(quiet),)
+setup_quiet=--quiet
+endif
+
 # Use the detected configuration
 -include $(OUTPUT).config-detected
 
@@ -747,7 +751,7 @@ $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py $(PE
 	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \
 	  $(PYTHON_WORD) util/setup.py \
-	  --quiet build_ext; \
+	  $(setup_quiet) build_ext; \
 	cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
 
 python_perf_target:
@@ -1152,7 +1156,7 @@ install-bin: install-tools install-tests
 install: install-bin try-install-man
 
 install-python_ext:
-	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
+	$(PYTHON_WORD) util/setup.py $(setup_quiet) install --root='/$(DESTDIR_SQ)'
 
 # 'make install-doc' should call 'make -C Documentation install'
 $(INSTALL_DOC_TARGETS):
-- 
2.53.0


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

* Re: [PATCH] perf build: Respect V=1 for Python extension builds
  2026-06-08 15:15 [PATCH] perf build: Respect V=1 for Python extension builds Jens Remus
@ 2026-06-08 15:28 ` sashiko-bot
  2026-06-08 15:32 ` Ian Rogers
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-06-08 15:28 UTC (permalink / raw)
  To: Jens Remus; +Cc: linux-perf-users

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `setup_quiet` variable is not initialized before its conditional assignment, allowing it to inherit arbitrary values from the user's environment when `V=1` is used.
--

commit 8926935922228db2605e3a9cb12821c9b36a4337
Author: Jens Remus <jremus@linux.ibm.com>

perf build: Respect V=1 for Python extension builds

This commit modifies the perf build system to conditionally pass the --quiet
flag to setup.py. It aims to respect the V=1 verbose build flag to ease
debugging of Python extension compilation issues.

> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 76b35ac19acbf..5fd6044680df5 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -401,6 +401,10 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
>  
>  python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
>  
> +ifneq ($(quiet),)
> +setup_quiet=--quiet
> +endif
> +

[Severity: Low]
Does this leave setup_quiet uninitialized when V=1 is used?

Because make imports environment variables automatically, if a user happens
to have an environment variable named setup_quiet, it could be unintentionally
passed directly to util/setup.py when the quiet variable evaluates to empty.

Would it be safer to explicitly initialize setup_quiet to an empty string
before the conditional block to prevent environment variable contamination?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260608151525.2358438-1-jremus@linux.ibm.com?part=1

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

* Re: [PATCH] perf build: Respect V=1 for Python extension builds
  2026-06-08 15:15 [PATCH] perf build: Respect V=1 for Python extension builds Jens Remus
  2026-06-08 15:28 ` sashiko-bot
@ 2026-06-08 15:32 ` Ian Rogers
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2026-06-08 15:32 UTC (permalink / raw)
  To: Jens Remus
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter, James Clark, linux-perf-users, linux-kernel,
	Jan Polensky, Thomas Richter, Heiko Carstens

On Mon, Jun 8, 2026 at 8:15 AM Jens Remus <jremus@linux.ibm.com> wrote:
>
> Make util/setup.py respect the verbose build flag (V=1) by conditionally
> passing --quiet only when not in verbose mode.
>
> This eases debugging of Python extension compilation issues and aligns
> with the existing perf build system behavior.
>
> Tested-by: Jan Polensky <japo@linux.ibm.com>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
>
> Notes (jremus):
>     This patch applies on top of tip:perf/core:
>
>       git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git  perf/core

This is a useful change! I suspect it will need rebasing on the
perf-tools-next tree to come in that way:
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/

>  tools/perf/Makefile.perf | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index cee19c923c06..c5a338ada6f1 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -402,6 +402,10 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
>
>  python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
>
> +ifneq ($(quiet),)
> +setup_quiet=--quiet

nit: could this variable be python_setup_quiet to add a little more
intent to the name?

Thanks,
Ian

> +endif
> +
>  # Use the detected configuration
>  -include $(OUTPUT).config-detected
>
> @@ -747,7 +751,7 @@ $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py $(PE
>         $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
>          CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \
>           $(PYTHON_WORD) util/setup.py \
> -         --quiet build_ext; \
> +         $(setup_quiet) build_ext; \
>         cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
>
>  python_perf_target:
> @@ -1152,7 +1156,7 @@ install-bin: install-tools install-tests
>  install: install-bin try-install-man
>
>  install-python_ext:
> -       $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
> +       $(PYTHON_WORD) util/setup.py $(setup_quiet) install --root='/$(DESTDIR_SQ)'
>
>  # 'make install-doc' should call 'make -C Documentation install'
>  $(INSTALL_DOC_TARGETS):
> --
> 2.53.0
>

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

end of thread, other threads:[~2026-06-08 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08 15:15 [PATCH] perf build: Respect V=1 for Python extension builds Jens Remus
2026-06-08 15:28 ` sashiko-bot
2026-06-08 15:32 ` Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox