linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC bpf-next 0/4] bpf: Speed up symbol resolving in kprobe multi link
@ 2022-04-07 12:52 Jiri Olsa
  2022-04-07 12:52 ` [RFC bpf-next 1/4] kallsyms: Add kallsyms_lookup_names function Jiri Olsa
                   ` (4 more replies)
  0 siblings, 5 replies; 45+ messages in thread
From: Jiri Olsa @ 2022-04-07 12:52 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Masami Hiramatsu
  Cc: netdev, bpf, lkml, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh

hi,
sending additional fix for symbol resolving in kprobe multi link
requested by Alexei and Andrii [1].

This speeds up bpftrace kprobe attachment, when using pure symbols
(3344 symbols) to attach:

Before:

  # perf stat -r 5 -e cycles ./src/bpftrace -e 'kprobe:x* {  } i:ms:1 { exit(); }'
  ...
  6.5681 +- 0.0225 seconds time elapsed  ( +-  0.34% )

After:

  # perf stat -r 5 -e cycles ./src/bpftrace -e 'kprobe:x* {  } i:ms:1 { exit(); }'
  ...
  0.5661 +- 0.0275 seconds time elapsed  ( +-  4.85% )


There are 2 reasons I'm sending this as RFC though..

  - I added test that meassures attachment speed on all possible functions
    from available_filter_functions, which is 48712 functions on my setup.
    The attach/detach speed for that is under 2 seconds and the test will
    fail if it's bigger than that.. which might fail on different setups
    or loaded machine.. I'm not sure what's the best solution yet, separate
    bench application perhaps?

  - copy_user_syms function potentially allocates lot of memory (~6MB in my
    tests with attaching ~48k functions). I haven't seen this to fail yet,
    but it might need to be changed to allocate memory gradually if needed,
    do we care? ;-)

thanks,
jirka


[1] https://lore.kernel.org/bpf/CAEf4BzZtQaiUxQ-sm_hH2qKPRaqGHyOfEsW96DxtBHRaKLoL3Q@mail.gmail.com/
---
Jiri Olsa (4):
      kallsyms: Add kallsyms_lookup_names function
      fprobe: Resolve symbols with kallsyms_lookup_names
      bpf: Resolve symbols with kallsyms_lookup_names for kprobe multi link
      selftests/bpf: Add attach bench test

 include/linux/kallsyms.h                                   |   6 ++++
 kernel/kallsyms.c                                          |  50 ++++++++++++++++++++++++++++++++-
 kernel/trace/bpf_trace.c                                   | 123 +++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
 kernel/trace/fprobe.c                                      |  23 ++-------------
 tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/progs/kprobe_multi_empty.c     |  12 ++++++++
 6 files changed, 283 insertions(+), 72 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi_empty.c

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2022-04-29  0:32 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 12:52 [RFC bpf-next 0/4] bpf: Speed up symbol resolving in kprobe multi link Jiri Olsa
2022-04-07 12:52 ` [RFC bpf-next 1/4] kallsyms: Add kallsyms_lookup_names function Jiri Olsa
2022-04-08  0:57   ` Masami Hiramatsu
2022-04-13  7:27     ` Jiri Olsa
2022-04-08 23:19   ` Alexei Starovoitov
2022-04-09 20:24     ` Jiri Olsa
2022-04-12 20:46     ` Jiri Olsa
2022-04-15  0:47       ` Masami Hiramatsu
2022-04-15 22:39         ` Jiri Olsa
2022-04-11 22:15   ` Andrii Nakryiko
2022-04-12 20:28     ` Jiri Olsa
2022-04-07 12:52 ` [RFC bpf-next 2/4] fprobe: Resolve symbols with kallsyms_lookup_names Jiri Olsa
2022-04-08  0:58   ` Masami Hiramatsu
2022-04-07 12:52 ` [RFC bpf-next 3/4] bpf: Resolve symbols with kallsyms_lookup_names for kprobe multi link Jiri Olsa
2022-04-08 23:26   ` Alexei Starovoitov
2022-04-09 20:24     ` Jiri Olsa
2022-04-11 22:15     ` Andrii Nakryiko
2022-04-11 22:15   ` Andrii Nakryiko
2022-04-12 18:42     ` Jiri Olsa
2022-04-07 12:52 ` [RFC bpf-next 4/4] selftests/bpf: Add attach bench test Jiri Olsa
2022-04-11 22:15   ` Andrii Nakryiko
2022-04-12  0:49     ` Masami Hiramatsu
2022-04-12 22:51       ` Andrii Nakryiko
2022-04-16 14:21         ` Masami Hiramatsu
2022-04-18 17:33           ` Steven Rostedt
2022-04-28 13:58           ` Steven Rostedt
2022-04-28 13:59             ` Steven Rostedt
2022-04-28 18:59             ` Alexei Starovoitov
2022-04-28 20:05               ` Steven Rostedt
2022-04-28 23:32                 ` Andrii Nakryiko
2022-04-28 23:53                   ` Steven Rostedt
2022-04-29  0:09                     ` Steven Rostedt
2022-04-29  0:31                       ` Steven Rostedt
2022-04-13 16:44       ` Steven Rostedt
2022-04-13 16:45         ` Andrii Nakryiko
2022-04-13 16:59           ` Steven Rostedt
2022-04-13 19:02             ` Andrii Nakryiko
2022-04-12 15:44     ` Jiri Olsa
2022-04-12 22:59       ` Andrii Nakryiko
2022-04-08 23:29 ` [RFC bpf-next 0/4] bpf: Speed up symbol resolving in kprobe multi link Alexei Starovoitov
2022-04-09 20:24   ` Jiri Olsa
2022-04-11 22:15     ` Andrii Nakryiko
2022-04-11 22:18       ` Alexei Starovoitov
2022-04-11 22:21         ` Andrii Nakryiko
2022-04-12 15:46           ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).