mbox series

[bpf-next,0/3] samples: bpf: Refactor tracing programs with libbpf

Message ID 20200823085334.9413-1-danieltimlee@gmail.com
Headers show
Series samples: bpf: Refactor tracing programs with libbpf | expand

Message

Daniel T. Lee Aug. 23, 2020, 8:53 a.m. UTC
For the problem of increasing fragmentation of the bpf loader programs,
instead of using bpf_loader.o, which is used in samples/bpf, this
patch refactors the existing kprobe, tracepoint 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/tracepoint 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.

Daniel T. Lee (3):
  samples: bpf: cleanup bpf_load.o from Makefile
  samples: bpf: Refactor kprobe tracing programs with libbpf
  samples: bpf: Refactor tracepoint tracing programs with libbpf

 samples/bpf/Makefile                          | 18 ++---
 samples/bpf/cpustat_kern.c                    | 36 +++++-----
 samples/bpf/cpustat_user.c                    | 47 +++++++++++--
 samples/bpf/lathist_kern.c                    | 24 +++----
 samples/bpf/lathist_user.c                    | 42 ++++++++++--
 samples/bpf/offwaketime_kern.c                | 52 +++++++-------
 samples/bpf/offwaketime_user.c                | 66 ++++++++++++++----
 samples/bpf/spintest_kern.c                   | 36 +++++-----
 samples/bpf/spintest_user.c                   | 68 +++++++++++++++----
 samples/bpf/syscall_tp_kern.c                 | 24 +++----
 samples/bpf/syscall_tp_user.c                 | 54 +++++++++++----
 .../bpf/test_current_task_under_cgroup_kern.c | 27 ++++----
 .../bpf/test_current_task_under_cgroup_user.c | 52 +++++++++++---
 samples/bpf/test_probe_write_user_kern.c      | 12 ++--
 samples/bpf/test_probe_write_user_user.c      | 49 ++++++++++---
 samples/bpf/trace_output_kern.c               | 15 ++--
 samples/bpf/trace_output_user.c               | 55 ++++++++++-----
 17 files changed, 465 insertions(+), 212 deletions(-)

Comments

Alexei Starovoitov Aug. 25, 2020, 4:02 a.m. UTC | #1
On Sun, Aug 23, 2020 at 05:53:31PM +0900, Daniel T. Lee wrote:
> For the problem of increasing fragmentation of the bpf loader programs,
> instead of using bpf_loader.o, which is used in samples/bpf, this
> patch refactors the existing kprobe, tracepoint tracing programs with 
> libbbpf bpf loader.

Thank for you doing the conversion. Applied.