Skip to content

bpf: Speed up symbol resolving in kprobe multi link

Jiri Olsa bpf lkml netdev 6 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest5 patches 0 repliesApplied 5/5
  2. v55 patches 2 repliesSuperseded
  3. v45 patches 5 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v35 patches3 repliesSuperseded
v24 patches11 repliesSuperseded
v1 RFC4 patches40 repliesSuperseded

Changes in v6 from the cover letter

- rewrote patch 1 changelog and fixed the line length [Christoph]

Patches in v6 All 5 applied

#Subject and filesSizeRepliesApplied
1/5kallsyms: Make kallsyms_on_each_symbol generally availableinclude/linux/kallsyms.h kernel/kallsyms.c+6 -30 repliesApplied
2/5ftrace: Add ftrace_lookup_symbols functioninclude/linux/ftrace.h kernel/kallsyms.c kernel/trace/ftrace.c+69 -00 repliesApplied
3/5fprobe: Resolve symbols with ftrace_lookup_symbolskernel/trace/fprobe.c+12 -200 repliesApplied
4/5bpf: Resolve symbols with ftrace_lookup_symbols for kprobe multi linkkernel/trace/bpf_trace.c+66 -460 repliesApplied
5/5selftests/bpf: Add attach bench testtools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c tools/testing/selftests/bpf/progs/kprobe_multi_empty.c+155 -00 repliesApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchMasami HiramatsuAndrii Nakryiko
1/5R-b
2/5R-b A-b
3/5A-b
4/5A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCHv6 bpf-next 0/5] bpf: Speed up symbol resolving in kprobe multi link

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% )

v6 changes:
- rewrote patch 1 changelog and fixed the line length [Christoph]

v5 changes:
- added acks [Masami]
- workaround in selftest for RCU warning by filtering out several functions to attach

v4 changes:
- fix compile issue [kernel test robot]
- added acks [Andrii]

v3 changes:
- renamed kallsyms_lookup_names to ftrace_lookup_symbols and moved it to ftrace.c [Masami]
- added ack [Andrii]
- couple small test fixes [Andrii]

v2 changes (first version [2]):
- removed the 2 seconds check [Alexei]
- moving/forcing symbols sorting out of kallsyms_lookup_names function [Alexei]
- skipping one array allocation and copy_from_user [Andrii]
- several small fixes [Masami,Andrii]
- build fix [kernel test robot]

thanks,
jirka

[1] https://lore.kernel.org/bpf/CAEf4BzZtQaiUxQ-sm_hH2qKPRaqGHyOfEsW96DxtBHRaKLoL3Q@mail.gmail.com/
[2] https://lore.kernel.org/bpf/[email protected]/
---
Jiri Olsa (5):
kallsyms: Make kallsyms_on_each_symbol generally available
ftrace: Add ftrace_lookup_symbols function
fprobe: Resolve symbols with ftrace_lookup_symbols
bpf: Resolve symbols with ftrace_lookup_symbols for kprobe multi link selftests/bpf: Add attach bench test

 include/linux/ftrace.h                                     |   6 ++++
 include/linux/kallsyms.h                                   |   7 ++++-
 kernel/kallsyms.c                                          |   3 +-
 kernel/trace/bpf_trace.c                                   | 112 ++++++++++++++++++++++++++++++++++++++++++------------------------------
 kernel/trace/fprobe.c                                      |  32 ++++++++-------------
 kernel/trace/ftrace.c                                      |  62 ++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/progs/kprobe_multi_empty.c     |  12 ++++++++
 8 files changed, 308 insertions(+), 69 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi_empty.c