Subject: [RFC 0/5] bpf: Add trampoline helpers

From: Jiri Olsa <[email-masked]>
Date: Sun, 29 Dec 2019 15:37:35 +0100

hi,
I understand trampolines are brand new stuff and you guys
might be already working on this.

However, I was checking on the trampoline probes and could
get some really nice speedup for few bcc progs.

Here's output of perf bench while running klockstat.py:

    Without:
            $ perf bench sched messaging -l 50000
            ...
                 Total time: 18.571 [sec]

    With current kprobe tracing:
            $ perf bench sched messaging -l 50000
            ...
                 Total time: 183.395 [sec]

    With kfunc tracing:
            $ perf bench sched messaging -l 50000
            ...
                 Total time: 39.773 [sec]

I needed to add few perf_event_output, stack retrieval
helpers and trampoline lookup during orc unwinding.

It's also available in here:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/kfunc

Apart from these helpers, several other patches (like perf
and ftrace ring buffer renames) are needed to make it all work,
it's pushed in here:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/kfunc_all

You can check on current bcc changes in here:
  https://github.com/olsajiri/bcc/tree/kfunc

thanks,
jirka

---
Jiri Olsa (5):
      bpf: Allow non struct type for btf ctx access
      bpf: Add bpf_perf_event_output_kfunc
      bpf: Add bpf_get_stackid_kfunc
      bpf: Add bpf_get_stack_kfunc
      bpf: Allow to resolve bpf trampoline in unwind

 include/linux/bpf.h      |   6 ++++++
 kernel/bpf/btf.c         |   6 ------
 kernel/bpf/core.c        |   2 ++
 kernel/bpf/trampoline.c  |  35 +++++++++++++++++++++++++++++++++++
 kernel/trace/bpf_trace.c | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 166 insertions(+), 6 deletions(-)