summaryrefslogtreecommitdiff
path: root/include/trace/bpf_probe.h
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2019-10-16 06:24:55 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2019-10-17 17:44:35 +0300
commite8c423fb31fa8b1ef6d7cd14a168de33e7c0d702 (patch)
treedeed1e4a6eb1316a94197c9de41b9c24aff63210 /include/trace/bpf_probe.h
parenteac9153f2b584c702cea02c1f1a57d85aa9aea42 (diff)
downloadlinux-e8c423fb31fa8b1ef6d7cd14a168de33e7c0d702.tar.xz
bpf: Add typecast to raw_tracepoints to help BTF generation
When pahole converts dwarf to btf it emits only used types. Wrap existing __bpf_trace_##template() function into btf_trace_##template typedef and use it in type cast to make gcc emits this type into dwarf. Then pahole will convert it to btf. The "btf_trace_" prefix will be used to identify BTF enabled raw tracepoints. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Andrii Nakryiko <andriin@fb.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20191016032505.2089704-2-ast@kernel.org
Diffstat (limited to 'include/trace/bpf_probe.h')
-rw-r--r--include/trace/bpf_probe.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/trace/bpf_probe.h b/include/trace/bpf_probe.h
index d6e556c0a085..b04c29270973 100644
--- a/include/trace/bpf_probe.h
+++ b/include/trace/bpf_probe.h
@@ -74,11 +74,12 @@ static inline void bpf_test_probe_##call(void) \
{ \
check_trace_callback_type_##call(__bpf_trace_##template); \
} \
+typedef void (*btf_trace_##call)(void *__data, proto); \
static struct bpf_raw_event_map __used \
__attribute__((section("__bpf_raw_tp_map"))) \
__bpf_trace_tp_map_##call = { \
.tp = &__tracepoint_##call, \
- .bpf_func = (void *)__bpf_trace_##template, \
+ .bpf_func = (void *)(btf_trace_##call)__bpf_trace_##template, \
.num_args = COUNT_ARGS(args), \
.writable_size = size, \
};