[RFC 0/8] perf/bpf: Add batch support for [ku]probes attach

From: Jiri Olsa
Date: Wed Nov 24 2021 - 03:42:49 EST


hi,
adding support to create multiple kprobes/uprobes within single
perf event. This way we can associate single bpf program with
multiple kprobes.

Sending this as RFC because I'm not completely sure I haven't
missed anything in the trace/events area.

Also it needs following uprobe fix to work properly:
https://lore.kernel.org/lkml/20211123142801.182530-1-jolsa@xxxxxxxxxx/

Also available at:
https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
bpf/kuprobe_batch

thanks,
jirka


---
Jiri Olsa (8):
perf/kprobe: Add support to create multiple probes
perf/uprobe: Add support to create multiple probes
libbpf: Add libbpf__kallsyms_parse function
libbpf: Add struct perf_event_open_args
libbpf: Add support to attach multiple [ku]probes
libbpf: Add support for k[ret]probe.multi program section
selftest/bpf: Add kprobe multi attach test
selftest/bpf: Add uprobe multi attach test

include/uapi/linux/perf_event.h | 1 +
kernel/trace/trace_event_perf.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
kernel/trace/trace_kprobe.c | 47 ++++++++++++++++---
kernel/trace/trace_probe.c | 2 +-
kernel/trace/trace_probe.h | 6 ++-
kernel/trace/trace_uprobe.c | 43 +++++++++++++++--
tools/include/uapi/linux/perf_event.h | 1 +
tools/lib/bpf/libbpf.c | 235 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
tools/lib/bpf/libbpf.h | 25 +++++++++-
tools/lib/bpf/libbpf_internal.h | 5 ++
tools/testing/selftests/bpf/prog_tests/multi_kprobe_test.c | 83 +++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/prog_tests/multi_uprobe_test.c | 97 ++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/multi_kprobe.c | 58 +++++++++++++++++++++++
tools/testing/selftests/bpf/progs/multi_uprobe.c | 26 +++++++++++
14 files changed, 765 insertions(+), 78 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/multi_kprobe_test.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/multi_uprobe_test.c
create mode 100644 tools/testing/selftests/bpf/progs/multi_kprobe.c
create mode 100644 tools/testing/selftests/bpf/progs/multi_uprobe.c