]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf stat: Add/fix bperf cgroup max events workarounds
authorIan Rogers <irogers@google.com>
Sat, 25 Oct 2025 20:28:34 +0000 (13:28 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Sat, 25 Oct 2025 23:44:21 +0000 (16:44 -0700)
commitbe806f06adfb2ec587b3b1076d1812b1f1032ac2
tree4d84a89fb797f9ab7a8b89480f652a3891ac0a34
parent3e98f0203e10bc9d379852faf424f769ef5049a6
perf stat: Add/fix bperf cgroup max events workarounds

Commit b8308511f6e0 bumped the max events to 1024 but this results in
BPF verifier issues if the number of command line events is too
large. Workaround this by:

1) moving the constants to a header file to share between BPF and perf
   C code,
2) testing that the maximum number of events doesn't cause BPF
   verifier issues in debug builds,
3) lower the max events from 1024 to 128,
4) in perf stat, if there are more events than the BPF counters can
   support then disable BPF counter usage.

The rodata setup is factored into its own function to avoid
duplicating it in the testing code.

Signed-off-by: Ian Rogers <irogers@google.com>
Fixes: b8308511f6e0 ("perf stat bperf cgroup: Increase MAX_EVENTS from 32 to 1024")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-stat.c
tools/perf/util/bpf_counter_cgroup.c
tools/perf/util/bpf_skel/bperf_cgroup.bpf.c
tools/perf/util/bpf_skel/bperf_cgroup.h [new file with mode: 0644]