Re: [PATCH v2 bpf-next 04/17] libbpf: Add support to attach to fentry/fexit tracing progs
From: Song Liu <hidden>
Date: 2019-11-07 23:13:35
Also in:
bpf
On Nov 7, 2019, at 3:07 PM, Alexei Starovoitov [off-list ref] wrote: On Thu, Nov 07, 2019 at 10:51:41PM +0000, Song Liu wrote:quoted
quoted
On Nov 6, 2019, at 9:46 PM, Alexei Starovoitov [off-list ref] wrote: Teach libbpf to recognize tracing programs types and attach them to fentry/fexit. Signed-off-by: Alexei Starovoitov <ast@kernel.org>Acked-by: Song Liu <redacted> With nit below:quoted
--- tools/include/uapi/linux/bpf.h | 2 ++ tools/lib/bpf/libbpf.c | 61 +++++++++++++++++++++++++++++----- tools/lib/bpf/libbpf.h | 5 +++ tools/lib/bpf/libbpf.map | 2 ++ 4 files changed, 61 insertions(+), 9 deletions(-)[...]quoted
/* Accessors of bpf_program */ struct bpf_program;@@ -248,6 +251,8 @@ LIBBPF_API struct bpf_link *bpf_program__attach_raw_tracepoint(struct bpf_program *prog, const char *tp_name); +LIBBPF_API struct bpf_link * +bpf_program__attach_trace(struct bpf_program *prog); struct bpf_insn;attach_trace is not very clear. I guess we cannot call it attach_ftrace? Maybe we call it attach_fentry and attach_fexit (two names pointing to same function)?bpf_program__attach_trace() can attach all BPF_PROG_TYPE_TRACING. Which today are: BPF_TRACE_RAW_TP, BPF_TRACE_FENTRY, BPF_TRACE_FEXIT, There will be more BPF_TRACE_* enum bpf_attach_type in the future. I considered naming it bpf_program__attach_tracing(), but it's uglier and longer.
I see. Thanks for the explanation. Song