mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Currently, jevents.py emits both the massive 2.8 MB big_c_string literal
and tens of thousands of compact_pmu_event struct arrays into a single
pmu-events.c compilation unit. Compiling this giant file takes ~2.2 seconds
on a single CPU core during Kbuild startup.
Refactor jevents.py to emit big_c_string into a dedicated
pmu-events-string.c compilation unit. This allows Kbuild to compile
pmu-events.o and pmu-events-string.o simultaneously in parallel across
two separate CPU cores, preserving 100% string deduplication and zero
dynamic ELF relocations while cutting C compilation latency in half.
Add pmu-events-string.c to tools/perf/.gitignore to ensure in-tree Kbuild
runs do not leave untracked generated files in the working directory.
To guarantee 100% backward compatibility with GNU Make 4.0+ (avoiding the
Make 4.3+ grouped target &: syntax which causes older Make versions like
4.2.1 to spawn multiple concurrent jevents.py processes during parallel
builds), implement a robust dependency chaining pattern:
$(PMU_EVENTS_C): $(JEVENTS_DEPS)
$(PMU_EVENTS_STRING_C): $(PMU_EVENTS_C)
@:
This ensures jevents.py is invoked exactly once. If jevents.py aborts
early, Make's .DELETE_ON_ERROR: purges pmu-events.c, guaranteeing that
subsequent Make invocations correctly re-execute the script and overwrite
pmu-events-string.c. In jevents.py, explicitly close output_file first
and output_string_file second at the tail of main() to guarantee that
pmu-events-string.c receives a filesystem timestamp greater than or equal
to pmu-events.c, completely avoiding redundant incremental rebuilds.
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Gemini:gemini-3.1-pro-preview
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: James Clark <james.clark@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Ankur Arora <ankur.a.arora@oracle.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: Costa Shulyupin <costa.shul@redhat.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: David Sterba <dsterba@suse.com>
Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Markus Mayer <mmayer@broadcom.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <qmo@kernel.org>
Cc: Ricky Ringler <ricky.ringler@proton.me>
Cc: Song Liu <song@kernel.org>
Cc: Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tomas Glozar <tglozar@redhat.com>
Cc: Yonghong Song <yonghong.song@linux.dev>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
61 lines
1.0 KiB
Plaintext
61 lines
1.0 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0-only
|
|
PERF-CFLAGS
|
|
PERF-GUI-VARS
|
|
PERF-VERSION-FILE
|
|
FEATURE-DUMP
|
|
perf
|
|
!include/perf/
|
|
perf-read-vdso32
|
|
perf-read-vdsox32
|
|
perf-help
|
|
perf-record
|
|
perf-report
|
|
perf-stat
|
|
perf-top
|
|
perf*.1
|
|
perf*.xml
|
|
perf*.html
|
|
common-cmds.h
|
|
perf*.data
|
|
perf*.data.old
|
|
output.svg
|
|
perf-archive
|
|
perf-iostat
|
|
tags
|
|
TAGS
|
|
stats-*.csv
|
|
cscope*
|
|
config.mak
|
|
config.mak.autogen
|
|
*-bison.*
|
|
*-flex.*
|
|
*.pyc
|
|
*.pyo
|
|
*.stdout
|
|
.config-detected
|
|
util/intel-pt-decoder/inat-tables.c
|
|
arch/*/include/generated/
|
|
trace/beauty/generated/
|
|
pmu-events/arch/common/common/legacy-cache.json
|
|
pmu-events/pmu-events.c
|
|
pmu-events/pmu-events-string.c
|
|
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
|
|
feature/
|
|
libapi/
|
|
libbpf/
|
|
libperf/
|
|
libsubcmd/
|
|
libsymbol/
|
|
fixdep
|
|
Documentation/doc.dep
|
|
python_ext_build/
|