]> git.ipfire.org Git - thirdparty/linux.git/commit
libbpf: Add the ability to suppress perf event enablement
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 6 Aug 2025 16:22:41 +0000 (18:22 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 7 Aug 2025 16:01:41 +0000 (09:01 -0700)
commit9474e27a24a41e55d0ac2b77d8171fddec7dbb87
treeebc01697c97408eaf8e24073cb5c1d913af08fe3
parent1b30d44417278196a90c79244bb43e8428586345
libbpf: Add the ability to suppress perf event enablement

Automatically enabling a perf event after attaching a BPF prog to it is
not always desirable.

Add a new "dont_enable" field to struct bpf_perf_event_opts. While
introducing "enable" instead would be nicer in that it would avoid
a double negation in the implementation, it would make
DECLARE_LIBBPF_OPTS() less efficient.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Suggested-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Co-developed-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20250806162417.19666-2-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h