diff options
author | Daniel T. Lee <danieltimlee@gmail.com> | 2020-03-21 19:04:24 +0900 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-03-23 22:27:57 +0100 |
commit | aa5e2af660fc6e35b9518d68dd7e1bb736e9f7e7 (patch) | |
tree | f99d5a219ca3d9f2026770dae2c1a7930eba071e /Documentation/bpf | |
parent | 24a6034acc922f1f6292636be4ec4dc3d9b4d2d7 (diff) | |
download | linux-aa5e2af660fc6e35b9518d68dd7e1bb736e9f7e7.tar.bz2 |
samples, bpf: Refactor perf_event user program with libbpf bpf_link
The bpf_program__attach of libbpf(using bpf_link) is much more intuitive
than the previous method using ioctl.
bpf_program__attach_perf_event manages the enable of perf_event and
attach of BPF programs to it, so there's no neeed to do this
directly with ioctl.
In addition, bpf_link provides consistency in the use of API because it
allows disable (detach, destroy) for multiple events to be treated as
one bpf_link__destroy. Also, bpf_link__destroy manages the close() of
perf_event fd.
This commit refactors samples that attach the bpf program to perf_event
by using libbbpf instead of ioctl. Also the bpf_load in the samples were
removed and migrated to use libbbpf API.
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200321100424.1593964-3-danieltimlee@gmail.com
Diffstat (limited to 'Documentation/bpf')
0 files changed, 0 insertions, 0 deletions