* [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism
@ 2026-12-06 2:11 Ian Rogers
2026-12-06 2:11 ` [PATCH 1/8] perf pmu-events: Ignore backup and non-event JSON files in metric.py Ian Rogers
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
This series removes the copy of ~1,013 checked-in pmu-events JSON/CSV
files into $(OUTPUT) during out-of-tree builds, hardens pmu-events file
discovery against stray and backup files, and removes several
serialization bottlenecks in the perf build and build-test:
- Patches 1-3 (no-copy pmu-events overlay & hardening):
* Ignore hidden, backup, non-list, and generated JSON files in
metric.py and jevents.py.
* Refactor jevents.py directory scanning and add --gen-dir,
--gen-manifest, and --gen-file overlay options so generated JSONs
live in $(OUTPUT)pmu-events/gen/ for both in-tree and out-of-tree
builds without copying checked-in sources or polluting the source
tree.
* Track input file lists with write-if-changed manifests via GNU
Make's $(file ...) built-in, derive model lists from mapfile.csv,
and drop the 1,013 per-file COPY rules and orphan-pruning logic.
* Preserves byte-for-byte identical pmu-events.c and
pmu-events-string.c outputs (and Python-free NO_JEVENTS=1 builds).
- Patches 4-6 (pmu-events generation & test parallelism):
* Scope LoadAllModelEvents() via mapfile.csv so AMD models do not
parse Intel event JSONs and vice versa (and ARM stays scoped to its
vendor), add --output-dir batch mode to amd_metrics.py,
arm64_metrics.py, and intel_metrics.py, and add unit tests in
metric_test.py.
* Replace 136 per-model/per-file metric generation rules in
pmu-events/Build with 3 parallel stamp-gated batch invocations
(~0.5 s wall time for all 136 JSONs: 87 ms AMD, 121 ms ARM64,
503 ms Intel).
* Move EMPTY_PMU_EVENTS_TEST_LOG and METRIC_TEST_LOG off pmu-events.c
onto pmu-events-in.o so tests run in parallel with jevents.py and C
compilation.
- Patch 7 (header-only prepare dependencies):
* Split phony lib{api,bpf,perf,subcmd,symbol}-headers targets running
only install_headers out of the full archive rules in Makefile.perf
(updating bpf_skel.mak to depend on bpf_helper_defs.h instead of
libbpf.a).
* Use those header targets in prepare and libperf-headers in
LIBPMU_EVENTS_IN so library archive builds run in parallel with perf
object compilation and pmu-events.
- Patch 8 (build-test linter deduplication):
* Pass NO_SHELLCHECK=1 NO_MYPY=1 NO_PYLINT=1 to all targets in
tools/perf/tests/make except make_pure and make_pure_O so static
checks run once per suite instead of repeating ~291 linter
invocations on every build configuration.
Build performance impact
------------------------
Measured on a 28-thread x86_64 host (clean out-of-tree builds from
identical worktrees, default JEVENTS_ARCH=all):
- Full default build (including shellcheck, mypy, pylint):
* Wall time: 75.98 s -> 65.94 s (-13.2%, -10.04 s)
* CPU time: 472.3 s -> 396.6 s (-16.0%, -75.8 CPU-s)
* Log lines: 2,423 -> 1,165 (-51.9%)
- Full build without linters (NO_SHELLCHECK=1 NO_MYPY=1 NO_PYLINT=1):
* Wall time: 57.83 s -> 44.70 s (-22.7%, -13.13 s)
* CPU time: 222.5 s -> 142.0 s (-36.2%, -80.5 CPU-s)
* Log lines: 2,125 -> 870 (-59.1%)
- Cold libpmu-events.a build: net wall time (excluding feature
detection) drops from 9.22 s to 4.96 s (-46.2%; gross 13.95 s to
8.80 s), COPY rules drop from 1,013 to 0, and build log lines drop
from 1,330 to 60 (-95.5%).
- Metric JSON generation: 136 separate Python processes drop to 3
parallel vendor-scoped invocations (~0.5 s wall time total: 87 ms
AMD, 121 ms ARM64, 503 ms Intel).
- prepare / single-object builds: lib{api,bpf,perf,subcmd,symbol}.a
no longer serialize perf object compilation or pmu-events (saving
~1 s of libperf.a compile latency before pmu-events starts, and
eliminating all 5 archive builds for single-object targets like
perf.o or util/symbol.o).
- build-test (tests/make): a single shellcheck + mypy + pylint pass
(187 shell scripts and 52 Python files, 291 invocations) consumes
~272 CPU-seconds (241 s user + 32 s sys); running it once on
make_pure_O instead of ~42 times across make build-test eliminates
>11,000 CPU-seconds of redundant static analysis.
Tool-generated content disclosure
---------------------------------
Per Documentation/process/coding-assistants.rst and
Documentation/process/generated-content.rst, this series was developed
with AI assistance from Jetski. Across an interactive session guided by
the author, Jetski analyzed the pmu-events and prepare build
dependencies, drafted the Python, Makefile/Build, unit test, commit
message, and cover letter changes, and ran the build and regression
checks listed below.
Testing
-------
Tested on x86_64 Linux (GCC, Clang 21.1.8, bpf-gcc 16.1.0, 28 cores):
- Byte-for-byte comparison of all 137 generated JSONs, pmu-events.c,
pmu-events-string.c, and standalone single-model CLI invocations of
amd_metrics.py, arm64_metrics.py, and intel_metrics.py against
pre-series baselines.
- metric_test.py (8/8 tests including test_MapfileVendorScoping),
mypy-pmu-events, pylint-pmu-events, and
tools/perf/tests/shell/jevents_bad_key.sh.
- Out-of-tree and in-tree builds, incremental no-op rebuilds,
JEVENTS_ARCH={all,x86,arm64,nds32}, NO_JEVENTS=1 (including without
python3 on PATH under NO_JEVENTS=1 NO_LIBBPF=1), NO_LIBBPF=1,
LIBBPF_DYNAMIC=1 (with BPF skeletons), single-object builds (perf.o
and util/symbol.o confirming no .a archives compile during prepare),
clean, and tests/make make_minimal_O (plus command-expansion checks
across tests/make targets).
- scripts/checkpatch.pl across all 8 patches (0 errors; only the
expected "none none" positional args warning in pmu-events/Build).
Not tested:
- Native builds on non-x86 hosts (arm64, riscv, powerpc, s390) and
cross-compilation builds.
- Full end-to-end "make build-test" on this branch (make_gen_vmlinux_h_O
hit an unrelated bpf-gcc 16 C23 error on BTF-generated vmlinux.h,
which is being fixed separately).
- Runtime execution of make_kernelsrc and make_kernelsrc_tools
(verified by expanded command inspection only).
Ian Rogers (8):
perf pmu-events: Ignore backup and non-event JSON files in metric.py
perf jevents: Support --gen-dir/--gen-manifest overlay and ignore
backups
perf build: Avoid copying pmu-events JSON files into OUTPUT
perf pmu-events: Batch metric generation and scope via mapfile.csv
perf build: Batch metric JSON generation in pmu-events/Build
perf build: Run pmu-events tests in parallel with jevents.py
perf build: Depend on lib*-headers instead of archives in prepare
perf tests make: Only run shellcheck, mypy and pylint in pure builds
tools/perf/.gitignore | 7 +-
tools/perf/Makefile.perf | 81 ++++---
tools/perf/bpf_skel.mak | 2 +-
tools/perf/pmu-events/Build | 208 +++++++++---------
tools/perf/pmu-events/amd_metrics.py | 70 +++---
tools/perf/pmu-events/arm64_metrics.py | 45 +++-
tools/perf/pmu-events/intel_metrics.py | 87 +++++---
tools/perf/pmu-events/jevents.py | 290 +++++++++++++++++--------
tools/perf/pmu-events/metric.py | 185 +++++++++++++---
tools/perf/pmu-events/metric_test.py | 65 ++++++
tools/perf/tests/make | 21 +-
11 files changed, 718 insertions(+), 343 deletions(-)
base-commit: 114463420e8acafacaecc4f8caf15d544c3801c8
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/8] perf pmu-events: Ignore backup and non-event JSON files in metric.py
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
2026-12-06 2:11 ` [PATCH 2/8] perf jevents: Support --gen-dir/--gen-manifest overlay and ignore backups Ian Rogers
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
LoadEvents() in metric.py scans model directories and their parent
architecture tree for any filename ending in ".json". Editor lockfiles
and backup files ending in ".json", such as Emacs dangling symlinks
(".#cache.json"), hidden files (".cache.json"), multi-dot backups
("cache.bak.json"), or git mergetool backups ("cache_BACKUP_*.json"),
can crash LoadEvents() with FileNotFoundError or pollute the loaded
event set. Likewise, metricgroups.json files contain JSON objects
rather than event arrays, and leftover generated files
(extra-metrics.json, extra-metricgroups.json, legacy-cache.json) do not
define raw PMU events.
Filter filenames via _is_valid_event_json(), check os.path.isfile()
before opening, verify parsed JSON is a list of dicts before reading
event keys, and prune hidden or dotted subdirectories during os.walk().
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/metric.py | 80 ++++++++++++++++++++++-----------
1 file changed, 55 insertions(+), 25 deletions(-)
diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
index f5d81eccd5c3..f7d5ab6143ee 100644
--- a/tools/perf/pmu-events/metric.py
+++ b/tools/perf/pmu-events/metric.py
@@ -13,6 +13,25 @@ all_events: Set[str] = set()
experimental_events: Set[str] = set()
all_events_all_models: Set[str] = set()
+_MERGETOOL_BACKUP_RE = re.compile(r'_(?:BACKUP|BASE|LOCAL|REMOTE)_\d+\.json$')
+_SKIP_EVENT_JSON_NAMES = frozenset({
+ 'legacy-cache.json',
+ 'extra-metrics.json',
+ 'extra-metricgroups.json',
+})
+
+
+def _is_valid_event_json(filename: str) -> bool:
+ """Return True if filename is a checked-in PMU event JSON table."""
+ if filename.startswith('.') or not filename.endswith('.json'):
+ return False
+ if filename.count('.') != 1 or _MERGETOOL_BACKUP_RE.search(filename):
+ return False
+ if filename.endswith('metricgroups.json') or filename in _SKIP_EVENT_JSON_NAMES:
+ return False
+ return True
+
+
def LoadEvents(directory: str) -> None:
"""Populate a global set of all known events for the purpose of validating Event names"""
global all_events
@@ -26,37 +45,48 @@ def LoadEvents(directory: str) -> None:
}
for file in os.listdir(os.fsencode(directory)):
filename = os.fsdecode(file)
- if filename.endswith(".json"):
+ path = f"{directory}/{filename}"
+ if _is_valid_event_json(filename) and os.path.isfile(path):
try:
- with open(f"{directory}/{filename}", encoding="utf-8") as f:
- for x in json.load(f):
- if "Unit" in x:
- all_pmus.add(x["Unit"])
- if "EventName" in x:
- all_events.add(x["EventName"])
- if "Experimental" in x and x["Experimental"] == "1":
- experimental_events.add(x["EventName"])
- elif "ArchStdEvent" in x:
- all_events.add(x["ArchStdEvent"])
+ with open(path, encoding="utf-8") as f:
+ data = json.load(f)
except json.decoder.JSONDecodeError:
- # The generated directory may be the same as the input, which
- # causes partial json files. Ignore errors.
- pass
+ # Ignore partially written JSON files if present.
+ continue
+ if not isinstance(data, list):
+ continue
+ for x in data:
+ if not isinstance(x, dict):
+ continue
+ if "Unit" in x:
+ all_pmus.add(x["Unit"])
+ if "EventName" in x:
+ all_events.add(x["EventName"])
+ if "Experimental" in x and x["Experimental"] == "1":
+ experimental_events.add(x["EventName"])
+ elif "ArchStdEvent" in x:
+ all_events.add(x["ArchStdEvent"])
all_events_all_models = all_events.copy()
- for root, _, files in os.walk(directory + ".."):
+ for root, dirs, files in os.walk(directory + ".."):
+ dirs[:] = [d for d in dirs if not d.startswith('.') and '.' not in d]
for filename in files:
- if filename.endswith(".json"):
+ path = f"{root}/{filename}"
+ if _is_valid_event_json(filename) and os.path.isfile(path):
try:
- with open(f"{root}/{filename}", encoding="utf-8") as f:
- for x in json.load(f):
- if "EventName" in x:
- all_events_all_models.add(x["EventName"])
- elif "ArchStdEvent" in x:
- all_events_all_models.add(x["ArchStdEvent"])
+ with open(path, encoding="utf-8") as f:
+ data = json.load(f)
except json.decoder.JSONDecodeError:
- # The generated directory may be the same as the input, which
- # causes partial json files. Ignore errors.
- pass
+ # Ignore partially written JSON files if present.
+ continue
+ if not isinstance(data, list):
+ continue
+ for x in data:
+ if not isinstance(x, dict):
+ continue
+ if "EventName" in x:
+ all_events_all_models.add(x["EventName"])
+ elif "ArchStdEvent" in x:
+ all_events_all_models.add(x["ArchStdEvent"])
def CheckPmu(name: str) -> bool:
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/8] perf jevents: Support --gen-dir/--gen-manifest overlay and ignore backups
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
2026-12-06 2:11 ` [PATCH 1/8] perf pmu-events: Ignore backup and non-event JSON files in metric.py Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
2026-12-06 2:11 ` [PATCH 3/8] perf build: Avoid copying pmu-events JSON files into OUTPUT Ian Rogers
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
Previously jevents.py required all checked-in and generated JSON files
to live under a single starting_dir, forcing out-of-tree builds to copy
over a thousand checked-in JSON and CSV files into $(OUTPUT) before
generating pmu-events.c and pmu-events-string.c.
Refactor the repeated os.scandir()/ftw() passes and the stateful
is_leaf_dir_ignoring_sys() helper into a single in-memory map of
(arch, parents) -> {filename: path} populated by scan_arch_tree() and
emitted by process_model_files(). Grouping directly by parent directory
also avoids misfiling JSON files that sort alphabetically after a
sibling "sys" subdirectory.
Add optional --gen-dir, --gen-manifest, and repeatable --gen-file CLI
options so generated JSON files can be overlaid directly from a
separate output directory without copying checked-in sources. When
--gen-manifest or --gen-file is given, only listed files are read from
--gen-dir so stale files left over from earlier builds are ignored.
Standalone invocations without --gen-dir remain unchanged.
Harden directory and file discovery against backup and stray JSON files
that previously broke builds:
- Skip hidden entries (including Emacs ".#*.json" lockfiles) and
directories containing dots (e.g. "skylake.bak/").
- Skip multi-dot backup JSONs (e.g. "cache.bak.json", "cache.orig.json")
and git mergetool backups ("*_{BACKUP,BASE,LOCAL,REMOTE}_<pid>.json");
no checked-in file under pmu-events/arch/ matches these patterns.
- Ignore leftover generated filenames (legacy-cache.json,
extra-metrics.json, extra-metricgroups.json) in starting_dir when
--gen-dir is supplied.
- Record JsonEvent.source_path so duplicate-event assertions report
both conflicting file paths.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/jevents.py | 290 +++++++++++++++++++++----------
1 file changed, 194 insertions(+), 96 deletions(-)
diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
index 50bfce7d07d4..f4c6edd30d08 100755
--- a/tools/perf/pmu-events/jevents.py
+++ b/tools/perf/pmu-events/jevents.py
@@ -8,6 +8,7 @@ import importlib
import json
import metric
import os
+import re
import sys
from typing import (Callable, Dict, NamedTuple, Optional, Sequence, Set, TextIO,
Tuple)
@@ -91,6 +92,56 @@ _valid_keys: Set[str] = {
'ThreadMask', 'UMask', 'Unit',
}
+# Generated JSON filenames written into --gen-dir rather than starting_dir.
+# Ignored in starting_dir when --gen-dir is supplied so leftover files from
+# older in-tree builds cannot collide with freshly generated outputs.
+_GENERATED_JSON_NAMES = frozenset({
+ 'legacy-cache.json',
+ 'extra-metrics.json',
+ 'extra-metricgroups.json',
+})
+
+# Backup files created by git mergetool end in .json and would otherwise look
+# like valid topic tables.
+_MERGETOOL_BACKUP_RE = re.compile(r'_(?:BACKUP|BASE|LOCAL|REMOTE)_\d+\.json$')
+
+
+def _is_valid_dir_name(name: str) -> bool:
+ """Return True if a directory under arch/ should be traversed."""
+ return not name.startswith('.') and '.' not in name
+
+
+def _is_valid_json_filename(name: str, skip_generated: bool = False) -> bool:
+ """Return True if filename looks like a PMU event/metric JSON table.
+
+ Skips hidden dotfiles (including Emacs '.#*' lockfiles), multi-dot backup
+ copies (e.g. 'cache.bak.json', 'cache.orig.json'), git mergetool backups,
+ and optionally generated filenames when scanning the source tree alongside
+ an explicit --gen-dir.
+ """
+ if name.startswith('.') or not name.endswith('.json'):
+ return False
+ if name.count('.') != 1:
+ return False
+ if _MERGETOOL_BACKUP_RE.search(name):
+ return False
+ if skip_generated and name in _GENERATED_JSON_NAMES:
+ return False
+ return True
+
+
+def _parents_match_model(parents: Sequence[str], model_arg: str) -> bool:
+ """Return True if directory components match the --model filter."""
+ if model_arg == 'all':
+ return True
+ models = model_arg.split(',')
+ check_depth = models[0].count('/')
+ if len(parents) <= check_depth:
+ return True
+ prefix = '/'.join(parents[:check_depth + 1])
+ return 'test' in prefix or 'common' in prefix or prefix in models
+
+
def file_name_to_table_name(prefix: str, parents: Sequence[str],
dirname: str) -> str:
"""Generate a C table name from directory names."""
@@ -978,6 +1029,7 @@ class JsonEvent:
legacy_cache_config = int(jd['LegacyCacheCode'], 0) if 'LegacyCacheCode' in jd else None
self.name = jd['EventName'].lower() if 'EventName' in jd else None
self.topic = ''
+ self.source_path = ''
self.compat = jd.get('Compat')
self.desc = fixdesc(jd.get('BriefDescription'))
self.long_desc = fixdesc(jd.get('PublicDescription'))
@@ -1118,6 +1170,7 @@ def _read_json_events_impl(path: str, topic: str) -> Sequence[JsonEvent]:
metrics: list[Tuple[str, str, metric.Expression]] = []
for event in events:
event.topic = topic
+ event.source_path = path
if event.metric_name and '-' not in event.metric_name:
metrics.append((event.pmu, event.metric_name, event.metric_expr))
updates = metric.RewriteMetricsInTermsOfOthers(metrics)
@@ -1134,24 +1187,22 @@ def read_json_events(path: str, topic: str) -> Sequence[JsonEvent]:
_json_cache[key] = _read_json_events_impl(path, topic)
return _json_cache[key]
-def preprocess_arch_std_files(archpath: str) -> None:
+def preprocess_arch_std_files(arch_std_files: Dict[str, str], arch: str) -> None:
"""Read in all architecture standard events."""
- for item in os.scandir(archpath):
- if not item.is_file() or not item.name.endswith('.json'):
- continue
+ for filename, full_path in sorted(arch_std_files.items()):
try:
- for event in read_json_events(item.path, topic=''):
+ for event in read_json_events(full_path, topic=''):
if event.name:
_arch_std_events[event.name.lower()] = event
if event.metric_name:
_arch_std_events[event.metric_name.lower()] = event
except Exception as e:
- raise RuntimeError(f'Failure processing \'{item.name}\' in \'{archpath}\'') from e
+ raise RuntimeError(f"Failure processing '{filename}' in arch '{arch}'") from e
-def add_events_table_entries(item: os.DirEntry, topic: str) -> None:
+def add_events_table_entries(path: str, topic: str) -> None:
"""Add contents of file to _pending_events table."""
- for e in read_json_events(item.path, topic):
+ for e in read_json_events(path, topic):
if e.name:
_pending_events.append(e)
if e.metric_name and not any(e.metric_name == x.metric_name and
@@ -1184,11 +1235,15 @@ def print_pending_events() -> None:
first = True
last_pmu = None
last_name = None
+ last_path = None
pmus: Set[Tuple[str, str]] = set()
assert _args is not None
for event in sorted(_pending_events, key=event_cmp_key):
if last_pmu and last_pmu == event.pmu:
- assert event.name != last_name, f"Duplicate event: {last_pmu}/{last_name}/ in {_pending_events_tblname}"
+ assert event.name != last_name, (
+ f"Duplicate event: {last_pmu}/{last_name}/ in {_pending_events_tblname} "
+ f"(from '{last_path}' and '{event.source_path}')"
+ )
if event.pmu != last_pmu:
if not first:
_args.output_file.write('};\n')
@@ -1201,6 +1256,7 @@ def print_pending_events() -> None:
_args.output_file.write(event.to_c_string(is_metric=False))
last_name = event.name
+ last_path = event.source_path
_pending_events = []
_args.output_file.write(f"""
@@ -1279,24 +1335,12 @@ def get_topic(topic: str) -> str:
return 'metrics'
return topic.removesuffix('.json').replace('-', ' ')
-def preprocess_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
- if item.is_dir():
- return
-
- # base dir or too deep
- level = len(parents)
- if level == 0 or level > 4:
- return
-
- # Ignore other directories. If the file name does not have a .json
- # extension, ignore it. It could be a readme.txt for instance.
- if not item.is_file() or not item.name.endswith('.json'):
- return
-
+def preprocess_one_file(parents: Sequence[str], filename: str, path: str) -> None:
+ """Add strings and metricgroup descriptions from a JSON file to BigCString."""
assert _bcs is not None
- if item.name.endswith('metricgroups.json'):
+ if filename.endswith('metricgroups.json'):
metric_tblname = file_name_to_table_name('pmu_metrics_', parents[:-1], parents[-1])
- with open(item.path, encoding='utf-8') as f:
+ with open(path, encoding='utf-8') as f:
metricgroup_descriptions = json.load(f)
for mgroup in metricgroup_descriptions:
assert len(mgroup) > 1, parents
@@ -1307,49 +1351,30 @@ def preprocess_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
_metricgroups[metric_tblname][mgroup_bytes] = description
return
- topic = get_topic(item.name)
- for event in read_json_events(item.path, topic):
+ topic = get_topic(filename)
+ for event in read_json_events(path, topic):
if event.name:
_bcs.add(event.build_bytes(is_metric=False), is_metric=False)
if event.metric_name:
_bcs.add(event.build_bytes(is_metric=True), is_metric=True)
-def process_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
- """Process a JSON file during the main walk."""
- def is_leaf_dir_ignoring_sys(path: str) -> bool:
- for item in os.scandir(path):
- if item.is_dir() and item.name != 'sys':
- return False
- return True
- # Model directories are leaves (ignoring possible sys
- # directories). The FTW will walk into the directory next. Flush
- # pending events and metrics and update the table names for the new
- # model directory.
- if item.is_dir() and is_leaf_dir_ignoring_sys(item.path):
- print_pending_events()
- print_pending_metrics()
-
- global _pending_events_tblname
- _pending_events_tblname = file_name_to_table_name('pmu_events_', parents, item.name)
- global _pending_metrics_tblname
- _pending_metrics_tblname = file_name_to_table_name('pmu_metrics_', parents, item.name)
-
- if item.name == 'sys':
- _sys_event_table_to_metric_table_mapping[_pending_events_tblname] = _pending_metrics_tblname
- return
-
- # base dir or too deep
- level = len(parents)
- if level == 0 or level > 4:
- return
+def process_model_files(parents: Sequence[str], files: Dict[str, str]) -> None:
+ """Emit event and metric tables for one model (or sys) directory."""
+ global _pending_events_tblname
+ global _pending_metrics_tblname
+ _pending_events_tblname = file_name_to_table_name('pmu_events_', parents[:-1], parents[-1])
+ _pending_metrics_tblname = file_name_to_table_name('pmu_metrics_', parents[:-1], parents[-1])
+ if parents[-1] == 'sys':
+ _sys_event_table_to_metric_table_mapping[_pending_events_tblname] = _pending_metrics_tblname
- # Ignore other directories. If the file name does not have a .json
- # extension, ignore it. It could be a readme.txt for instance.
- if not item.is_file() or not item.name.endswith('.json') or item.name.endswith('metricgroups.json'):
- return
+ for filename, path in sorted(files.items()):
+ if filename.endswith('metricgroups.json'):
+ continue
+ add_events_table_entries(path, get_topic(filename))
- add_events_table_entries(item, get_topic(item.name))
+ print_pending_events()
+ print_pending_metrics()
def _metricgroup_table_fields(metric_tblname: str) -> Tuple[str, str]:
@@ -2188,25 +2213,6 @@ def main() -> None:
return path
raise argparse.ArgumentTypeError(f'\'{path}\' is not a valid directory')
- def ftw(path: str, parents: Sequence[str],
- action: Callable[[Sequence[str], os.DirEntry], None]) -> None:
- """Replicate the directory/file walking behavior of C's file tree walk."""
- assert _args is not None
- for item in sorted(os.scandir(path), key=lambda e: e.name):
- if _args.model != 'all' and item.is_dir():
- # Check if the model matches one in _args.model.
- if len(parents) == _args.model.split(',')[0].count('/'):
- # We're testing the correct directory.
- item_path = '/'.join(parents) + ('/' if len(parents) > 0 else '') + item.name
- if 'test' not in item_path and 'common' not in item_path and item_path not in _args.model.split(','):
- continue
- try:
- action(parents, item)
- except Exception as e:
- raise RuntimeError(f'Action failure for \'{item.name}\' in {parents}') from e
- if item.is_dir():
- ftw(item.path, list(parents) + [item.name], action)
-
ap = argparse.ArgumentParser()
ap.add_argument(
'--compress',
@@ -2218,6 +2224,34 @@ def main() -> None:
'blocks indexed by (block_id << 16) | sub_offset (e.g. zlib,none)'
),
)
+ ap.add_argument(
+ '--gen-dir',
+ type=dir_path,
+ default=None,
+ help=(
+ 'Optional root directory of generated JSON files laid out in the '
+ 'same <arch>/... hierarchy as starting_dir, overlaid without copying '
+ 'checked-in source JSON files'
+ ),
+ )
+ ap.add_argument(
+ '--gen-manifest',
+ default=None,
+ help=(
+ 'Optional file listing generated JSON paths relative to --gen-dir '
+ '(whitespace-separated); when given, only listed files are read '
+ 'from --gen-dir so stale files are ignored'
+ ),
+ )
+ ap.add_argument(
+ '--gen-file',
+ action='append',
+ default=[],
+ help=(
+ 'Generated JSON path relative to --gen-dir (may be repeated); '
+ 'behaves like entries in --gen-manifest'
+ ),
+ )
ap.add_argument('arch', help='Architecture name like x86')
ap.add_argument('model', help='''Select a model such as skylake to
reduce the code size. Normally set to "all". For architectures like
@@ -2232,6 +2266,9 @@ such as "arm/cortex-a34".''',
ap.add_argument('output_file', nargs='?', default=None)
ap.add_argument('output_string_file', nargs='?', default=None)
_args = ap.parse_args()
+ if (_args.gen_manifest or _args.gen_file) and not _args.gen_dir:
+ ap.error('--gen-manifest and --gen-file require --gen-dir')
+
if _args.output_file:
_args.output_file = open(_args.output_file, 'w', encoding='utf-8')
else:
@@ -2271,7 +2308,7 @@ struct pmu_table_entry {
""")
archs = []
for item in os.scandir(_args.starting_dir):
- if not item.is_dir():
+ if not item.is_dir() or not _is_valid_dir_name(item.name):
continue
if item.name == _args.arch or _args.arch == 'all' or item.name == 'test' or item.name == 'common':
archs.append(item.name)
@@ -2280,18 +2317,77 @@ struct pmu_table_entry {
raise IOError(f'Missing architecture directory \'{_args.arch}\'')
archs.sort()
- import concurrent.futures
- tasks = []
- def collect_json(parents: Sequence[str], item: os.DirEntry) -> None:
- if len(parents) == 0:
- return
- if item.is_file() and item.name.endswith('.json') and not item.name.endswith('metricgroups.json'):
- tasks.append((item.path, get_topic(item.name)))
+ arch_std_files: Dict[str, Dict[str, str]] = {arch: {} for arch in archs}
+ arch_model_files: Dict[str, Dict[Tuple[str, ...], Dict[str, str]]] = {
+ arch: collections.defaultdict(dict) for arch in archs
+ }
+
+ def scan_arch_tree(arch: str, path: str, parents: Tuple[str, ...],
+ skip_generated: bool) -> None:
+ """Populate arch_std_files and arch_model_files from a directory tree."""
+ assert _args is not None
+ for item in sorted(os.scandir(path), key=lambda e: e.name):
+ if item.is_dir():
+ if not _is_valid_dir_name(item.name):
+ continue
+ next_parents = parents + (item.name,)
+ if len(next_parents) > 4 or not _parents_match_model(next_parents, _args.model):
+ continue
+ scan_arch_tree(arch, item.path, next_parents, skip_generated)
+ elif item.is_file() and _is_valid_json_filename(item.name, skip_generated=skip_generated):
+ if len(parents) == 0:
+ arch_std_files[arch][item.name] = item.path
+ elif len(parents) <= 4:
+ arch_model_files[arch][parents][item.name] = item.path
+
+ skip_src_generated = bool(_args.gen_dir)
+ for arch in archs:
+ scan_arch_tree(arch, f'{_args.starting_dir}/{arch}', (), skip_src_generated)
+
+ if _args.gen_dir:
+ if _args.gen_manifest or _args.gen_file:
+ gen_rel_paths: list[str] = []
+ if _args.gen_manifest:
+ with open(_args.gen_manifest, encoding='utf-8') as f:
+ gen_rel_paths.extend(f.read().split())
+ gen_rel_paths.extend(_args.gen_file)
+ for raw_rel in gen_rel_paths:
+ rel_path = raw_rel.strip().replace('\\', '/')
+ if not rel_path:
+ continue
+ parts = rel_path.split('/')
+ if len(parts) < 2:
+ raise ValueError(f"Invalid generated JSON relative path '{rel_path}'")
+ arch = parts[0]
+ if arch not in arch_model_files:
+ continue
+ parents = tuple(parts[1:-1])
+ if any(not _is_valid_dir_name(p) for p in parents):
+ raise ValueError(f"Invalid generated JSON directory in '{rel_path}'")
+ filename = parts[-1]
+ if not _is_valid_json_filename(filename):
+ continue
+ full_path = os.path.join(_args.gen_dir, rel_path)
+ if not os.path.isfile(full_path):
+ raise FileNotFoundError(f"Missing generated JSON file '{full_path}'")
+ if len(parents) == 0:
+ arch_std_files[arch][filename] = full_path
+ elif len(parents) <= 4 and _parents_match_model(parents, _args.model):
+ arch_model_files[arch][parents][filename] = full_path
+ else:
+ for arch in archs:
+ gen_arch_path = f'{_args.gen_dir}/{arch}'
+ if os.path.isdir(gen_arch_path):
+ scan_arch_tree(arch, gen_arch_path, (), skip_generated=False)
+ import concurrent.futures
+ tasks: list[Tuple[str, str]] = []
for arch in archs:
- arch_path = f'{_args.starting_dir}/{arch}'
- preprocess_arch_std_files(arch_path)
- ftw(arch_path, [], collect_json)
+ preprocess_arch_std_files(arch_std_files[arch], arch)
+ for parents in sorted(arch_model_files[arch]):
+ for filename, full_path in sorted(arch_model_files[arch][parents].items()):
+ if not filename.endswith('metricgroups.json'):
+ tasks.append((full_path, get_topic(filename)))
with concurrent.futures.ProcessPoolExecutor(max_workers=_parallel_worker_count(len(tasks)),
initializer=_init_worker,
@@ -2300,8 +2396,12 @@ struct pmu_table_entry {
_json_cache[(path, topic)] = events
for arch in archs:
- arch_path = f'{_args.starting_dir}/{arch}'
- ftw(arch_path, [], preprocess_one_file)
+ for parents in sorted(arch_model_files[arch]):
+ for filename, full_path in sorted(arch_model_files[arch][parents].items()):
+ try:
+ preprocess_one_file(parents, filename, full_path)
+ except Exception as e:
+ raise RuntimeError(f"Action failure for '{filename}' in {list(parents)}") from e
assert _bcs is not None
use_blocks = bool(_args.output_string_file) and _args.compress[0] != 'none'
@@ -2352,10 +2452,8 @@ struct pmu_table_entry {
""")
_args.output_file.write('const char *pmu_events__get_string(uint32_t offset);\n\n')
for arch in archs:
- arch_path = f'{_args.starting_dir}/{arch}'
- ftw(arch_path, [], process_one_file)
- print_pending_events()
- print_pending_metrics()
+ for parents in sorted(arch_model_files[arch]):
+ process_model_files(parents, arch_model_files[arch][parents])
print_metricgroup_tables()
print_mapping_table(archs)
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/8] perf build: Avoid copying pmu-events JSON files into OUTPUT
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
2026-12-06 2:11 ` [PATCH 1/8] perf pmu-events: Ignore backup and non-event JSON files in metric.py Ian Rogers
2026-12-06 2:11 ` [PATCH 2/8] perf jevents: Support --gen-dir/--gen-manifest overlay and ignore backups Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
2026-12-06 2:11 ` [PATCH 4/8] perf pmu-events: Batch metric generation and scope via mapfile.csv Ian Rogers
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
Out-of-tree perf builds previously copied all ~1,013 checked-in JSON
and CSV files from pmu-events/arch/ into $(OUTPUT)pmu-events/arch/ via
dynamically generated Make rules solely so jevents.py could read them
alongside the 137 generated JSON files (legacy-cache.json and
extra-metric{s,groups}.json). That also required scanning $(OUT_DIR)
and running a prune_orphans rule (which needed multiple ARG_MAX fixes),
while in-tree builds wrote generated JSONs directly into
pmu-events/arch/ and forgot to remove legacy-cache.json on clean.
Write generated JSON files into GEN_DIR := $(OUTPUT)pmu-events/gen for
both in-tree and out-of-tree builds and pass them to jevents.py via
--gen-dir and --gen-manifest (or --gen-file for
test-empty-pmu-events.c):
- Remove OUT_DIR, OUT_JSON, OUT_DIRS, COPY_RULE, CUR_OUT_JSON,
ORPHAN_FILES, and prune_orphans from tools/perf/pmu-events/Build.
- Track input lists in write-if-changed manifests (jevents-gen-files,
jevents-src-files, jevents-empty-src-files) using GNU Make's built-in
$(file ...) (guarded for dry-run make -n and avoiding shell ARG_MAX)
so deleting or checking out older source JSONs triggers rebuilds for
both in-tree and out-of-tree builds, while stale files in GEN_DIR are
never read by jevents.py.
- Derive ZENS, INTELS, and ARMS from mapfile.csv instead of ls globs so
stray files or backup directories cannot be treated as CPU models, and
filter backup/hidden/generated JSONs in FIND_SRC_EXPR while preserving
valid symlinks (e.g. riscv/sifive/).
- Narrow TEST_EMPTY_PMU_EVENTS_C prerequisites to common/, test/, and
legacy-cache.json instead of all arch JSONs and metric generators.
- Simplify pmu-events-clean in tools/perf/Makefile.perf and update
tools/perf/.gitignore for pmu-events/gen/ and the manifest files.
For an out-of-tree libpmu-events.a build with default JEVENTS_ARCH=all,
COPY lines drop from 1,013 to 0, MKDIR lines from 120 to 75, and total
build log lines from 1,330 to 272 (-79.5%), while generating
byte-for-byte identical pmu-events.c and pmu-events-string.c outputs.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/.gitignore | 7 +-
tools/perf/Makefile.perf | 18 ++--
tools/perf/pmu-events/Build | 178 +++++++++++++++++-------------------
3 files changed, 95 insertions(+), 108 deletions(-)
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 8aa4ee7209c6..73edc24dbe3f 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -37,17 +37,18 @@ config.mak.autogen
util/intel-pt-decoder/inat-tables.c
arch/*/include/generated/
trace/beauty/generated/
-pmu-events/arch/common/common/legacy-cache.json
+pmu-events/gen/
pmu-events/pmu-events.c
pmu-events/pmu-events-string.c
pmu-events/jevents-flags
+pmu-events/jevents-gen-files
+pmu-events/jevents-src-files
+pmu-events/jevents-empty-src-files
pmu-events/jevents
pmu-events/metric_test.log
pmu-events/empty-pmu-events.log
pmu-events/test-empty-pmu-events.c
*.shellcheck_log
-pmu-events/arch/**/extra-metrics.json
-pmu-events/arch/**/extra-metricgroups.json
tests/shell/*.shellcheck_log
tests/shell/coresight/*.shellcheck_log
tests/shell/lib/*.shellcheck_log
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 4fc1932b5eeb..a4f9e88f40df 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1050,22 +1050,18 @@ bpf-skel-clean:
$(Q)$(MAKE) -f bpf_skel.mak clean
pmu-events-clean:
-ifeq ($(OUTPUT),)
- $(call QUIET_CLEAN, pmu-events) $(RM) \
- pmu-events/pmu-events*.c \
- pmu-events/jevents-flags \
- pmu-events/metric_test.log \
- pmu-events/test-empty-pmu-events.c \
- pmu-events/empty-pmu-events.log
- $(Q)find pmu-events/arch -name 'extra-metrics.json' -delete -o \
- -name 'extra-metricgroups.json' -delete
-else # When an OUTPUT directory is present, clean up the copied pmu-events/arch directory.
- $(call QUIET_CLEAN, pmu-events) $(RM) -r $(OUTPUT)pmu-events/arch \
+ $(call QUIET_CLEAN, pmu-events) $(RM) -r \
+ $(OUTPUT)pmu-events/gen \
$(OUTPUT)pmu-events/pmu-events*.c \
$(OUTPUT)pmu-events/jevents-flags \
+ $(OUTPUT)pmu-events/jevents-gen-files \
+ $(OUTPUT)pmu-events/jevents-src-files \
+ $(OUTPUT)pmu-events/jevents-empty-src-files \
$(OUTPUT)pmu-events/metric_test.log \
$(OUTPUT)pmu-events/test-empty-pmu-events.c \
$(OUTPUT)pmu-events/empty-pmu-events.log
+ifneq ($(OUTPUT),)
+ $(Q)$(RM) -r $(OUTPUT)pmu-events/arch
endif
clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index 32fc1378ef3a..22e4db88272f 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -65,18 +65,30 @@ endif
JEVENTS_COMPRESS_ARG := $(subst $(space),$(comma),$(strip $(JEVENTS_COMPRESS_ACTIVE)))
JEVENTS_FLAGS_STR := $(NO_JEVENTS):$(JEVENTS_ARCH):$(JEVENTS_MODEL):$(JEVENTS_COMPRESS_ARG)
-# The input json/csv files
+# The checked-in input json/csv files and the separate directory for generated
+# json files. Generated files are always written under GEN_DIR (even for
+# in-tree builds) so checked-in files never need copying into OUTPUT and the
+# source tree stays clean.
SRC_DIR := pmu-events/arch
+GEN_DIR := $(OUTPUT)pmu-events/gen
+FIND_SRC_EXPR := \( -type f -o -type l \) -not -name '.*' -not -path '*/.*' \
+ -not -path '$(SRC_DIR)/*.*/*' -not -name '*.*.json' \
+ -not -name '*_BACKUP_*.json' -not -name '*_BASE_*.json' \
+ -not -name '*_LOCAL_*.json' -not -name '*_REMOTE_*.json' \
+ -not -name 'legacy-cache.json' -not -name 'extra-metrics.json' \
+ -not -name 'extra-metricgroups.json' \
+ \( -name '*.json' -o -name '*.csv' \)
+SRC_COMMON_TEST := $(shell find $(SRC_DIR)/common $(SRC_DIR)/test $(FIND_SRC_EXPR))
ifeq ($(JEVENTS_ARCH),all)
-SRC_JSON := $(shell find $(SRC_DIR) -name '*.json' -o -name '*.csv')
+SRC_JSON := $(shell find $(SRC_DIR) $(FIND_SRC_EXPR))
else
-SRC_JSON := $(shell find $(SRC_DIR)/common $(SRC_DIR)/test $(SRC_DIR)/$(JEVENTS_ARCH) -name '*.json' -o -name '*.csv')
+SRC_JSON := $(SRC_COMMON_TEST) $(shell find $(SRC_DIR)/$(JEVENTS_ARCH) $(FIND_SRC_EXPR))
endif
# Python to build the generic legacy cache events
LEGACY_CACHE_PY = pmu-events/make_legacy_cache.py
-LEGACY_CACHE_JSON = $(OUTPUT)pmu-events/arch/common/common/legacy-cache.json
-GEN_JSON = $(LEGACY_CACHE_JSON)
+LEGACY_CACHE_JSON = $(GEN_DIR)/common/common/legacy-cache.json
+GEN_JSON := $(LEGACY_CACHE_JSON)
$(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY)
$(call rule_mkdir)
@@ -87,103 +99,95 @@ GEN_METRIC_DEPS := pmu-events/metric.py pmu-events/common_metrics.py
# Functions to extract the model from an extra-metrics.json or extra-metricgroups.json path.
model_name = $(notdir $(patsubst %/,%,$(dir $(1))))
vendor_name = $(notdir $(patsubst %/,%,$(dir $(patsubst %/,%,$(dir $(1))))))
+JEVENTS_AWK := $(or $(AWK),awk)
ifeq ($(JEVENTS_ARCH),$(filter $(JEVENTS_ARCH),x86 all))
+X86_MODELS := $(shell $(JEVENTS_AWK) -F, 'NR > 1 && $$0 !~ /^#/ && NF >= 3 { print $$3 }' $(SRC_DIR)/x86/mapfile.csv | sort -u)
+
# Generate AMD Json
-ZENS := $(shell ls -d pmu-events/arch/x86/amdzen*)
-ZEN_METRICS = $(foreach x,$(ZENS),$(OUTPUT)$(x)/extra-metrics.json)
-ZEN_METRICGROUPS = $(foreach x,$(ZENS),$(OUTPUT)$(x)/extra-metricgroups.json)
+ZENS := $(filter amdzen%,$(X86_MODELS))
+ZEN_METRICS := $(foreach x,$(ZENS),$(GEN_DIR)/x86/$(x)/extra-metrics.json)
+ZEN_METRICGROUPS := $(foreach x,$(ZENS),$(GEN_DIR)/x86/$(x)/extra-metricgroups.json)
GEN_JSON += $(ZEN_METRICS) $(ZEN_METRICGROUPS)
$(ZEN_METRICS): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) pmu-events/arch > $@
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) $(SRC_DIR) > $@
$(ZEN_METRICGROUPS): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@) pmu-events/arch > $@
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@) $(SRC_DIR) > $@
+
+# Generate Intel Json
+INTELS := $(filter-out amdzen%,$(X86_MODELS))
+INTEL_METRICS := $(foreach x,$(INTELS),$(GEN_DIR)/x86/$(x)/extra-metrics.json)
+INTEL_METRICGROUPS := $(foreach x,$(INTELS),$(GEN_DIR)/x86/$(x)/extra-metricgroups.json)
+GEN_JSON += $(INTEL_METRICS) $(INTEL_METRICGROUPS)
+
+$(INTEL_METRICS): pmu-events/intel_metrics.py $(GEN_METRIC_DEPS)
+ $(call rule_mkdir)
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) $(SRC_DIR) > $@
+$(INTEL_METRICGROUPS): pmu-events/intel_metrics.py $(GEN_METRIC_DEPS)
+ $(call rule_mkdir)
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@) $(SRC_DIR) > $@
endif
ifeq ($(JEVENTS_ARCH),$(filter $(JEVENTS_ARCH),arm64 all))
# Generate ARM Json
-ARMS := $(shell ls -d pmu-events/arch/arm64/arm/*|grep -v cmn)
-ARM_METRICS = $(foreach x,$(ARMS),$(OUTPUT)$(x)/extra-metrics.json)
-ARM_METRICGROUPS = $(foreach x,$(ARMS),$(OUTPUT)$(x)/extra-metricgroups.json)
+ARMS := $(shell $(JEVENTS_AWK) -F, 'NR > 1 && $$0 !~ /^#/ && NF >= 3 && $$3 ~ /^arm\// { print $$3 }' $(SRC_DIR)/arm64/mapfile.csv | sort -u)
+ARM_METRICS := $(foreach x,$(ARMS),$(GEN_DIR)/arm64/$(x)/extra-metrics.json)
+ARM_METRICGROUPS := $(foreach x,$(ARMS),$(GEN_DIR)/arm64/$(x)/extra-metricgroups.json)
GEN_JSON += $(ARM_METRICS) $(ARM_METRICGROUPS)
$(ARM_METRICS): pmu-events/arm64_metrics.py $(GEN_METRIC_DEPS)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call vendor_name,$@) $(call model_name,$@) pmu-events/arch > $@
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call vendor_name,$@) $(call model_name,$@) $(SRC_DIR) > $@
$(ARM_METRICGROUPS): pmu-events/arm64_metrics.py $(GEN_METRIC_DEPS)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call vendor_name,$@) $(call model_name,$@) pmu-events/arch > $@
-
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call vendor_name,$@) $(call model_name,$@) $(SRC_DIR) > $@
endif
-ifeq ($(JEVENTS_ARCH),$(filter $(JEVENTS_ARCH),x86 all))
-# Generate Intel Json
-INTELS := $(shell ls -d pmu-events/arch/x86/*|grep -v amdzen|grep -v mapfile.csv)
-INTEL_METRICS = $(foreach x,$(INTELS),$(OUTPUT)$(x)/extra-metrics.json)
-INTEL_METRICGROUPS = $(foreach x,$(INTELS),$(OUTPUT)$(x)/extra-metricgroups.json)
-GEN_JSON += $(INTEL_METRICS) $(INTEL_METRICGROUPS)
+# Track input file lists via write-if-changed manifests using GNU Make's
+# $(file ...) built-in (avoids shell ARG_MAX limits). Updating the manifest
+# ensures deleting or checking out older source files still triggers a rebuild,
+# and passing the generated-file manifest to jevents.py ensures stale files in
+# $(GEN_DIR) are never read.
+define _jevents_nl
-$(INTEL_METRICS): pmu-events/intel_metrics.py $(GEN_METRIC_DEPS)
- $(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) pmu-events/arch > $@
-$(INTEL_METRICGROUPS): pmu-events/intel_metrics.py $(GEN_METRIC_DEPS)
- $(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@) pmu-events/arch > $@
+endef
-endif
+PMU_EVENTS_OUT_DIR := $(OUTPUT)pmu-events
+$(PMU_EVENTS_OUT_DIR):
+ $(Q)mkdir -p $@
-OUT_DIR := $(OUTPUT)pmu-events/arch
+GEN_JSON_REL := $(patsubst $(GEN_DIR)/%,%,$(sort $(GEN_JSON)))
+JEVENTS_GEN_MANIFEST := $(OUTPUT)pmu-events/jevents-gen-files
+JEVENTS_SRC_MANIFEST := $(OUTPUT)pmu-events/jevents-src-files
+JEVENTS_EMPTY_SRC_MANIFEST := $(OUTPUT)pmu-events/jevents-empty-src-files
-ifeq ($(OUTPUT),)
-OUT_JSON := $(SRC_JSON)
-ORPHAN_FILES :=
-else
-# Things that need to be built in the OUTPUT directory. Note, ensure
-# there is a slash after the directory name so that it matches what
-# $(dir) gives in COPY_RULE.
-OUT_JSON := $(patsubst $(SRC_DIR)/%,$(OUT_DIR)/%,$(SRC_JSON))
-OUT_DIRS := $(sort $(patsubst %/,%,$(dir $(OUT_JSON))))
-
-# Things already in the OUTPUT directory
-CUR_OUT_JSON := $(shell [ -d $(OUT_DIR) ] && find $(OUT_DIR) -type f)
-
-# Things in the OUTPUT directory but shouldn't be there as computed by
-# OUT_JSON and GEN_JSON.
-
-ORPHAN_FILES := $(filter-out $(OUT_JSON) $(GEN_JSON),$(CUR_OUT_JSON))
-
-# Message for $(call echo-cmd,mkd). There is already a mkdir message
-# but it assumes $@ is a file to mkdir the directory for.
-quiet_cmd_mkd = MKDIR $@
-
-$(OUT_DIRS):
- $(Q)$(call echo-cmd,mkd)mkdir -p $@
-
-# Explicitly generate rules to copy SRC_JSON files as $(dir) cannot
-# apply to $@ in a dependency. Exclude from the copy rules any that
-# look like they are copying generated json. This happens as a perf
-# build within the tools/perf directory will leave generated json
-# files within the tree, these then get picked up by SRC_JSON find.
-define COPY_RULE
-$(2): $(1) | $(3)
- $$(Q)$$(call echo-cmd,cp)cp $(1) $(2)
-endef
-$(foreach src,$(SRC_JSON), \
- $(eval dest := $(patsubst $(SRC_DIR)/%,$(OUT_DIR)/%,$(src))) \
- $(eval ddir := $(patsubst %/,%,$(dir $(dest)))) \
- $(if $(filter $(dest),$(GEN_JSON)),, \
- $(eval $(call COPY_RULE,$(src),$(dest),$(ddir))) \
- ) \
-)
+$(JEVENTS_GEN_MANIFEST): FORCE | $(PMU_EVENTS_OUT_DIR)
+ $(if $(findstring n,$(firstword -$(MAKEFLAGS))),,$(file > $@.tmp,$(subst $(space),$(_jevents_nl),$(strip $(GEN_JSON_REL)))))@if cmp -s $@.tmp $@ 2>/dev/null; then \
+ rm -f $@.tmp; \
+ else \
+ mv -f $@.tmp $@; \
+ fi
-endif # ifneq ($(OUTPUT),)
+$(JEVENTS_SRC_MANIFEST): FORCE | $(PMU_EVENTS_OUT_DIR)
+ $(if $(findstring n,$(firstword -$(MAKEFLAGS))),,$(file > $@.tmp,$(subst $(space),$(_jevents_nl),$(strip $(sort $(SRC_JSON))))))@if cmp -s $@.tmp $@ 2>/dev/null; then \
+ rm -f $@.tmp; \
+ else \
+ mv -f $@.tmp $@; \
+ fi
+
+$(JEVENTS_EMPTY_SRC_MANIFEST): FORCE | $(PMU_EVENTS_OUT_DIR)
+ $(if $(findstring n,$(firstword -$(MAKEFLAGS))),,$(file > $@.tmp,$(subst $(space),$(_jevents_nl),$(strip $(sort $(SRC_COMMON_TEST))))))@if cmp -s $@.tmp $@ 2>/dev/null; then \
+ rm -f $@.tmp; \
+ else \
+ mv -f $@.tmp $@; \
+ fi
JEVENTS_PY = pmu-events/jevents.py
METRIC_PY = pmu-events/metric.py
@@ -200,41 +204,27 @@ $(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY)
TEST_EMPTY_PMU_EVENTS_C = $(OUTPUT)pmu-events/test-empty-pmu-events.c
EMPTY_PMU_EVENTS_TEST_LOG = $(OUTPUT)pmu-events/empty-pmu-events.log
-$(TEST_EMPTY_PMU_EVENTS_C): $(OUT_JSON) $(GEN_JSON) $(JEVENTS_PY) $(METRIC_PY)
+$(TEST_EMPTY_PMU_EVENTS_C): $(SRC_COMMON_TEST) $(LEGACY_CACHE_JSON) $(JEVENTS_EMPTY_SRC_MANIFEST) $(JEVENTS_PY) $(METRIC_PY)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) none none $(OUTPUT)pmu-events/arch $@
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) --gen-dir $(GEN_DIR) \
+ --gen-file common/common/legacy-cache.json none none $(SRC_DIR) $@
$(EMPTY_PMU_EVENTS_TEST_LOG): $(EMPTY_PMU_EVENTS_C) $(TEST_EMPTY_PMU_EVENTS_C)
$(call rule_mkdir)
$(Q)$(call echo-cmd,test)diff -u $^ 2> $@ || (cat $@ && false)
-
# Dependencies for jevents.py
-JEVENTS_DEPS := $(OUT_JSON) $(GEN_JSON) $(JEVENTS_PY) $(METRIC_PY) $(EMPTY_PMU_EVENTS_TEST_LOG) $(METRIC_TEST_LOG) $(JEVENTS_FLAGS_FILE)
-
-# If there are orphaned files remove them.
-ifneq ($(strip $(ORPHAN_FILES)),)
-.PHONY: prune_orphans
-
-# Message for $(call echo-cmd,rm). Generally cleaning files isn't part
-# of a build step.
-quiet_cmd_rm = RM ...$(words $^) orphan file(s)...
-
-# The list of files can be long. Remove the $(OUT_DIR)/ prefix, and
-# restore it with printf, to prevent "Argument list too long"
-# (see scripts/Makefile.clean).
-prune_orphans: $(ORPHAN_FILES)
- $(Q)$(call echo-cmd,rm)printf '$(OUT_DIR)/%s ' $(patsubst $(OUT_DIR)/%,%,$(ORPHAN_FILES)) | xargs rm -f
-
-JEVENTS_DEPS += prune_orphans
-endif
+JEVENTS_DEPS := $(SRC_JSON) $(GEN_JSON) $(JEVENTS_SRC_MANIFEST) $(JEVENTS_GEN_MANIFEST) \
+ $(JEVENTS_PY) $(METRIC_PY) $(EMPTY_PMU_EVENTS_TEST_LOG) $(METRIC_TEST_LOG) \
+ $(JEVENTS_FLAGS_FILE)
# Finally, the rule to build pmu-events.c using jevents.py. All test
# and inputs are dependencies.
$(PMU_EVENTS_C): $(JEVENTS_DEPS)
$(call rule_mkdir)
$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) --compress=$(JEVENTS_COMPRESS_ARG) \
- $(JEVENTS_ARCH) $(JEVENTS_MODEL) $(OUT_DIR) $(PMU_EVENTS_C) $(PMU_EVENTS_STRING_C)
+ --gen-dir $(GEN_DIR) --gen-manifest $(JEVENTS_GEN_MANIFEST) \
+ $(JEVENTS_ARCH) $(JEVENTS_MODEL) $(SRC_DIR) $(PMU_EVENTS_C) $(PMU_EVENTS_STRING_C)
$(PMU_EVENTS_STRING_C): $(PMU_EVENTS_C)
@:
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] perf pmu-events: Batch metric generation and scope via mapfile.csv
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
` (2 preceding siblings ...)
2026-12-06 2:11 ` [PATCH 3/8] perf build: Avoid copying pmu-events JSON files into OUTPUT Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
2026-12-06 2:11 ` [PATCH 5/8] perf build: Batch metric JSON generation in pmu-events/Build Ian Rogers
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
Previously, each architectural metric generator (amd_metrics.py,
arm64_metrics.py, intel_metrics.py) generated a single file
(extra-metrics.json or extra-metricgroups.json) for one model per
process, and metric.LoadEvents() walked the entire parent directory
("..") on every invocation to populate all_events_all_models. On x86,
that meant every AMD model parsed all Intel JSONs and every Intel model
parsed all AMD JSONs, repeated across 136 separate Python invocations.
Add mapfile.csv vendor scoping and multi-model batch helpers to
metric.py:
- MapfileVendorModels() reads arch_dir/mapfile.csv and returns only
models belonging to the same vendor (by vendor subdirectory prefix
such as "arm/" on arm64, or by CPUID prefix such as "AuthenticAMD" /
"GenuineIntel" on x86).
- LoadAllModelEvents() collects EventName/ArchStdEvent names across
those vendor-scoped model directories so AMD and Intel no longer load
each other's event tables.
- LoadEvents() clears all_pmus and experimental_events before loading a
model so repeated calls in one process do not leak state, accepts an
optional preloaded_all_events set, and automatically applies
mapfile.csv vendor scoping when called standalone.
- WriteMetricsOutput() writes both extra-metrics.json and
extra-metricgroups.json for a model in one pass.
Extend amd_metrics.py, arm64_metrics.py, and intel_metrics.py with an
--output-dir option accepting a comma-separated list of models while
preserving the existing single-model stdout CLI unchanged. Add unit
tests for mapfile vendor scoping and LoadEvents() state isolation in
metric_test.py.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/amd_metrics.py | 70 ++++++++-----
tools/perf/pmu-events/arm64_metrics.py | 45 +++++---
tools/perf/pmu-events/intel_metrics.py | 87 ++++++++++------
tools/perf/pmu-events/metric.py | 139 +++++++++++++++++++++----
tools/perf/pmu-events/metric_test.py | 65 ++++++++++++
5 files changed, 312 insertions(+), 94 deletions(-)
diff --git a/tools/perf/pmu-events/amd_metrics.py b/tools/perf/pmu-events/amd_metrics.py
index 42569b9153f4..3768fa875cd5 100755
--- a/tools/perf/pmu-events/amd_metrics.py
+++ b/tools/perf/pmu-events/amd_metrics.py
@@ -6,8 +6,9 @@ import os
from typing import Optional, Union
from common_metrics import Cycles
from metric import (d_ratio, has_event, max, Event, JsonEncodeMetric,
- JsonEncodeMetricGroupDescriptions, Literal, LoadEvents,
- Metric, MetricGroup, Select)
+ JsonEncodeMetricGroupDescriptions, Literal,
+ LoadAllModelEvents, LoadEvents, Metric, MetricGroup,
+ Select, WriteMetricsOutput)
# Global command line arguments.
_args = None
@@ -496,7 +497,6 @@ def UncoreL3():
def main() -> None:
global _args
- global _zen_model
def dir_path(path: str) -> str:
"""Validate path is a directory for argparse."""
@@ -508,37 +508,55 @@ def main() -> None:
parser = argparse.ArgumentParser(description="AMD perf json generator")
parser.add_argument(
"-metricgroups", help="Generate metricgroups data", action='store_true')
- parser.add_argument("model", help="e.g. amdzen[123]")
+ parser.add_argument(
+ "--output-dir",
+ default=None,
+ help="Write both extra-metrics.json and extra-metricgroups.json under this root directory")
+ parser.add_argument("model", help="e.g. amdzen[123] (comma-separated with --output-dir)")
parser.add_argument(
'events_path',
type=dir_path,
help='Root of tree containing architecture directories containing json files'
)
_args = parser.parse_args()
+ if _args.output_dir and _args.metricgroups:
+ parser.error("--output-dir cannot be combined with -metricgroups")
+ if not _args.output_dir and "," in _args.model:
+ parser.error("Multiple comma-separated models require --output-dir")
+
+ def generate_model(model: str, preloaded_all_events=None) -> MetricGroup:
+ global _zen_model
+ _args.model = model
+ directory = f"{_args.events_path}/x86/{model}/"
+ LoadEvents(directory, preloaded_all_events=preloaded_all_events)
+ _zen_model = int(model[6:])
+ return MetricGroup("", [
+ AmdBr(),
+ AmdCtxSw(),
+ AmdDtlb(),
+ AmdIotlb(),
+ AmdItlb(),
+ AmdLdSt(),
+ AmdUpc(),
+ Cycles(),
+ Idle(),
+ Rapl(),
+ UncoreL3(),
+ ])
- directory = f"{_args.events_path}/x86/{_args.model}/"
- LoadEvents(directory)
-
- _zen_model = int(_args.model[6:])
-
- all_metrics = MetricGroup("", [
- AmdBr(),
- AmdCtxSw(),
- AmdDtlb(),
- AmdIotlb(),
- AmdItlb(),
- AmdLdSt(),
- AmdUpc(),
- Cycles(),
- Idle(),
- Rapl(),
- UncoreL3(),
- ])
-
- if _args.metricgroups:
- print(JsonEncodeMetricGroupDescriptions(all_metrics))
+ if _args.output_dir:
+ models = [m.strip() for m in _args.model.split(",") if m.strip()]
+ if models:
+ preloaded = LoadAllModelEvents(f"{_args.events_path}/x86", models[0])
+ for model in models:
+ WriteMetricsOutput(_args.output_dir, f"x86/{model}",
+ generate_model(model, preloaded))
else:
- print(JsonEncodeMetric(all_metrics))
+ all_metrics = generate_model(_args.model)
+ if _args.metricgroups:
+ print(JsonEncodeMetricGroupDescriptions(all_metrics))
+ else:
+ print(JsonEncodeMetric(all_metrics))
if __name__ == '__main__':
diff --git a/tools/perf/pmu-events/arm64_metrics.py b/tools/perf/pmu-events/arm64_metrics.py
index 4ecda96d11fa..6fb7068c0051 100755
--- a/tools/perf/pmu-events/arm64_metrics.py
+++ b/tools/perf/pmu-events/arm64_metrics.py
@@ -2,8 +2,9 @@
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
import argparse
import os
-from metric import (JsonEncodeMetric, JsonEncodeMetricGroupDescriptions, LoadEvents,
- MetricGroup)
+from metric import (JsonEncodeMetric, JsonEncodeMetricGroupDescriptions,
+ LoadAllModelEvents, LoadEvents, MetricGroup,
+ WriteMetricsOutput)
from common_metrics import Cycles
# Global command line arguments.
@@ -23,26 +24,46 @@ def main() -> None:
parser = argparse.ArgumentParser(description="ARM perf json generator")
parser.add_argument(
"-metricgroups", help="Generate metricgroups data", action='store_true')
+ parser.add_argument(
+ "--output-dir",
+ default=None,
+ help="Write both extra-metrics.json and extra-metricgroups.json under this root directory")
parser.add_argument("vendor", help="e.g. arm")
- parser.add_argument("model", help="e.g. neoverse-n1")
+ parser.add_argument("model", help="e.g. neoverse-n1 (comma-separated with --output-dir)")
parser.add_argument(
'events_path',
type=dir_path,
help='Root of tree containing architecture directories containing json files'
)
_args = parser.parse_args()
+ if _args.output_dir and _args.metricgroups:
+ parser.error("--output-dir cannot be combined with -metricgroups")
+ if not _args.output_dir and "," in _args.model:
+ parser.error("Multiple comma-separated models require --output-dir")
- directory = f"{_args.events_path}/arm64/{_args.vendor}/{_args.model}/"
- LoadEvents(directory)
-
- all_metrics = MetricGroup("", [
- Cycles(),
- ])
+ def generate_model(model: str, preloaded_all_events=None) -> MetricGroup:
+ _args.model = model
+ directory = f"{_args.events_path}/arm64/{_args.vendor}/{model}/"
+ LoadEvents(directory, preloaded_all_events=preloaded_all_events)
+ return MetricGroup("", [
+ Cycles(),
+ ])
- if _args.metricgroups:
- print(JsonEncodeMetricGroupDescriptions(all_metrics))
+ if _args.output_dir:
+ models = [m.strip() for m in _args.model.split(",") if m.strip()]
+ if models:
+ preloaded = LoadAllModelEvents(
+ f"{_args.events_path}/arm64",
+ f"{_args.vendor}/{models[0]}")
+ for model in models:
+ WriteMetricsOutput(_args.output_dir, f"arm64/{_args.vendor}/{model}",
+ generate_model(model, preloaded))
else:
- print(JsonEncodeMetric(all_metrics))
+ all_metrics = generate_model(_args.model)
+ if _args.metricgroups:
+ print(JsonEncodeMetricGroupDescriptions(all_metrics))
+ else:
+ print(JsonEncodeMetric(all_metrics))
if __name__ == '__main__':
diff --git a/tools/perf/pmu-events/intel_metrics.py b/tools/perf/pmu-events/intel_metrics.py
index 4fd5c1de4333..62881509d38c 100755
--- a/tools/perf/pmu-events/intel_metrics.py
+++ b/tools/perf/pmu-events/intel_metrics.py
@@ -9,8 +9,9 @@ from typing import Optional, Union
from common_metrics import Cycles
from metric import (d_ratio, has_event, max, aggr_nr, CheckPmu, Constant, Event,
Expression, JsonEncodeMetric, JsonEncodeMetricGroupDescriptions,
- Literal, LoadEvents, Metric, MetricConstraint, MetricGroup,
- MetricRef, Select)
+ Literal, LoadAllModelEvents, LoadEvents, Metric,
+ MetricConstraint, MetricGroup, MetricRef, Select,
+ WriteMetricsOutput)
# Global command line arguments.
_args = None
@@ -1139,46 +1140,64 @@ def main() -> None:
parser = argparse.ArgumentParser(description="Intel perf json generator")
parser.add_argument(
"-metricgroups", help="Generate metricgroups data", action='store_true')
- parser.add_argument("model", help="e.g. skylakex")
+ parser.add_argument(
+ "--output-dir",
+ default=None,
+ help="Write both extra-metrics.json and extra-metricgroups.json under this root directory")
+ parser.add_argument("model", help="e.g. skylakex (comma-separated with --output-dir)")
parser.add_argument(
'events_path',
type=dir_path,
help='Root of tree containing architecture directories containing json files'
)
_args = parser.parse_args()
+ if _args.output_dir and _args.metricgroups:
+ parser.error("--output-dir cannot be combined with -metricgroups")
+ if not _args.output_dir and "," in _args.model:
+ parser.error("Multiple comma-separated models require --output-dir")
+
+ def generate_model(model: str, preloaded_all_events=None) -> MetricGroup:
+ _args.model = model
+ directory = f"{_args.events_path}/x86/{model}/"
+ LoadEvents(directory, preloaded_all_events=preloaded_all_events)
+ return MetricGroup("", [
+ Cycles(),
+ Idle(),
+ Rapl(),
+ Smi(),
+ Tsx(),
+ IntelBr(),
+ IntelCtxSw(),
+ IntelFpu(),
+ IntelIlp(),
+ IntelIotlb(),
+ IntelL2(),
+ IntelLdSt(),
+ IntelMissLat(),
+ IntelMlp(),
+ IntelPorts(),
+ IntelSwpf(),
+ UncoreCState(),
+ UncoreDir(),
+ UncoreMem(),
+ UncoreMemBw(),
+ UncoreMemSat(),
+ UncoreUpiBw(),
+ ])
- directory = f"{_args.events_path}/x86/{_args.model}/"
- LoadEvents(directory)
-
- all_metrics = MetricGroup("", [
- Cycles(),
- Idle(),
- Rapl(),
- Smi(),
- Tsx(),
- IntelBr(),
- IntelCtxSw(),
- IntelFpu(),
- IntelIlp(),
- IntelIotlb(),
- IntelL2(),
- IntelLdSt(),
- IntelMissLat(),
- IntelMlp(),
- IntelPorts(),
- IntelSwpf(),
- UncoreCState(),
- UncoreDir(),
- UncoreMem(),
- UncoreMemBw(),
- UncoreMemSat(),
- UncoreUpiBw(),
- ])
-
- if _args.metricgroups:
- print(JsonEncodeMetricGroupDescriptions(all_metrics))
+ if _args.output_dir:
+ models = [m.strip() for m in _args.model.split(",") if m.strip()]
+ if models:
+ preloaded = LoadAllModelEvents(f"{_args.events_path}/x86", models[0])
+ for model in models:
+ WriteMetricsOutput(_args.output_dir, f"x86/{model}",
+ generate_model(model, preloaded))
else:
- print(JsonEncodeMetric(all_metrics))
+ all_metrics = generate_model(_args.model)
+ if _args.metricgroups:
+ print(JsonEncodeMetricGroupDescriptions(all_metrics))
+ else:
+ print(JsonEncodeMetric(all_metrics))
if __name__ == '__main__':
diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
index f7d5ab6143ee..5608d4464579 100644
--- a/tools/perf/pmu-events/metric.py
+++ b/tools/perf/pmu-events/metric.py
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
"""Parse or generate representations of perf metrics."""
import ast
+import csv
import decimal
import json
import os
@@ -32,10 +33,98 @@ def _is_valid_event_json(filename: str) -> bool:
return True
-def LoadEvents(directory: str) -> None:
+def _read_mapfile_rows(arch_dir: str) -> List[Tuple[str, str]]:
+ """Return (cpuid, model_relpath) pairs from arch_dir/mapfile.csv."""
+ mapfile = os.path.join(arch_dir, "mapfile.csv")
+ if not os.path.isfile(mapfile):
+ return []
+ rows: List[Tuple[str, str]] = []
+ with open(mapfile, encoding="utf-8") as f:
+ reader = csv.reader(f)
+ first = True
+ for row in reader:
+ if first:
+ first = False
+ continue
+ if not row or row[0].startswith("#") or len(row) < 3:
+ continue
+ rows.append((row[0], row[2]))
+ return rows
+
+
+def MapfileVendorModels(arch_dir: str, model_rel: str) -> List[str]:
+ """Return model paths in arch_dir/mapfile.csv sharing model_rel's vendor.
+
+ For vendor-subdirectory architectures (e.g. arm64 "arm/neoverse-n1"),
+ matches models under the same vendor directory prefix. For flat
+ architectures (e.g. x86 "skylake" or "amdzen4"), matches models whose
+ CPUID prefix (e.g. "GenuineIntel" or "AuthenticAMD") matches model_rel.
+ """
+ rows = _read_mapfile_rows(arch_dir)
+ if not rows:
+ return []
+ if "/" in model_rel:
+ vendor_prefix = model_rel.split("/", 1)[0] + "/"
+ return sorted({m for _, m in rows if m.startswith(vendor_prefix)})
+ vendors = {cpuid.split("-", 1)[0] for cpuid, m in rows if m == model_rel}
+ if not vendors:
+ return []
+ return sorted({m for cpuid, m in rows if cpuid.split("-", 1)[0] in vendors})
+
+
+def _load_event_names_in_dir(path_root: str) -> Set[str]:
+ """Collect EventName/ArchStdEvent entries from valid JSON files under path_root."""
+ events: Set[str] = set()
+ for root, dirs, files in os.walk(path_root):
+ dirs[:] = [d for d in dirs if not d.startswith('.') and '.' not in d]
+ for filename in files:
+ path = f"{root}/{filename}"
+ if _is_valid_event_json(filename) and os.path.isfile(path):
+ try:
+ with open(path, encoding="utf-8") as f:
+ data = json.load(f)
+ except json.decoder.JSONDecodeError:
+ # Ignore partially written JSON files if present.
+ continue
+ if not isinstance(data, list):
+ continue
+ for x in data:
+ if not isinstance(x, dict):
+ continue
+ if "EventName" in x:
+ events.add(x["EventName"])
+ elif "ArchStdEvent" in x:
+ events.add(x["ArchStdEvent"])
+ return events
+
+
+def LoadAllModelEvents(arch_dir: str,
+ model_rel: Optional[str] = None) -> Set[str]:
+ """Collect all event names across relevant models under arch_dir.
+
+ When model_rel is given and arch_dir/mapfile.csv lists models for that
+ vendor, only those vendor model directories are scanned (avoiding loading
+ AMD models on Intel and vice versa). Otherwise scans all of arch_dir.
+ """
+ if model_rel:
+ models = MapfileVendorModels(arch_dir, model_rel)
+ if models:
+ events: Set[str] = set()
+ for model in models:
+ model_dir = os.path.join(arch_dir, model)
+ if os.path.isdir(model_dir):
+ events |= _load_event_names_in_dir(model_dir)
+ return events
+ return _load_event_names_in_dir(arch_dir)
+
+
+def LoadEvents(directory: str,
+ preloaded_all_events: Optional[Set[str]] = None) -> None:
"""Populate a global set of all known events for the purpose of validating Event names"""
global all_events
global all_events_all_models
+ all_pmus.clear()
+ experimental_events.clear()
all_events = {
"context\\-switches",
"cpu\\-cycles",
@@ -66,27 +155,20 @@ def LoadEvents(directory: str) -> None:
experimental_events.add(x["EventName"])
elif "ArchStdEvent" in x:
all_events.add(x["ArchStdEvent"])
- all_events_all_models = all_events.copy()
- for root, dirs, files in os.walk(directory + ".."):
- dirs[:] = [d for d in dirs if not d.startswith('.') and '.' not in d]
- for filename in files:
- path = f"{root}/{filename}"
- if _is_valid_event_json(filename) and os.path.isfile(path):
- try:
- with open(path, encoding="utf-8") as f:
- data = json.load(f)
- except json.decoder.JSONDecodeError:
- # Ignore partially written JSON files if present.
- continue
- if not isinstance(data, list):
- continue
- for x in data:
- if not isinstance(x, dict):
- continue
- if "EventName" in x:
- all_events_all_models.add(x["EventName"])
- elif "ArchStdEvent" in x:
- all_events_all_models.add(x["ArchStdEvent"])
+ if preloaded_all_events is not None:
+ all_events_all_models = all_events | preloaded_all_events
+ else:
+ norm_dir = os.path.normpath(directory)
+ parent = os.path.dirname(norm_dir)
+ grandparent = os.path.dirname(parent)
+ if os.path.isfile(os.path.join(parent, "mapfile.csv")):
+ model_rel = os.path.basename(norm_dir)
+ all_events_all_models = all_events | LoadAllModelEvents(parent, model_rel)
+ elif os.path.isfile(os.path.join(grandparent, "mapfile.csv")):
+ model_rel = f"{os.path.basename(parent)}/{os.path.basename(norm_dir)}"
+ all_events_all_models = all_events | LoadAllModelEvents(grandparent, model_rel)
+ else:
+ all_events_all_models = all_events | LoadAllModelEvents(parent)
def CheckPmu(name: str) -> bool:
@@ -748,6 +830,19 @@ def JsonEncodeMetricGroupDescriptions(x: MetricGroup):
return json.dumps(x.ToMetricGroupDescriptions(), indent=2)
+def WriteMetricsOutput(output_dir: str, rel_model_dir: str,
+ all_metrics: MetricGroup) -> None:
+ """Write extra-metrics.json and extra-metricgroups.json for a model."""
+ model_out = os.path.join(output_dir, rel_model_dir)
+ os.makedirs(model_out, exist_ok=True)
+ with open(os.path.join(model_out, 'extra-metrics.json'), 'w',
+ encoding='utf-8') as f:
+ f.write(JsonEncodeMetric(all_metrics) + '\n')
+ with open(os.path.join(model_out, 'extra-metricgroups.json'), 'w',
+ encoding='utf-8') as f:
+ f.write(JsonEncodeMetricGroupDescriptions(all_metrics) + '\n')
+
+
class _RewriteIfExpToSelect(ast.NodeTransformer):
"""Transformer to convert if-else nodes to Select expressions."""
diff --git a/tools/perf/pmu-events/metric_test.py b/tools/perf/pmu-events/metric_test.py
index 8acfe4652b55..6fe53a9dc824 100755
--- a/tools/perf/pmu-events/metric_test.py
+++ b/tools/perf/pmu-events/metric_test.py
@@ -1,9 +1,15 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
+import os
+import tempfile
import unittest
+import metric
from metric import Constant
from metric import Event
from metric import Expression
+from metric import LoadAllModelEvents
+from metric import LoadEvents
+from metric import MapfileVendorModels
from metric import ParsePerfJson
from metric import RewriteMetricsInTermsOfOthers
@@ -168,5 +174,64 @@ class TestMetricExpressions(unittest.TestCase):
self.assertEqual(RewriteMetricsInTermsOfOthers(before), after)
Expression.__eq__ = None
+ def test_MapfileVendorScoping(self):
+ with tempfile.TemporaryDirectory() as tmp:
+ x86 = os.path.join(tmp, 'x86')
+ for d in ('amdzen1', 'amdzen2', 'skylake', 'icelake'):
+ os.makedirs(os.path.join(x86, d))
+ with open(os.path.join(x86, 'mapfile.csv'), 'w', encoding='utf-8') as f:
+ f.write('Family-model,Version,Filename,EventType\n')
+ f.write('AuthenticAMD-23-01,v1,amdzen1,core\n')
+ f.write('AuthenticAMD-23-31,v1,amdzen2,core\n')
+ f.write('GenuineIntel-6-4E,v1,skylake,core\n')
+ f.write('GenuineIntel-6-6A,v1,icelake,core\n')
+ with open(os.path.join(x86, 'amdzen1', 'core.json'), 'w', encoding='utf-8') as f:
+ f.write('[{"EventName": "AMD_EVT_1", "Unit": "amd_pmu", "Experimental": "1"}]\n')
+ with open(os.path.join(x86, 'amdzen2', 'core.json'), 'w', encoding='utf-8') as f:
+ f.write('[{"EventName": "AMD_EVT_2"}]\n')
+ with open(os.path.join(x86, 'skylake', 'core.json'), 'w', encoding='utf-8') as f:
+ f.write('[{"EventName": "INTEL_EVT_1", "Unit": "intel_pmu"}]\n')
+ with open(os.path.join(x86, 'icelake', 'core.json'), 'w', encoding='utf-8') as f:
+ f.write('[{"EventName": "INTEL_EVT_2"}]\n')
+
+ self.assertEqual(MapfileVendorModels(x86, 'amdzen1'), ['amdzen1', 'amdzen2'])
+ self.assertEqual(MapfileVendorModels(x86, 'skylake'), ['icelake', 'skylake'])
+ self.assertEqual(LoadAllModelEvents(x86, 'amdzen1'), {'AMD_EVT_1', 'AMD_EVT_2'})
+ self.assertEqual(LoadAllModelEvents(x86, 'skylake'), {'INTEL_EVT_1', 'INTEL_EVT_2'})
+
+ arm64 = os.path.join(tmp, 'arm64')
+ for d in ('arm/neoverse-n1', 'arm/neoverse-v1', 'ampere/ampereone'):
+ os.makedirs(os.path.join(arm64, d))
+ with open(os.path.join(arm64, 'mapfile.csv'), 'w', encoding='utf-8') as f:
+ f.write('MIDR,Version,JSON/file/pathname,Type\n')
+ f.write('0x410fd0c0,v1,arm/neoverse-n1,core\n')
+ f.write('0x410fd400,v1,arm/neoverse-v1,core\n')
+ f.write('0xc00fac30,v1,ampere/ampereone,core\n')
+ self.assertEqual(
+ MapfileVendorModels(arm64, 'arm/neoverse-n1'),
+ ['arm/neoverse-n1', 'arm/neoverse-v1'])
+
+ saved = (metric.all_events, metric.all_events_all_models,
+ set(metric.all_pmus), set(metric.experimental_events))
+ try:
+ LoadEvents(os.path.join(x86, 'amdzen1'))
+ self.assertIn('AMD_EVT_2', metric.all_events_all_models)
+ self.assertNotIn('INTEL_EVT_1', metric.all_events_all_models)
+ self.assertIn('amd_pmu', metric.all_pmus)
+ self.assertIn('AMD_EVT_1', metric.experimental_events)
+
+ LoadEvents(os.path.join(x86, 'skylake'))
+ self.assertIn('INTEL_EVT_2', metric.all_events_all_models)
+ self.assertNotIn('AMD_EVT_1', metric.all_events_all_models)
+ self.assertNotIn('amd_pmu', metric.all_pmus)
+ self.assertIn('intel_pmu', metric.all_pmus)
+ self.assertEqual(metric.experimental_events, set())
+ finally:
+ metric.all_events, metric.all_events_all_models = saved[0], saved[1]
+ metric.all_pmus.clear()
+ metric.all_pmus.update(saved[2])
+ metric.experimental_events.clear()
+ metric.experimental_events.update(saved[3])
+
if __name__ == '__main__':
unittest.main()
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/8] perf build: Batch metric JSON generation in pmu-events/Build
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
` (3 preceding siblings ...)
2026-12-06 2:11 ` [PATCH 4/8] perf pmu-events: Batch metric generation and scope via mapfile.csv Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
2026-12-06 2:11 ` [PATCH 6/8] perf build: Run pmu-events tests in parallel with jevents.py Ian Rogers
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
Replace the 136 per-model, per-output rules for amd_metrics.py,
intel_metrics.py, and arm64_metrics.py in tools/perf/pmu-events/Build
with three stamp-gated batch invocations using --output-dir:
- $(GEN_DIR)/x86/amd-metrics.stamp (6 AMD models, 12 JSON files)
- $(GEN_DIR)/x86/intel-metrics.stamp (42 Intel models, 84 JSON files)
- $(GEN_DIR)/arm64/arm64-metrics.stamp (20 ARM models, 40 JSON files)
Scope each stamp rule's source JSON prerequisites to its own vendor
model directories plus mapfile.csv (alongside $(JEVENTS_SRC_MANIFEST) so
file additions/deletions still retrigger generation), and move the
JEVENTS_*_MANIFEST variable definitions above the stamp rules so Make
expands them on the prerequisite lines.
On a local build, all 136 generated JSON files are produced in ~0.5 s
wall time (87 ms AMD, 121 ms ARM64, 503 ms Intel in parallel) with
byte-for-byte identical output.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/Build | 51 +++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index 22e4db88272f..c0f6855a17c9 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -85,6 +85,10 @@ else
SRC_JSON := $(SRC_COMMON_TEST) $(shell find $(SRC_DIR)/$(JEVENTS_ARCH) $(FIND_SRC_EXPR))
endif
+JEVENTS_GEN_MANIFEST := $(OUTPUT)pmu-events/jevents-gen-files
+JEVENTS_SRC_MANIFEST := $(OUTPUT)pmu-events/jevents-src-files
+JEVENTS_EMPTY_SRC_MANIFEST := $(OUTPUT)pmu-events/jevents-empty-src-files
+
# Python to build the generic legacy cache events
LEGACY_CACHE_PY = pmu-events/make_legacy_cache.py
LEGACY_CACHE_JSON = $(GEN_DIR)/common/common/legacy-cache.json
@@ -94,59 +98,65 @@ $(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY)
$(call rule_mkdir)
$(Q)$(call echo-cmd,gen)$(PYTHON) $(LEGACY_CACHE_PY) > $@
-# Python to generate architectural metrics
+# Python to generate architectural metrics (batched per generator so each
+# script parses architecture-wide event JSONs once and writes both
+# extra-metrics.json and extra-metricgroups.json for every model).
GEN_METRIC_DEPS := pmu-events/metric.py pmu-events/common_metrics.py
-# Functions to extract the model from an extra-metrics.json or extra-metricgroups.json path.
-model_name = $(notdir $(patsubst %/,%,$(dir $(1))))
-vendor_name = $(notdir $(patsubst %/,%,$(dir $(patsubst %/,%,$(dir $(1))))))
JEVENTS_AWK := $(or $(AWK),awk)
ifeq ($(JEVENTS_ARCH),$(filter $(JEVENTS_ARCH),x86 all))
X86_MODELS := $(shell $(JEVENTS_AWK) -F, 'NR > 1 && $$0 !~ /^#/ && NF >= 3 { print $$3 }' $(SRC_DIR)/x86/mapfile.csv | sort -u)
+SRC_X86_JSON := $(filter $(SRC_DIR)/x86/%,$(SRC_JSON))
# Generate AMD Json
ZENS := $(filter amdzen%,$(X86_MODELS))
+SRC_ZEN_JSON := $(foreach x,$(ZENS),$(filter $(SRC_DIR)/x86/$(x)/%,$(SRC_X86_JSON))) $(SRC_DIR)/x86/mapfile.csv
ZEN_METRICS := $(foreach x,$(ZENS),$(GEN_DIR)/x86/$(x)/extra-metrics.json)
ZEN_METRICGROUPS := $(foreach x,$(ZENS),$(GEN_DIR)/x86/$(x)/extra-metricgroups.json)
GEN_JSON += $(ZEN_METRICS) $(ZEN_METRICGROUPS)
+ZEN_METRICS_STAMP := $(GEN_DIR)/x86/amd-metrics.stamp
-$(ZEN_METRICS): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS)
+$(ZEN_METRICS_STAMP): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS) $(SRC_ZEN_JSON) $(JEVENTS_SRC_MANIFEST)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) $(SRC_DIR) > $@
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< --output-dir $(GEN_DIR) \
+ $(subst $(space),$(comma),$(strip $(ZENS))) $(SRC_DIR) && touch $@
-$(ZEN_METRICGROUPS): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS)
- $(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@) $(SRC_DIR) > $@
+$(ZEN_METRICS) $(ZEN_METRICGROUPS): $(ZEN_METRICS_STAMP)
+ @:
# Generate Intel Json
INTELS := $(filter-out amdzen%,$(X86_MODELS))
+SRC_INTEL_JSON := $(foreach x,$(INTELS),$(filter $(SRC_DIR)/x86/$(x)/%,$(SRC_X86_JSON))) $(SRC_DIR)/x86/mapfile.csv
INTEL_METRICS := $(foreach x,$(INTELS),$(GEN_DIR)/x86/$(x)/extra-metrics.json)
INTEL_METRICGROUPS := $(foreach x,$(INTELS),$(GEN_DIR)/x86/$(x)/extra-metricgroups.json)
GEN_JSON += $(INTEL_METRICS) $(INTEL_METRICGROUPS)
+INTEL_METRICS_STAMP := $(GEN_DIR)/x86/intel-metrics.stamp
-$(INTEL_METRICS): pmu-events/intel_metrics.py $(GEN_METRIC_DEPS)
+$(INTEL_METRICS_STAMP): pmu-events/intel_metrics.py $(GEN_METRIC_DEPS) $(SRC_INTEL_JSON) $(JEVENTS_SRC_MANIFEST)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) $(SRC_DIR) > $@
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< --output-dir $(GEN_DIR) \
+ $(subst $(space),$(comma),$(strip $(INTELS))) $(SRC_DIR) && touch $@
-$(INTEL_METRICGROUPS): pmu-events/intel_metrics.py $(GEN_METRIC_DEPS)
- $(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@) $(SRC_DIR) > $@
+$(INTEL_METRICS) $(INTEL_METRICGROUPS): $(INTEL_METRICS_STAMP)
+ @:
endif
ifeq ($(JEVENTS_ARCH),$(filter $(JEVENTS_ARCH),arm64 all))
# Generate ARM Json
ARMS := $(shell $(JEVENTS_AWK) -F, 'NR > 1 && $$0 !~ /^#/ && NF >= 3 && $$3 ~ /^arm\// { print $$3 }' $(SRC_DIR)/arm64/mapfile.csv | sort -u)
+SRC_ARM_JSON := $(filter $(SRC_DIR)/arm64/arm/%,$(SRC_JSON)) $(SRC_DIR)/arm64/mapfile.csv
ARM_METRICS := $(foreach x,$(ARMS),$(GEN_DIR)/arm64/$(x)/extra-metrics.json)
ARM_METRICGROUPS := $(foreach x,$(ARMS),$(GEN_DIR)/arm64/$(x)/extra-metricgroups.json)
GEN_JSON += $(ARM_METRICS) $(ARM_METRICGROUPS)
+ARM_METRICS_STAMP := $(GEN_DIR)/arm64/arm64-metrics.stamp
-$(ARM_METRICS): pmu-events/arm64_metrics.py $(GEN_METRIC_DEPS)
+$(ARM_METRICS_STAMP): pmu-events/arm64_metrics.py $(GEN_METRIC_DEPS) $(SRC_ARM_JSON) $(JEVENTS_SRC_MANIFEST)
$(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call vendor_name,$@) $(call model_name,$@) $(SRC_DIR) > $@
+ $(Q)$(call echo-cmd,gen)$(PYTHON) $< --output-dir $(GEN_DIR) arm \
+ $(subst $(space),$(comma),$(strip $(notdir $(ARMS)))) $(SRC_DIR) && touch $@
-$(ARM_METRICGROUPS): pmu-events/arm64_metrics.py $(GEN_METRIC_DEPS)
- $(call rule_mkdir)
- $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call vendor_name,$@) $(call model_name,$@) $(SRC_DIR) > $@
+$(ARM_METRICS) $(ARM_METRICGROUPS): $(ARM_METRICS_STAMP)
+ @:
endif
# Track input file lists via write-if-changed manifests using GNU Make's
@@ -164,9 +174,6 @@ $(PMU_EVENTS_OUT_DIR):
$(Q)mkdir -p $@
GEN_JSON_REL := $(patsubst $(GEN_DIR)/%,%,$(sort $(GEN_JSON)))
-JEVENTS_GEN_MANIFEST := $(OUTPUT)pmu-events/jevents-gen-files
-JEVENTS_SRC_MANIFEST := $(OUTPUT)pmu-events/jevents-src-files
-JEVENTS_EMPTY_SRC_MANIFEST := $(OUTPUT)pmu-events/jevents-empty-src-files
$(JEVENTS_GEN_MANIFEST): FORCE | $(PMU_EVENTS_OUT_DIR)
$(if $(findstring n,$(firstword -$(MAKEFLAGS))),,$(file > $@.tmp,$(subst $(space),$(_jevents_nl),$(strip $(GEN_JSON_REL)))))@if cmp -s $@.tmp $@ 2>/dev/null; then \
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 6/8] perf build: Run pmu-events tests in parallel with jevents.py
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
` (4 preceding siblings ...)
2026-12-06 2:11 ` [PATCH 5/8] perf build: Batch metric JSON generation in pmu-events/Build Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
2026-12-06 2:11 ` [PATCH 7/8] perf build: Depend on lib*-headers instead of archives in prepare Ian Rogers
2026-12-06 2:11 ` [PATCH 8/8] perf tests make: Only run shellcheck, mypy and pylint in pure builds Ian Rogers
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
Currently $(EMPTY_PMU_EVENTS_TEST_LOG) and $(METRIC_TEST_LOG) are
prerequisites of $(PMU_EVENTS_C), forcing jevents.py (and subsequent C
compilation of pmu-events.c and pmu-events-string.c) to wait for the
test-empty-pmu-events.c generation and diff check to complete first.
Move $(EMPTY_PMU_EVENTS_TEST_LOG) and $(METRIC_TEST_LOG) onto
$(OUTPUT)pmu-events/pmu-events-in.o instead so the tests run in parallel
with jevents.py and C compilation while still gating the pmu-events
link step.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/Build | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index c0f6855a17c9..1bcb88e8b0e5 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -220,13 +220,14 @@ $(EMPTY_PMU_EVENTS_TEST_LOG): $(EMPTY_PMU_EVENTS_C) $(TEST_EMPTY_PMU_EVENTS_C)
$(call rule_mkdir)
$(Q)$(call echo-cmd,test)diff -u $^ 2> $@ || (cat $@ && false)
-# Dependencies for jevents.py
+# Dependencies for jevents.py. Test logs run in parallel with jevents.py and
+# C compilation, gating pmu-events-in.o instead of pmu-events.c.
JEVENTS_DEPS := $(SRC_JSON) $(GEN_JSON) $(JEVENTS_SRC_MANIFEST) $(JEVENTS_GEN_MANIFEST) \
- $(JEVENTS_PY) $(METRIC_PY) $(EMPTY_PMU_EVENTS_TEST_LOG) $(METRIC_TEST_LOG) \
- $(JEVENTS_FLAGS_FILE)
+ $(JEVENTS_PY) $(METRIC_PY) $(JEVENTS_FLAGS_FILE)
-# Finally, the rule to build pmu-events.c using jevents.py. All test
-# and inputs are dependencies.
+$(OUTPUT)pmu-events/pmu-events-in.o: $(EMPTY_PMU_EVENTS_TEST_LOG) $(METRIC_TEST_LOG)
+
+# Finally, the rule to build pmu-events.c using jevents.py.
$(PMU_EVENTS_C): $(JEVENTS_DEPS)
$(call rule_mkdir)
$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) --compress=$(JEVENTS_COMPRESS_ARG) \
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 7/8] perf build: Depend on lib*-headers instead of archives in prepare
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
` (5 preceding siblings ...)
2026-12-06 2:11 ` [PATCH 6/8] perf build: Run pmu-events tests in parallel with jevents.py Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
2026-12-06 2:11 ` [PATCH 8/8] perf tests make: Only run shellcheck, mypy and pylint in pure builds Ian Rogers
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
All five internal tools/lib libraries (libapi, libbpf, libperf,
libsubcmd, and libsymbol) expose standalone install_headers targets that
install (and for libbpf, generate bpf_helper_defs.h) headers without
compiling any C objects. Previously, tools/perf/Makefile.perf made the
prepare target depend on the full $(LIBAPI), $(LIBPERF), $(LIBSUBCMD),
and $(LIBBPF) archives, made $(LIBPMU_EVENTS_IN) depend on $(LIBPERF),
and made $(LIBPERF_UTIL_IN) and $(LIBPERF_BENCH_IN) depend on
$(LIBSYMBOL) (since commit 96e808e5671d ("perf build: Move libsymbol
dependency out of prepare step")), serializing compilation of perf's
objects and pmu-events behind library compilation even though
compilation only needs headers.
Split out phony libapi-headers, libbpf-headers, libperf-headers,
libsubcmd-headers, and libsymbol-headers targets that run only
install_headers, and have each $(LIB*) archive target depend on its
corresponding lib*-headers target (removing install_headers from the
archive recipe so headers are installed once without racing):
- Make prepare depend on libapi-headers, libperf-headers,
libsubcmd-headers, libsymbol-headers, and (under LIBBPF_STATIC)
libbpf-headers.
- Make $(LIBPMU_EVENTS_IN) depend on libperf-headers instead of
$(LIBPERF) so pmu-events generation and compilation start immediately
in parallel with libperf and bpf-skel-prepare.
- Remove $(LIBSYMBOL) from $(LIBPERF_BENCH_IN) and $(LIBPERF_UTIL_IN)
now that prepare provides libsymbol-headers (which also fixes
single-object builds like util/symbol.o from a clean output dir).
- Update tools/perf/bpf_skel.mak so BPF object compilation depends on
$(LIBBPF_INCLUDE)/bpf/bpf_helper_defs.h (when $(LIBBPF) is set)
instead of $(LIBBPF), since $(LIBBPF) is no longer built before
util/Build and bench/Build run.
All link targets ($(OUTPUT)perf, libperf-gtk.so, perf-%, and the Python
extension) already depend on $(PERFLIBS) / $(PERFLIBS_PY), which still
depend on all full library archives.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Makefile.perf | 63 +++++++++++++++++++++++++++++-----------
tools/perf/bpf_skel.mak | 2 +-
2 files changed, 47 insertions(+), 18 deletions(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a4f9e88f40df..4e73127f08e3 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -613,7 +613,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
$(PERF_IN): prepare FORCE
$(Q)$(MAKE) $(build)=perf
-$(LIBPMU_EVENTS_IN): FORCE $(LIBPERF)
+$(LIBPMU_EVENTS_IN): FORCE libperf-headers
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events
$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
@@ -621,7 +621,7 @@ $(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
# The $(LIBPERF_UTIL) dependency is to ensure bpftool and vmlinux.h
# aren't racily built for bench/bpf_skel/bench_uprobe.bpf.c
-$(LIBPERF_BENCH_IN): FORCE prepare $(LIBSYMBOL) | $(LIBPERF_UTIL)
+$(LIBPERF_BENCH_IN): FORCE prepare | $(LIBPERF_UTIL)
$(Q)$(MAKE) $(build)=perf-bench
$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN)
@@ -639,7 +639,7 @@ $(LIBPERF_UI_IN): FORCE prepare
$(LIBPERF_UI): $(LIBPERF_UI_IN)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
-$(LIBPERF_UTIL_IN): FORCE prepare $(LIBSYMBOL)
+$(LIBPERF_UTIL_IN): FORCE prepare
$(Q)$(MAKE) $(build)=perf-util
$(LIBPERF_UTIL): $(LIBPERF_UTIL_IN)
@@ -746,12 +746,13 @@ bpf-skel-prepare:
prepare: $(OUTPUT)PERF-VERSION-FILE \
arm64-sysreg-defs \
bpf-skel-prepare \
- $(LIBAPI) \
- $(LIBPERF) \
- $(LIBSUBCMD)
+ libapi-headers \
+ libperf-headers \
+ libsubcmd-headers \
+ libsymbol-headers
ifdef LIBBPF_STATIC
-prepare: $(LIBBPF)
+prepare: libbpf-headers
endif
$(OUTPUT)%.o: %.c prepare FORCE
@@ -809,46 +810,73 @@ endif
$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
-$(LIBAPI): FORCE | $(LIBAPI_OUTPUT)
+libapi-headers: | $(LIBAPI_OUTPUT)
$(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \
OUTPUT=$(LIBAPI_OUTPUT)/ DESTDIR=$(LIBAPI_DESTDIR) prefix= subdir= \
- $@ install_headers
+ install_headers
+
+$(LIBAPI): libapi-headers FORCE | $(LIBAPI_OUTPUT)
+ $(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \
+ OUTPUT=$(LIBAPI_OUTPUT)/ DESTDIR=$(LIBAPI_DESTDIR) prefix= subdir= \
+ $@
$(LIBAPI)-clean:
$(call QUIET_CLEAN, libapi)
$(Q)$(RM) -r -- $(LIBAPI_OUTPUT)
-$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
+ifdef LIBBPF_STATIC
+libbpf-headers: | $(LIBBPF_OUTPUT)
$(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \
- EXTRA_CFLAGS="-fPIC $(EXTRA_CFLAGS)" $@ install_headers
+ install_headers
+
+$(LIBBPF): libbpf-headers FORCE | $(LIBBPF_OUTPUT)
+ $(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
+ O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \
+ EXTRA_CFLAGS="-fPIC $(EXTRA_CFLAGS)" $@
+endif
$(LIBBPF)-clean:
$(call QUIET_CLEAN, libbpf)
$(Q)$(RM) -r -- $(LIBBPF_OUTPUT)
-$(LIBPERF): FORCE | $(LIBPERF_OUTPUT)
+libperf-headers: | $(LIBPERF_OUTPUT)
$(Q)$(MAKE) -C $(LIBPERF_DIR) O=$(LIBPERF_OUTPUT) \
OUTPUT=$(LIBPERF_OUTPUT)/ DESTDIR=$(LIBPERF_DESTDIR) prefix= subdir= \
- $@ install_headers
+ install_headers
+
+$(LIBPERF): libperf-headers FORCE | $(LIBPERF_OUTPUT)
+ $(Q)$(MAKE) -C $(LIBPERF_DIR) O=$(LIBPERF_OUTPUT) \
+ OUTPUT=$(LIBPERF_OUTPUT)/ DESTDIR=$(LIBPERF_DESTDIR) prefix= subdir= \
+ $@
$(LIBPERF)-clean:
$(call QUIET_CLEAN, libperf)
$(Q)$(RM) -r -- $(LIBPERF_OUTPUT)
-$(LIBSUBCMD): FORCE | $(LIBSUBCMD_OUTPUT)
+libsubcmd-headers: | $(LIBSUBCMD_OUTPUT)
+ $(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \
+ OUTPUT=$(LIBSUBCMD_OUTPUT)/ DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= subdir= \
+ install_headers
+
+$(LIBSUBCMD): libsubcmd-headers FORCE | $(LIBSUBCMD_OUTPUT)
$(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \
OUTPUT=$(LIBSUBCMD_OUTPUT)/ DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= subdir= \
- $@ install_headers
+ $@
$(LIBSUBCMD)-clean:
$(call QUIET_CLEAN, libsubcmd)
$(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT)
-$(LIBSYMBOL): FORCE | $(LIBSYMBOL_OUTPUT)
+libsymbol-headers: | $(LIBSYMBOL_OUTPUT)
+ $(Q)$(MAKE) -C $(LIBSYMBOL_DIR) O=$(LIBSYMBOL_OUTPUT) \
+ OUTPUT=$(LIBSYMBOL_OUTPUT)/ DESTDIR=$(LIBSYMBOL_DESTDIR) prefix= subdir= \
+ install_headers
+
+$(LIBSYMBOL): libsymbol-headers FORCE | $(LIBSYMBOL_OUTPUT)
$(Q)$(MAKE) -C $(LIBSYMBOL_DIR) O=$(LIBSYMBOL_OUTPUT) \
OUTPUT=$(LIBSYMBOL_OUTPUT)/ DESTDIR=$(LIBSYMBOL_DESTDIR) prefix= subdir= \
- $@ install_headers
+ $@
$(LIBSYMBOL)-clean:
$(call QUIET_CLEAN, libsymbol)
@@ -1103,6 +1131,7 @@ FORCE:
.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: libapi-headers libbpf-headers libperf-headers libsubcmd-headers libsymbol-headers
.PHONY: python_perf_target
endif # force_fixdep
diff --git a/tools/perf/bpf_skel.mak b/tools/perf/bpf_skel.mak
index 7b7edf506509..e19ba8a49ee3 100644
--- a/tools/perf/bpf_skel.mak
+++ b/tools/perf/bpf_skel.mak
@@ -95,7 +95,7 @@ else
endif
# Consolidated Pattern rule for $(dir)/bpf_skel/
-$(SKEL_TMP_OUT)/%.bpf.o: $(srctree)/tools/perf/$(dir)/bpf_skel/%.bpf.c $(LIBBPF) $(VMLINUX_H) $(OUTPUT)PERF-VERSION-FILE util/bpf_skel/perf_version.h
+$(SKEL_TMP_OUT)/%.bpf.o: $(srctree)/tools/perf/$(dir)/bpf_skel/%.bpf.c $(if $(LIBBPF),$(LIBBPF_INCLUDE)/bpf/bpf_helper_defs.h) $(VMLINUX_H) $(OUTPUT)PERF-VERSION-FILE util/bpf_skel/perf_version.h
$(call rule_mkdir)
$(QUIET_BPF_CC)
$(Q)$(BPF_CC) -g -O2 \
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 8/8] perf tests make: Only run shellcheck, mypy and pylint in pure builds
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
` (6 preceding siblings ...)
2026-12-06 2:11 ` [PATCH 7/8] perf build: Depend on lib*-headers instead of archives in prepare Ian Rogers
@ 2026-12-06 2:11 ` Ian Rogers
7 siblings, 0 replies; 9+ messages in thread
From: Ian Rogers @ 2026-12-06 2:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Jiri Olsa, Adrian Hunter, James Clark, linux-perf-users,
linux-kernel, Ian Rogers
tools/perf/Makefile.perf automatically enables SHELLCHECK, MYPY and
PYLINT whenever those tools are found on PATH and attaches all of their
check targets to 'all'. Because none of the other build configurations
in tools/perf/tests/make change the shell scripts or Python files being
checked (beyond NO_JEVENTS=1 skipping pmu-events/*.py, which is already
checked by the default build), build-test was repeating hundreds of
identical shellcheck, mypy and pylint invocations on every build target.
Pass NO_SHELLCHECK=1 NO_MYPY=1 NO_PYLINT=1 to every build target in
tools/perf/tests/make except make_pure and make_pure_O (including
make_with_gtk4, make_static, make_kernelsrc and make_kernelsrc_tools).
This keeps full linter coverage once in out-of-tree builds (make_pure_O,
exercised by build-test and build-test-tarball) and once in in-tree
builds (make_pure), while eliminating redundant linter runs and version
probing across all other configurations.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/make | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 491a0813b630..dbb6407d0506 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -394,11 +394,16 @@ MAKEFLAGS := --no-print-directory
clean := @(cd $(PERF); $(MAKE_F) -s $(O_OPT) clean >/dev/null && $(MAKE) -s $(O_OPT) -C ../build clean >/dev/null)
+# Only run shellcheck, mypy and pylint in the pure build so build-test doesn't
+# repeat identical static checks on every build configuration.
+NO_LINT_OPT := NO_SHELLCHECK=1 NO_MYPY=1 NO_PYLINT=1
+lint_opt = $(if $(filter make_pure make_pure_O,$1),,$(NO_LINT_OPT))
+
$(run):
$(call clean)
+@TMP_DEST=$$(mktemp -d); \
trap 'rm -rf $@ $$TMP_DEST; exit 130' INT TERM; \
- cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
+ cmd="cd $(PERF) && $(MAKE_F) $($@) $(call lint_opt,$@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1; \
echo " test: $(call test,$@)" >> $@ 2>&1; \
@@ -409,7 +414,7 @@ make_with_gtk4:
$(call clean)
+@TMP_DEST=$$(mktemp -d); \
trap 'rm -rf $@ $$TMP_DEST; exit 130' INT TERM; \
- cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
+ cmd="cd $(PERF) && $(MAKE_F) $($@) $(NO_LINT_OPT) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1; \
echo " test: $(call test,$@)" >> $@ 2>&1; \
@@ -420,7 +425,7 @@ make_static:
$(call clean)
+@TMP_DEST=$$(mktemp -d); \
trap 'rm -rf $@ $$TMP_DEST; exit 130' INT TERM; \
- cmd="cd $(PERF) && $(MAKE_F) $($@) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
+ cmd="cd $(PERF) && $(MAKE_F) $($@) $(NO_LINT_OPT) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST"; \
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1; \
echo " test: $(call test,$@)" >> $@ 2>&1; \
@@ -434,7 +439,7 @@ endif
+@TMP_O=$$(mktemp -d); \
TMP_DEST=$$(mktemp -d); \
trap 'rm -rf $@ $$TMP_O $$TMP_DEST; exit 130' INT TERM; \
- cmd="cd $(PERF) && $(MAKE_F) $($(patsubst %_O,%,$@)) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST"; \
+ cmd="cd $(PERF) && $(MAKE_F) $($(patsubst %_O,%,$@)) $(call lint_opt,$@) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST"; \
printf "%*.*s: %s\n" $(max_width) $(max_width) "$@" "$$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1 && \
echo " test: $(call test_O,$@)" >> $@ 2>&1; \
@@ -453,15 +458,15 @@ ifneq ($(O),)
endif
make_kernelsrc:
- @echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf"
+ @echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) $(NO_LINT_OPT) tools/perf"
$(call clean); \
- ($(MAKE) -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \
+ ($(MAKE) -C ../.. $(PARALLEL_OPT) $(K_O_OPT) $(NO_LINT_OPT) tools/perf) > $@ 2>&1 && \
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
make_kernelsrc_tools:
- @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf"
+ @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) $(NO_LINT_OPT) perf"
$(call clean); \
- ($(MAKE) -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
+ ($(MAKE) -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) $(NO_LINT_OPT) perf) > $@ 2>&1 && \
test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
make_libperf:
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-12-06 2:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-06 2:11 [PATCH 0/8] perf build: Avoid pmu-events copies and improve build parallelism Ian Rogers
2026-12-06 2:11 ` [PATCH 1/8] perf pmu-events: Ignore backup and non-event JSON files in metric.py Ian Rogers
2026-12-06 2:11 ` [PATCH 2/8] perf jevents: Support --gen-dir/--gen-manifest overlay and ignore backups Ian Rogers
2026-12-06 2:11 ` [PATCH 3/8] perf build: Avoid copying pmu-events JSON files into OUTPUT Ian Rogers
2026-12-06 2:11 ` [PATCH 4/8] perf pmu-events: Batch metric generation and scope via mapfile.csv Ian Rogers
2026-12-06 2:11 ` [PATCH 5/8] perf build: Batch metric JSON generation in pmu-events/Build Ian Rogers
2026-12-06 2:11 ` [PATCH 6/8] perf build: Run pmu-events tests in parallel with jevents.py Ian Rogers
2026-12-06 2:11 ` [PATCH 7/8] perf build: Depend on lib*-headers instead of archives in prepare Ian Rogers
2026-12-06 2:11 ` [PATCH 8/8] perf tests make: Only run shellcheck, mypy and pylint in pure builds Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®