perf build: Linter parallelism and clean/install dependency fixes
Ian Rogers
reviewercover perf build: Linter parallelism and clean/install dependency fixes
This series includes a small Python test cleanup alongside build system improvements for linter parallelism and clean/install target dependencies:
1. Update tools/perf/tests/shell/lib/attr.py to use argparse instead of the deprecated optparse module, avoiding a pylint deprecated-module warning.
2. Building on Leo Yan's recent change to run pylint checks on standalone scripts and tests in parallel with linking perf, move the remaining shellcheck, mypy, and pylint rules (in tools/perf/Build, tools/perf/tests/Build, tools/perf/util/Build, and tools/perf/pmu-events/Build) into top-level phony targets in Makefile.perf so they no longer serialize archive creation, jevents generation, or final linking, nor wait on $(LANG_BINDINGS).
3. Clear GTK4 via 'override GTK4 :=' in Makefile.config when the gtk4 feature check fails instead of setting the unused 'NO_GTK4 := 1' variable left over from commit 4751bddd3f98 ("perf tools: Make GTK2 support opt-in").
4. Fix missing dependencies and target ordering for clean and install targets across Makefile, Makefile.perf, and Documentation/build-docdep.perl.
Ian Rogers (4):
perf test: Update attr.py to use argparse
perf build: Run shellcheck, mypy, and remaining pylint checks in
parallel
perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is
missing
perf build: Fix clean and install target dependencies
tools/perf/Build | 8 ++- tools/perf/Documentation/build-docdep.perl | 2 +- tools/perf/Makefile | 9 ++- tools/perf/Makefile.config | 2 +- tools/perf/Makefile.perf | 75 ++++++++++++++++++---- tools/perf/pmu-events/Build | 66 ++++++++++--------- tools/perf/tests/Build | 8 ++- tools/perf/tests/shell/lib/attr.py | 37 ++++------- tools/perf/util/Build | 8 ++- 9 files changed, 138 insertions(+), 77 deletions(-)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
Ian Rogers
reviewerPATCH 1/4 perf test: Update attr.py to use argparse
optparse is deprecated since Python 3.2 and triggers a pylint deprecated-module warning on newer versions of pylint. Replace optparse.OptionParser in tools/perf/tests/shell/lib/attr.py with argparse.ArgumentParser.
--- tools/perf/tests/shell/lib/attr.py | 37 +++++++++++------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
tools/perf/tests/shell/lib/attr.py +14 -23
@@ -4,7 +4,7 @@ import configparser import os import sys import glob -import optparse +import argparse import platform import tempfile import logging
@@ -426,29 +426,20 @@ def setup_log(verbose): ch.setFormatter(formatter) log.addHandler(ch) -USAGE = '''%s [OPTIONS] - -d dir # tests dir - -p path # perf binary - -t test # single test - -v # verbose level -''' % sys.argv[0] - def main(): - parser = optparse.OptionParser(usage=USAGE) - - parser.add_option("-t", "--test", - action="store", type="string", dest="test") - parser.add_option("-d", "--test-dir", - action="store", type="string", dest="test_dir") - parser.add_option("-p", "--perf", - action="store", type="string", dest="perf") - parser.add_option("-v", "--verbose", - default=0, action="count", dest="verbose") - - options, args = parser.parse_args() - if args: - parser.error('FAILED wrong arguments %s' % ' '.join(args)) - return -1 + parser = argparse.ArgumentParser() + + parser.add_argument("-t", "--test", + action="store", dest="test", help="single test") + parser.add_argument("-d", "--test-dir", + action="store", dest="test_dir", help="tests dir") + parser.add_argument("-p", "--perf", + action="store", dest="perf", help="perf binary") + parser.add_argument("-v", "--verbose", + default=0, action="count", dest="verbose", + help="verbose level") + + options = parser.parse_args() setup_log(options.verbose)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH 1/4] perf test: Update attr.py to use argparse
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 lines
optparse is deprecated since Python 3.2 and triggers a pylint deprecated-module warning on newer versions of pylint. Replace optparse.OptionParser in
tools/perf/tests/shell/lib/attr.pywith argparse.ArgumentParser.Assisted-by Antigravity:gemini-3.1-proSigned-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Ian Rogers
reviewerPATCH 2/4 perf build: Run shellcheck, mypy, and remaining pylint checks in parallel
In reply to Ian RogersFollowing the approach used for pylint on standalone scripts and tests, move the shellcheck and mypy checks in tools/perf/Build and tools/perf/tests/Build, as well as the mypy and pylint checks in tools/perf/util/Build and tools/perf/pmu-events/Build, into dedicated phony targets invoked as top-level sub-makes from Makefile.perf.
Also add 'perf' to pylint's --ignored-modules (leaving perf module type-checking to mypy via perf.pyi), since astroid's ImportlibFinder only resolves .pyi stubs for package directories (__init__.pyi) rather than single-file stubs like perf.pyi and does not introspect C extensions by default. This removes the need for pylint to wait on building $(LANG_BINDINGS).
This avoids blocking jevents code generation, archive creation (libperf-util.a, libperf-test.a, libpmu-events.a), and final linking of the perf binary and Python extension on linter execution.
--- tools/perf/Build | 8 +++-- tools/perf/Makefile.perf | 56 ++++++++++++++++++++++++++----- tools/perf/pmu-events/Build | 66 +++++++++++++++++++------------------ tools/perf/tests/Build | 8 +++-- tools/perf/util/Build | 8 +++-- 5 files changed, 99 insertions(+), 47 deletions(-)
tools/perf/Build +6 -2
@@ -76,7 +76,9 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(SHELLCHECK) "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(SHELL_TEST_LOGS) +.PHONY: shellcheck +shellcheck: $(addprefix $(OUTPUT),$(SHELL_TEST_LOGS)) + @: ifdef MYPY PY_TESTS := $(shell find python -type f -name '*.py')
@@ -89,7 +91,9 @@ $(OUTPUT)%.mypy_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(MYPY) "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(MYPY_TEST_LOGS) +.PHONY: mypy +mypy: $(addprefix $(OUTPUT),$(MYPY_TEST_LOGS)) + @: ifdef PYLINT PY_TESTS := $(shell find python -type f -name '*.py')
tools/perf/Makefile.perf +47 -9
82 lines not on this page · raw message
tools/perf/pmu-events/Build +34 -32
75 lines not on this page · raw message
tools/perf/tests/Build +6 -2
@@ -93,7 +93,9 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(SHELLCHECK) "$<" > $@ || (cat $@ && rm $@ && false) -perf-test-y += $(SHELL_TEST_LOGS) +.PHONY: shellcheck +shellcheck: $(addprefix $(OUTPUT)tests/,$(SHELL_TEST_LOGS)) + @: ifdef MYPY PY_TESTS := $(shell find tests/shell -type f -name '*.py')
@@ -106,7 +108,9 @@ $(OUTPUT)%.mypy_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(MYPY) "$<" > $@ || (cat $@ && rm $@ && false) -perf-test-y += $(MYPY_TEST_LOGS) +.PHONY: mypy +mypy: $(addprefix $(OUTPUT)tests/,$(MYPY_TEST_LOGS)) + @: ifdef PYLINT PY_TESTS := $(shell find tests/shell -type f -name '*.py')
tools/perf/util/Build +6 -2
@@ -425,7 +425,9 @@ $(OUTPUT)%.mypy_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(MYPY) "$<" > $@ || (cat $@ && rm $@ && false) -perf-util-y += $(MYPY_TEST_LOGS) +.PHONY: mypy +mypy: $(addprefix $(OUTPUT)util/,$(MYPY_TEST_LOGS)) + @: ifdef PYLINT PYLINT_TEST_LOGS := $(PY_TESTS:%=%.pylint_log)
@@ -437,7 +439,9 @@ $(OUTPUT)%.pylint_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(PYLINT) "$<" > $@ || (cat $@ && rm $@ && false) -perf-util-y += $(PYLINT_TEST_LOGS) +.PHONY: pylint +pylint: $(addprefix $(OUTPUT)util/,$(PYLINT_TEST_LOGS)) + @: ifeq ($(CONFIG_PERF_BPF_SKEL),y) include $(srctree)/tools/perf/bpf_skel.mak
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH 2/4] perf build: Run shellcheck, mypy, and remaining pylint checks in parallel
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 13 lines
Following the approach used for pylint on standalone scripts and tests, move the shellcheck and mypy checks in
tools/perf/Buildandtools/perf/tests/Build, as well as the mypy and pylint checks intools/perf/util/Buildandtools/perf/pmu-events/Build, into dedicated phony targets invoked as top-level sub-makes from Makefile.perf.Also add 'perf' to pylint's --ignored-modules (leaving perf module type-checking to mypy via perf.pyi), since astroid's ImportlibFinder only resolves .pyi stubs for package directories (__init__.pyi) rather than single-file stubs like perf.pyi and does not introspect C extensions by default. This removes the need for pylint to wait on building $(LANG_BINDINGS).
Quoted 6 lines
This avoids blocking jevents code generation, archive creation (libperf-util.a, libperf-test.a, libpmu-events.a), and final linking of the perf binary and Python extension on linter execution.
Assisted-by Antigravity:gemini-3.1-proSigned-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Ian Rogers
reviewerPATCH 3/4 perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is missing
In reply to Ian RogersCommit 4751bddd3f98 ("perf tools: Make GTK2 support opt-in") switched Makefile.config and Makefile.perf from checking 'ifndef NO_GTK2' to 'ifdef GTK2' (now 'ifdef GTK4'), leaving 'NO_GTK4 := 1' in Makefile.config unused. As a result, when building with GTK4=1 on a system without gtk4 development headers, Makefile.perf still attempted to build and install libperf-gtk.so under 'ifdef GTK4'.
Replace 'NO_GTK4 := 1' with 'override GTK4 :=' so that 'ifdef GTK4' in Makefile.perf evaluates to false when the gtk4 feature check fails.
--- tools/perf/Makefile.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
@@ -786,7 +786,7 @@ ifdef GTK4 $(call feature_check,gtk4) ifneq ($(feature-gtk4), 1) $(warning GTK4 not found, disables GTK4 support. Please install gtk4-devel or libgtk-4-dev) - NO_GTK4 := 1 + override GTK4 := else CFLAGS += -DHAVE_GTK4_SUPPORT GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk4 2>/dev/null)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH 3/4] perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is missing
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 lines
Commit
4751bddd3f98("perf tools: Make GTK2 support opt-in") switched Makefile.config and Makefile.perf from checking 'ifndefNO_GTK2' to 'ifdef GTK2' (now 'ifdef GTK4'), leaving 'NO_GTK4:= 1' in Makefile.config unused. As a result, when building with GTK4=1 on a system without gtk4 development headers, Makefile.perf still attempted to build and install libperf-gtk.so under 'ifdef GTK4'.
Quoted 6 lines
Replace '
NO_GTK4:= 1' with 'override GTK4 :=' so that 'ifdef GTK4' in Makefile.perf evaluates to false when the gtk4 feature check fails.Fixes 4751bddd3f98 ("perf tools: Make GTK2 support opt-in")Assisted-by Antigravity:gemini-3.1-proSigned-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Ian Rogers
reviewerPATCH 4/4 perf build: Fix clean and install target dependencies
In reply to Ian RogersFix several missing dependencies and ordering issues for clean and install targets:
1. In tools/perf/Makefile, order 'install*' goals after 'all' when both are passed on the command line (e.g. 'make -j clean all install') so two concurrent Makefile.perf sub-makes do not race in the same build directory, and mark 'all' and 'clean' as .PHONY.
2. In tools/perf/Makefile.perf, when 'clean' is passed alongside build or install goals (e.g. 'make -f Makefile.perf clean install'), run 'clean' sequentially before 'fixdep' and 'sub-make' rather than running 'clean' in parallel with the build inside 'sub-make'.
3. Ensure '$(OUTPUT)python' is created inside the recipe for '$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)' rather than only at Makefile parse time, in case 'clean' removed the directory.
4. Add '$(LANG_BINDINGS)' as a prerequisite of 'install-python_ext' so the Python C extension is built with the proper compiler/linker flags and perf libraries before 'setup.py install' runs.
5. Add 'install-bin', 'install-tools', 'install-tests', 'install-python_ext', '$(DOC_TARGETS)', and '$(INSTALL_DOC_TARGETS)' to .PHONY in Makefile.perf.
6. Prefix targets emitted by Documentation/build-docdep.perl with '$(OUTPUT)' so '$(OUTPUT)doc.dep' matches out-of-tree documentation targets when 'O=' is specified.
--- tools/perf/Documentation/build-docdep.perl | 2 +- tools/perf/Makefile | 9 ++++++++- tools/perf/Makefile.perf | 19 +++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-)
tools/perf/Documentation/build-docdep.perl +1 -1
@@ -41,6 +41,6 @@ while ($changed) { while (my ($text, $included) = each %include) { if (! exists $included{$text} && (my $base = $text) =~ s/\.txt$//) { - print "$base.html $base.xml : ", join(" ", keys %$included), "\n"; + print "\$(OUTPUT)$base.html \$(OUTPUT)$base.xml : ", join(" ", keys %$included), "\n"; } }
tools/perf/Makefile +8 -1
@@ -93,6 +93,13 @@ ifeq ($(has_clean),1) $(rest): clean endif # rest endif # has_clean + +ifneq ($(filter all,$(MAKECMDGOALS)),) + install_goals := $(filter install%,$(MAKECMDGOALS)) + ifneq ($(install_goals),) +$(install_goals): all + endif +endif endif # MAKECMDGOALS #
@@ -130,4 +137,4 @@ check-headers: $(print_msg) $(make) -.PHONY: tags TAGS FORCE Makefile build-test build-test-tarball check-headers +.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers
tools/perf/Makefile.perf +15 -4
@@ -327,9 +327,17 @@ export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK MYPY PYLINT CONFIG_PERF_BPF_SK include $(srctree)/tools/build/Makefile.include ifeq ($(force_fixdep),1) -goals := $(filter-out all sub-make, $(MAKECMDGOALS)) +goals := $(filter-out all sub-make clean, $(MAKECMDGOALS)) -$(goals) all: sub-make +ifneq ($(filter clean,$(MAKECMDGOALS)),) +clean-make: + $(Q)$(MAKE) -f Makefile.perf -j1 clean + +fixdep: clean-make +.PHONY: clean-make +endif + +$(goals) all clean: sub-make sub-make: fixdep $(Q)$(MAKE) FIXDEP_BUILT=1 -f Makefile.perf $(goals)
@@ -565,6 +573,7 @@ $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py pyth CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \ $(PYTHON_WORD) util/setup.py \ $(python_setup_quiet) build_ext; \ + $(MKDIR) -p $(OUTPUT)python; \ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/; \ if [ "$(abspath python/perf.pyi)" != "$(abspath $(OUTPUT)python/perf.pyi)" ]; then \ cp python/perf.pyi $(OUTPUT)python/; \
@@ -994,7 +1003,7 @@ install: install-bin try-install-man install-build-deps: $(Q)$(SHELL) $(srctree)/tools/perf/scripts/install-build-deps.sh $(INSTALL_BUILD_DEPS_ARGS) -install-python_ext: +install-python_ext: $(LANG_BINDINGS) $(PYTHON_WORD) util/setup.py $(python_setup_quiet) \ $(if $(OUTPUT),egg_info --egg-base $(OUTPUT)) \ install --root='/$(DESTDIR_SQ)'
@@ -1070,7 +1079,9 @@ endif FORCE: -.PHONY: all install install-build-deps clean config-clean strip install-gtk +.PHONY: all install install-bin install-tools install-tests install-build-deps +.PHONY: install-gtk install-python_ext $(DOC_TARGETS) $(INSTALL_DOC_TARGETS) +.PHONY: clean config-clean strip .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare bpf-skel-prepare .PHONY: python_perf_target
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH 4/4] perf build: Fix clean and install target dependencies
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] perf build: install% wildcard makes install-build-deps depend on all --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf build: install% wildcard makes install-build-deps depend on all --
commit 96fc82160f943f83538b4ed54809e23a269afef0
Author: Ian Rogers <[email protected]>
perf build: Fix clean and install target dependencies
Fix several missing dependencies and ordering issues for clean and install targets.
Quoted 6 lines
tools/perf/Makefile +0
-0@@ -93,6 +93,13 @@ ifeq ($(has_clean),1) $(rest): clean
tools/perf/Makefile ifeq ($(has_clean),1) · line 103
Quoted 10 lines
tools/perf/Makefile +7
-0endif # rest endif # has_clean + +ifneq ($(filter all,$(MAKECMDGOALS)),) + install_goals := $(filter install%,$(MAKECMDGOALS)) + ifneq ($(install_goals),) +$(install_goals): all + endif +endif endif # MAKECMDGOALS
[Severity: Medium]
Does the wildcard install% incorrectly capture install-build-deps here?
If a user executes a combined command like make install-build-deps all, this will add install-build-deps to install_goals and create the dependency install-build-deps: all.
Reversing this target dependency order forces the all target to compile perf before the required system dependencies are installed, causing the build to fail.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Ian Rogers
reviewerv2 cover perf build: Linter parallelism and clean/install dependency fixes
In reply to Ian RogersThis series includes a small Python test cleanup alongside build system improvements for linter parallelism and clean/install target dependencies:
1. Update tools/perf/tests/shell/lib/attr.py to use argparse instead of the deprecated optparse module, avoiding a pylint deprecated-module warning.
2. Building on Leo Yan's recent change to run pylint checks on standalone scripts and tests in parallel with linking perf, move the remaining shellcheck, mypy, and pylint rules (in tools/perf/Build, tools/perf/tests/Build, tools/perf/util/Build, and tools/perf/pmu-events/Build) into top-level phony targets in Makefile.perf so they no longer serialize archive creation, jevents generation, or final linking, nor wait on $(LANG_BINDINGS).
3. Clear GTK4 via 'override GTK4 :=' in Makefile.config when the gtk4 feature check fails instead of setting the unused 'NO_GTK4 := 1' variable left over from commit 4751bddd3f98 ("perf tools: Make GTK2 support opt-in").
4. Fix missing dependencies and target ordering for clean and install targets across Makefile, Makefile.perf, and Documentation/build-docdep.perl.
v2: In patch 4, exclude 'install-build-deps' from 'install_goals' in
tools/perf/Makefile so it is not ordered after 'all', and explicitly order non-'clean' targets after 'install-build-deps' when present.
Ian Rogers (4):
perf test: Update attr.py to use argparse
perf build: Run shellcheck, mypy, and remaining pylint checks in
parallel
perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is
missing
perf build: Fix clean and install target dependencies
tools/perf/Build | 8 ++- tools/perf/Documentation/build-docdep.perl | 2 +- tools/perf/Makefile | 16 ++++- tools/perf/Makefile.config | 2 +- tools/perf/Makefile.perf | 75 ++++++++++++++++++---- tools/perf/pmu-events/Build | 66 ++++++++++--------- tools/perf/tests/Build | 8 ++- tools/perf/tests/shell/lib/attr.py | 37 ++++------- tools/perf/util/Build | 8 ++- 9 files changed, 145 insertions(+), 77 deletions(-)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
Ian Rogers
reviewerPATCH v2 1/4 perf test: Update attr.py to use argparse
optparse is deprecated since Python 3.2 and triggers a pylint deprecated-module warning on newer versions of pylint. Replace optparse.OptionParser in tools/perf/tests/shell/lib/attr.py with argparse.ArgumentParser.
--- tools/perf/tests/shell/lib/attr.py | 37 +++++++++++------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
tools/perf/tests/shell/lib/attr.py +14 -23
@@ -4,7 +4,7 @@ import configparser import os import sys import glob -import optparse +import argparse import platform import tempfile import logging
@@ -426,29 +426,20 @@ def setup_log(verbose): ch.setFormatter(formatter) log.addHandler(ch) -USAGE = '''%s [OPTIONS] - -d dir # tests dir - -p path # perf binary - -t test # single test - -v # verbose level -''' % sys.argv[0] - def main(): - parser = optparse.OptionParser(usage=USAGE) - - parser.add_option("-t", "--test", - action="store", type="string", dest="test") - parser.add_option("-d", "--test-dir", - action="store", type="string", dest="test_dir") - parser.add_option("-p", "--perf", - action="store", type="string", dest="perf") - parser.add_option("-v", "--verbose", - default=0, action="count", dest="verbose") - - options, args = parser.parse_args() - if args: - parser.error('FAILED wrong arguments %s' % ' '.join(args)) - return -1 + parser = argparse.ArgumentParser() + + parser.add_argument("-t", "--test", + action="store", dest="test", help="single test") + parser.add_argument("-d", "--test-dir", + action="store", dest="test_dir", help="tests dir") + parser.add_argument("-p", "--perf", + action="store", dest="perf", help="perf binary") + parser.add_argument("-v", "--verbose", + default=0, action="count", dest="verbose", + help="verbose level") + + options = parser.parse_args() setup_log(options.verbose)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH v2 1/4] perf test: Update attr.py to use argparse
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 lines
optparse is deprecated since Python 3.2 and triggers a pylint deprecated-module warning on newer versions of pylint. Replace optparse.OptionParser in
tools/perf/tests/shell/lib/attr.pywith argparse.ArgumentParser.Assisted-by Antigravity:gemini-3.1-proSigned-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Ian Rogers
reviewerPATCH v2 2/4 perf build: Run shellcheck, mypy, and remaining pylint checks in parallel
In reply to Ian RogersFollowing the approach used for pylint on standalone scripts and tests, move the shellcheck and mypy checks in tools/perf/Build and tools/perf/tests/Build, as well as the mypy and pylint checks in tools/perf/util/Build and tools/perf/pmu-events/Build, into dedicated phony targets invoked as top-level sub-makes from Makefile.perf.
Also add 'perf' to pylint's --ignored-modules (leaving perf module type-checking to mypy via perf.pyi), since astroid's ImportlibFinder only resolves .pyi stubs for package directories (__init__.pyi) rather than single-file stubs like perf.pyi and does not introspect C extensions by default. This removes the need for pylint to wait on building $(LANG_BINDINGS).
This avoids blocking jevents code generation, archive creation (libperf-util.a, libperf-test.a, libpmu-events.a), and final linking of the perf binary and Python extension on linter execution.
--- tools/perf/Build | 8 +++-- tools/perf/Makefile.perf | 56 ++++++++++++++++++++++++++----- tools/perf/pmu-events/Build | 66 +++++++++++++++++++------------------ tools/perf/tests/Build | 8 +++-- tools/perf/util/Build | 8 +++-- 5 files changed, 99 insertions(+), 47 deletions(-)
tools/perf/Build +6 -2
@@ -76,7 +76,9 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(SHELLCHECK) "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(SHELL_TEST_LOGS) +.PHONY: shellcheck +shellcheck: $(addprefix $(OUTPUT),$(SHELL_TEST_LOGS)) + @: ifdef MYPY PY_TESTS := $(shell find python -type f -name '*.py')
@@ -89,7 +91,9 @@ $(OUTPUT)%.mypy_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(MYPY) "$<" > $@ || (cat $@ && rm $@ && false) -perf-y += $(MYPY_TEST_LOGS) +.PHONY: mypy +mypy: $(addprefix $(OUTPUT),$(MYPY_TEST_LOGS)) + @: ifdef PYLINT PY_TESTS := $(shell find python -type f -name '*.py')
tools/perf/Makefile.perf +47 -9
82 lines not on this page · raw message
tools/perf/pmu-events/Build +34 -32
75 lines not on this page · raw message
tools/perf/tests/Build +6 -2
@@ -93,7 +93,9 @@ $(OUTPUT)%.shellcheck_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(SHELLCHECK) "$<" > $@ || (cat $@ && rm $@ && false) -perf-test-y += $(SHELL_TEST_LOGS) +.PHONY: shellcheck +shellcheck: $(addprefix $(OUTPUT)tests/,$(SHELL_TEST_LOGS)) + @: ifdef MYPY PY_TESTS := $(shell find tests/shell -type f -name '*.py')
@@ -106,7 +108,9 @@ $(OUTPUT)%.mypy_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(MYPY) "$<" > $@ || (cat $@ && rm $@ && false) -perf-test-y += $(MYPY_TEST_LOGS) +.PHONY: mypy +mypy: $(addprefix $(OUTPUT)tests/,$(MYPY_TEST_LOGS)) + @: ifdef PYLINT PY_TESTS := $(shell find tests/shell -type f -name '*.py')
tools/perf/util/Build +6 -2
@@ -425,7 +425,9 @@ $(OUTPUT)%.mypy_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(MYPY) "$<" > $@ || (cat $@ && rm $@ && false) -perf-util-y += $(MYPY_TEST_LOGS) +.PHONY: mypy +mypy: $(addprefix $(OUTPUT)util/,$(MYPY_TEST_LOGS)) + @: ifdef PYLINT PYLINT_TEST_LOGS := $(PY_TESTS:%=%.pylint_log)
@@ -437,7 +439,9 @@ $(OUTPUT)%.pylint_log: % $(call rule_mkdir) $(Q)$(call echo-cmd,test)$(PYLINT) "$<" > $@ || (cat $@ && rm $@ && false) -perf-util-y += $(PYLINT_TEST_LOGS) +.PHONY: pylint +pylint: $(addprefix $(OUTPUT)util/,$(PYLINT_TEST_LOGS)) + @: ifeq ($(CONFIG_PERF_BPF_SKEL),y) include $(srctree)/tools/perf/bpf_skel.mak
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH v2 2/4] perf build: Run shellcheck, mypy, and remaining pylint checks in parallel
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 13 lines
Following the approach used for pylint on standalone scripts and tests, move the shellcheck and mypy checks in
tools/perf/Buildandtools/perf/tests/Build, as well as the mypy and pylint checks intools/perf/util/Buildandtools/perf/pmu-events/Build, into dedicated phony targets invoked as top-level sub-makes from Makefile.perf.Also add 'perf' to pylint's --ignored-modules (leaving perf module type-checking to mypy via perf.pyi), since astroid's ImportlibFinder only resolves .pyi stubs for package directories (__init__.pyi) rather than single-file stubs like perf.pyi and does not introspect C extensions by default. This removes the need for pylint to wait on building $(LANG_BINDINGS).
Quoted 6 lines
This avoids blocking jevents code generation, archive creation (libperf-util.a, libperf-test.a, libpmu-events.a), and final linking of the perf binary and Python extension on linter execution.
Assisted-by Antigravity:gemini-3.1-proSigned-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Ian Rogers
reviewerPATCH v2 3/4 perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is missing
In reply to Ian RogersCommit 4751bddd3f98 ("perf tools: Make GTK2 support opt-in") switched Makefile.config and Makefile.perf from checking 'ifndef NO_GTK2' to 'ifdef GTK2' (now 'ifdef GTK4'), leaving 'NO_GTK4 := 1' in Makefile.config unused. As a result, when building with GTK4=1 on a system without gtk4 development headers, Makefile.perf still attempted to build and install libperf-gtk.so under 'ifdef GTK4'.
Replace 'NO_GTK4 := 1' with 'override GTK4 :=' so that 'ifdef GTK4' in Makefile.perf evaluates to false when the gtk4 feature check fails.
--- tools/perf/Makefile.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
@@ -786,7 +786,7 @@ ifdef GTK4 $(call feature_check,gtk4) ifneq ($(feature-gtk4), 1) $(warning GTK4 not found, disables GTK4 support. Please install gtk4-devel or libgtk-4-dev) - NO_GTK4 := 1 + override GTK4 := else CFLAGS += -DHAVE_GTK4_SUPPORT GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk4 2>/dev/null)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH v2 3/4] perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is missing
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 lines
Commit
4751bddd3f98("perf tools: Make GTK2 support opt-in") switched Makefile.config and Makefile.perf from checking 'ifndefNO_GTK2' to 'ifdef GTK2' (now 'ifdef GTK4'), leaving 'NO_GTK4:= 1' in Makefile.config unused. As a result, when building with GTK4=1 on a system without gtk4 development headers, Makefile.perf still attempted to build and install libperf-gtk.so under 'ifdef GTK4'.
Quoted 6 lines
Replace '
NO_GTK4:= 1' with 'override GTK4 :=' so that 'ifdef GTK4' in Makefile.perf evaluates to false when the gtk4 feature check fails.Fixes 4751bddd3f98 ("perf tools: Make GTK2 support opt-in")Assisted-by Antigravity:gemini-3.1-proSigned-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Ian Rogers
reviewerPATCH v2 4/4 perf build: Fix clean and install target dependencies
In reply to Ian RogersFix several missing dependencies and ordering issues for clean and install targets:
1. In tools/perf/Makefile, order 'install*' goals (excluding 'install-build-deps', which is ordered before build/install goals) after 'all' when both are passed on the command line (e.g. 'make -j clean all install') so two concurrent Makefile.perf sub-makes do not race in the same build directory, and mark 'all' and 'clean' as .PHONY.
2. In tools/perf/Makefile.perf, when 'clean' is passed alongside build or install goals (e.g. 'make -f Makefile.perf clean install'), run 'clean' sequentially before 'fixdep' and 'sub-make' rather than running 'clean' in parallel with the build inside 'sub-make'.
3. Ensure '$(OUTPUT)python' is created inside the recipe for '$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)' rather than only at Makefile parse time, in case 'clean' removed the directory.
4. Add '$(LANG_BINDINGS)' as a prerequisite of 'install-python_ext' so the Python C extension is built with the proper compiler/linker flags and perf libraries before 'setup.py install' runs.
5. Add 'install-bin', 'install-tools', 'install-tests', 'install-python_ext', '$(DOC_TARGETS)', and '$(INSTALL_DOC_TARGETS)' to .PHONY in Makefile.perf.
6. Prefix targets emitted by Documentation/build-docdep.perl with '$(OUTPUT)' so '$(OUTPUT)doc.dep' matches out-of-tree documentation targets when 'O=' is specified.
--- tools/perf/Documentation/build-docdep.perl | 2 +- tools/perf/Makefile | 16 +++++++++++++++- tools/perf/Makefile.perf | 19 +++++++++++++++---- 3 files changed, 31 insertions(+), 6 deletions(-)
tools/perf/Documentation/build-docdep.perl +1 -1
@@ -41,6 +41,6 @@ while ($changed) { while (my ($text, $included) = each %include) { if (! exists $included{$text} && (my $base = $text) =~ s/\.txt$//) { - print "$base.html $base.xml : ", join(" ", keys %$included), "\n"; + print "\$(OUTPUT)$base.html \$(OUTPUT)$base.xml : ", join(" ", keys %$included), "\n"; } }
tools/perf/Makefile +15 -1
@@ -93,6 +93,20 @@ ifeq ($(has_clean),1) $(rest): clean endif # rest endif # has_clean + +ifneq ($(filter install-build-deps,$(MAKECMDGOALS)),) + after_deps := $(filter-out clean install-build-deps,$(MAKECMDGOALS)) + ifneq ($(after_deps),) +$(after_deps): install-build-deps + endif +endif + +ifneq ($(filter all,$(MAKECMDGOALS)),) + install_goals := $(filter-out install-build-deps,$(filter install%,$(MAKECMDGOALS))) + ifneq ($(install_goals),) +$(install_goals): all + endif +endif endif # MAKECMDGOALS #
@@ -130,4 +144,4 @@ check-headers: $(print_msg) $(make) -.PHONY: tags TAGS FORCE Makefile build-test build-test-tarball check-headers +.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers
tools/perf/Makefile.perf +15 -4
@@ -327,9 +327,17 @@ export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK MYPY PYLINT CONFIG_PERF_BPF_SK include $(srctree)/tools/build/Makefile.include ifeq ($(force_fixdep),1) -goals := $(filter-out all sub-make, $(MAKECMDGOALS)) +goals := $(filter-out all sub-make clean, $(MAKECMDGOALS)) -$(goals) all: sub-make +ifneq ($(filter clean,$(MAKECMDGOALS)),) +clean-make: + $(Q)$(MAKE) -f Makefile.perf -j1 clean + +fixdep: clean-make +.PHONY: clean-make +endif + +$(goals) all clean: sub-make sub-make: fixdep $(Q)$(MAKE) FIXDEP_BUILT=1 -f Makefile.perf $(goals)
@@ -565,6 +573,7 @@ $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py pyth CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \ $(PYTHON_WORD) util/setup.py \ $(python_setup_quiet) build_ext; \ + $(MKDIR) -p $(OUTPUT)python; \ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/; \ if [ "$(abspath python/perf.pyi)" != "$(abspath $(OUTPUT)python/perf.pyi)" ]; then \ cp python/perf.pyi $(OUTPUT)python/; \
@@ -994,7 +1003,7 @@ install: install-bin try-install-man install-build-deps: $(Q)$(SHELL) $(srctree)/tools/perf/scripts/install-build-deps.sh $(INSTALL_BUILD_DEPS_ARGS) -install-python_ext: +install-python_ext: $(LANG_BINDINGS) $(PYTHON_WORD) util/setup.py $(python_setup_quiet) \ $(if $(OUTPUT),egg_info --egg-base $(OUTPUT)) \ install --root='/$(DESTDIR_SQ)'
@@ -1070,7 +1079,9 @@ endif FORCE: -.PHONY: all install install-build-deps clean config-clean strip install-gtk +.PHONY: all install install-bin install-tools install-tests install-build-deps +.PHONY: install-gtk install-python_ext $(DOC_TARGETS) $(INSTALL_DOC_TARGETS) +.PHONY: clean config-clean strip .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare bpf-skel-prepare .PHONY: python_perf_target
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog
[email protected]
AI reviewRe: [PATCH v2 4/4] perf build: Fix clean and install target dependencies
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 15 lines
Fix several missing dependencies and ordering issues for clean and install targets:
1. In
tools/perf/Makefile, order 'install*' goals (excluding 'install-build-deps', which is ordered before build/install goals) after 'all' when both are passed on the command line (e.g. 'make -j clean all install') so two concurrent Makefile.perf sub-makes do not race in the same build directory, and mark 'all' and 'clean' as .PHONY.2. In
tools/perf/Makefile.perf, when 'clean' is passed alongside build or install goals (e.g. 'make -f Makefile.perf clean install'), run 'clean' sequentially before 'fixdep' and 'sub-make' rather than running 'clean' in parallel with the build inside 'sub-make'.
Quoted 6 lines
[ ... ]
'$(OUTPUT)' so '$(OUTPUT)doc.dep' matches out-of-tree documentation targets when 'O=' is specified.Assisted-by Antigravity:gemini-3.1-proSigned-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Quoted 3 lines · Ian Rogers
This series includes a small Python test cleanup alongside build system improvements for linter parallelism and clean/install target dependencies:
Thanks, applied to perf-tools-next, for v7.4.
- Arnaldo