bpf: Add multi uprobe link
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
- v7 Latest28 patches 8 repliesApplied 28/28
- v628 patches 2 repliesSuperseded
- v528 patches 6 repliesSuperseded
Earlier versions · 4
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v4 | 28 patches | 7 replies | Superseded | |
| v3 | 26 patches | 46 replies | Superseded | |
| v2 | 24 patches | 36 replies | Superseded | |
| v1 | 20 patches | 31 replies | Superseded |
Changes in v7 from the cover letter
- fixed task release on error path and re-org the error path to be more straightforward [Yonghong]
- re-organized uprobe_prog_run locking to follow general pattern and removed might_fault check as it's not needed in uprobe/task context [Yonghong]
Patches in v7 All 28 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/28 | bpf: Switch BPF_F_KPROBE_MULTI_RETURN macro to enuminclude/ tools/ | +6 | 1 reply | Applied |
| 2/28 | bpf: Add attach_type checks under bpf_prog_attach_check_attach_typekernel/ | +52 | 1 reply | Applied |
| 3/28 | bpf: Add multi uprobe linkinclude/ include/ kernel/ +2 more | +282 | 1 reply | Applied |
| 4/28 | bpf: Add cookies support for uprobe_multi linkinclude/ kernel/ kernel/ +1 more | +44 | 3 replies | Applied |
| 5/28 | bpf: Add pid filter support for uprobe_multi linkinclude/ kernel/ kernel/ +1 more | +36 | 1 reply | Applied |
| 6/28 | bpf: Add bpf_get_func_ip helper support for uprobe linkkernel/ | +30 | 1 reply | Applied |
| 7/28 | libbpf: Add uprobe_multi attach type and link namestools/ | +2 | 0 replies | Applied |
| 8/28 | libbpf: Move elf_find_func_offset* functions to elf objecttools/ tools/ tools/ +1 more | +202 | 0 replies | Applied |
| 9/28 | libbpf: Add elf_open/elf_close functionstools/ tools/ tools/ | +57 | 0 replies | Applied |
| 10/28 | libbpf: Add elf symbol iteratortools/ | +115 | 0 replies | Applied |
| 11/28 | libbpf: Add elf_resolve_syms_offsets functiontools/ tools/ | +112 | 0 replies | Applied |
| 12/28 | libbpf: Add elf_resolve_pattern_offsets functiontools/ tools/ tools/ | +67 | 0 replies | Applied |
| 13/28 | libbpf: Add bpf_link_create support for multi uprobestools/ tools/ | +21 | 0 replies | Applied |
| 14/28 | libbpf: Add bpf_program__attach_uprobe_multi functiontools/ tools/ tools/ | +166 | 0 replies | Applied |
| 15/28 | libbpf: Add support for u[ret]probe.multi[.s] program sectionstools/ | +36 | 0 replies | Applied |
| 16/28 | libbpf: Add uprobe multi link detectiontools/ tools/ | +38 | 0 replies | Applied |
| 17/28 | libbpf: Add uprobe multi link support to bpf_program__attach_usdttools/ tools/ | +82 | 0 replies | Applied |
| 18/28 | selftests/bpf: Move get_time_ns to testing_helpers.htools/ tools/ tools/ | +10 | 0 replies | Applied |
| 19/28 | selftests/bpf: Add uprobe_multi skel testtools/ tools/ | +167 | 0 replies | Applied |
| 20/28 | selftests/bpf: Add uprobe_multi api testtools/ | +65 | 0 replies | Applied |
| 21/28 | selftests/bpf: Add uprobe_multi link testtools/ | +69 | 0 replies | Applied |
| 22/28 | selftests/bpf: Add uprobe_multi test programtools/ tools/ | +72 | 0 replies | Applied |
| 23/28 | selftests/bpf: Add uprobe_multi bench testtools/ tools/ | +55 | 0 replies | Applied |
| 24/28 | selftests/bpf: Add uprobe_multi usdt test codetools/ | +25 | 0 replies | Applied |
| 25/28 | selftests/bpf: Add uprobe_multi usdt bench testtools/ tools/ | +55 | 0 replies | Applied |
| 26/28 | selftests/bpf: Add uprobe_multi cookie testtools/ | +78 | 0 replies | Applied |
| 27/28 | selftests/bpf: Add uprobe_multi pid filter teststools/ tools/ | +126 | 0 replies | Applied |
| 28/28 | selftests/bpf: Add extra link to uprobe_multi teststools/ tools/ | +22 | 0 replies | Applied |
Reviews trailers per patch
11 of 28 patches have a Reviewed-by or Acked-by.
| Patch | Yafang Shao | Andrii Nakryiko | Oleg Nesterov | Yonghong Song |
|---|---|---|---|---|
| 1/28 | A-b | A-b | ||
| 2/28 | A-b | A-b | A-b | |
| 3/28 | A-b | A-b | A-b | |
| 4/28 | A-b | A-b | A-b | |
| 5/28 | R-b | A-b | ||
| 6/28 | A-b | A-b | ||
| 7/28 | A-b | |||
| 8/28 | ||||
| 9/28 | A-b | |||
| 10/28 | A-b | |||
| 11/28 | ||||
| 12/28 | ||||
| 13/28 | A-b | |||
| 14/28 | ||||
| 15/28 | A-b | |||
| 16/28 | ||||
| 17/28 | ||||
| 18/28 | ||||
| 19/28 | ||||
| 20/28 | ||||
| 21/28 | ||||
| 22/28 | ||||
| 23/28 | ||||
| 24/28 | ||||
| 25/28 | ||||
| 26/28 | ||||
| 27/28 | ||||
| 28/28 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCHv7 bpf-next 00/28] bpf: Add multi uprobe link
hi,
this patchset is adding support to attach multiple uprobes and usdt probes through new uprobe_multi link.
The current uprobe is attached through the perf event and attaching many uprobes takes a lot of time because of that.
The main reason is that we need to install perf event for each probed function and profile shows perf event installation (perf_install_in_context) as culprit.
The new uprobe_multi link just creates raw uprobes and attaches the bpf program to them without perf event being involved.
In addition to being faster we also save file descriptors. For the current uprobe attach we use extra perf event fd for each probed function. The new link just need one fd that covers all the functions we are attaching to.
v7 changes:
- fixed task release on error path and re-org the error path to be more straightforward [Yonghong]
- re-organized uprobe_prog_run locking to follow general pattern and removed might_fault check as it's not needed in uprobe/task context [Yonghong]
There's support for bpftrace [2] and tetragon [1].
Also available at:
https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
uprobe_multi
thanks,
jirka
[1] https://github.com/cilium/tetragon/pull/936
[2] https://github.com/iovisor/bpftrace/compare/master...olsajiri:bpftrace:uprobe_multi
[3] https://lore.kernel.org/bpf/[email protected]/
---
Jiri Olsa (28):
bpf: Switch BPF_F_KPROBE_MULTI_RETURN macro to enum
bpf: Add attach_type checks under bpf_prog_attach_check_attach_type
bpf: Add multi uprobe link
bpf: Add cookies support for uprobe_multi link
bpf: Add pid filter support for uprobe_multi link
bpf: Add bpf_get_func_ip helper support for uprobe link
libbpf: Add uprobe_multi attach type and link names
libbpf: Move elf_find_func_offset* functions to elf object
libbpf: Add elf_open/elf_close functions
libbpf: Add elf symbol iterator
libbpf: Add elf_resolve_syms_offsets function
libbpf: Add elf_resolve_pattern_offsets function
libbpf: Add bpf_link_create support for multi uprobes
libbpf: Add bpf_program__attach_uprobe_multi function
libbpf: Add support for u[ret]probe.multi[.s] program sections
libbpf: Add uprobe multi link detection
libbpf: Add uprobe multi link support to bpf_program__attach_usdt selftests/bpf: Move get_time_ns to testing_helpers.h
selftests/bpf: Add uprobe_multi skel test
selftests/bpf: Add uprobe_multi api test
selftests/bpf: Add uprobe_multi link test
selftests/bpf: Add uprobe_multi test program
selftests/bpf: Add uprobe_multi bench test
selftests/bpf: Add uprobe_multi usdt test code
selftests/bpf: Add uprobe_multi usdt bench test
selftests/bpf: Add uprobe_multi cookie test
selftests/bpf: Add uprobe_multi pid filter tests
selftests/bpf: Add extra link to uprobe_multi tests
include/linux/trace_events.h | 6 ++ include/uapi/linux/bpf.h | 22 ++++- kernel/bpf/syscall.c | 134 ++++++++++++++-------------- kernel/trace/bpf_trace.c | 342 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- tools/include/uapi/linux/bpf.h | 22 ++++- tools/lib/bpf/Build | 2 +- tools/lib/bpf/bpf.c | 11 +++ tools/lib/bpf/bpf.h | 11 ++- tools/lib/bpf/elf.c | 440 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/lib/bpf/libbpf.c | 388 ++++++++++++++++++++++++++++++++++++++++++--------------------------------------- tools/lib/bpf/libbpf.h | 51 +++++++++++ tools/lib/bpf/libbpf.map | 1 + tools/lib/bpf/libbpf_internal.h | 21 +++++ tools/lib/bpf/usdt.c | 116 ++++++++++++++++-------- tools/testing/selftests/bpf/Makefile | 5 ++ tools/testing/selftests/bpf/bench.h | 9 -- tools/testing/selftests/bpf/prog_tests/bpf_cookie.c | 78 +++++++++++++++++ tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c | 8 -- tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c | 415 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/testing/selftests/bpf/progs/uprobe_multi.c | 101 +++++++++++++++++++++ tools/testing/selftests/bpf/progs/uprobe_multi_bench.c | 15 ++++ tools/testing/selftests/bpf/progs/uprobe_multi_usdt.c | 16 ++++ tools/testing/selftests/bpf/testing_helpers.h | 10 +++ tools/testing/selftests/bpf/uprobe_multi.c | 91 +++++++++++++++++++ 24 files changed, 1992 insertions(+), 323 deletions(-) create mode 100644 tools/lib/bpf/elf.c create mode 100644 tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi.c create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_bench.c create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_usdt.c create mode 100644 tools/testing/selftests/bpf/uprobe_multi.c