mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
Commitb8308511f6bumped 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:b8308511f6("perf stat bperf cgroup: Increase MAX_EVENTS from 32 to 1024") Signed-off-by: Namhyung Kim <namhyung@kernel.org>
16 lines
568 B
C
16 lines
568 B
C
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
|
|
/* Data structures shared between BPF and tools. */
|
|
#ifndef __BPERF_CGROUP_H
|
|
#define __BPERF_CGROUP_H
|
|
|
|
// These constants impact code size of bperf_cgroup.bpf.c that may result in BPF
|
|
// verifier issues. They are exposed to control the size and also to disable BPF
|
|
// counters when the number of user events is too large.
|
|
|
|
// max cgroup hierarchy level: arbitrary
|
|
#define BPERF_CGROUP__MAX_LEVELS 10
|
|
// max events per cgroup: arbitrary
|
|
#define BPERF_CGROUP__MAX_EVENTS 128
|
|
|
|
#endif /* __BPERF_CGROUP_H */
|