samples: bpf: Refactor kprobe tracing programs with libbpf
authorDaniel T. Lee <danieltimlee@gmail.com>
Sun, 23 Aug 2020 08:53:33 +0000 (17:53 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 25 Aug 2020 03:59:35 +0000 (20:59 -0700)
commit3677d0a13171bb1dc8db0af84d48dea14a899962
tree3de96b317e44d7e1eb175a4be093101f317e88ff
parent35a8b6dd339f04cbcb0b2d085334263542a12b70
samples: bpf: Refactor kprobe tracing programs with libbpf

For the problem of increasing fragmentation of the bpf loader programs,
instead of using bpf_loader.o, which is used in samples/bpf, this
commit refactors the existing kprobe tracing programs with libbbpf
bpf loader.

    - For kprobe events pointing to system calls, the SYSCALL() macro in
    trace_common.h was used.
    - Adding a kprobe event and attaching a bpf program to it was done
    through bpf_program_attach().
    - Instead of using the existing BPF MAP definition, MAP definition
    has been refactored with the new BTF-defined MAP format.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200823085334.9413-3-danieltimlee@gmail.com
samples/bpf/Makefile
samples/bpf/lathist_kern.c
samples/bpf/lathist_user.c
samples/bpf/spintest_kern.c
samples/bpf/spintest_user.c
samples/bpf/test_current_task_under_cgroup_kern.c
samples/bpf/test_current_task_under_cgroup_user.c
samples/bpf/test_probe_write_user_kern.c
samples/bpf/test_probe_write_user_user.c
samples/bpf/trace_output_kern.c
samples/bpf/trace_output_user.c