Skip to content

RFC uprobe: uretprobe speed up

Jiri Olsa bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 29 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3uprobe: Add uretprobe syscall to speed up return probearch/x86/entry/syscalls/syscall_64.tbl arch/x86/kernel/uprobes.c include/linux/syscalls.h +4 more+73 -55 replies
2/3selftests/bpf: Add uretprobe syscall testtools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/prog_tests/arch/x86/uprobe_syscall.S tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c +1 more+200 -12 replies
3/3selftests/bpf: Mark uprobe trigger functions with nocf_check attributetools/include/linux/compiler.h tools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/benchs/bench_trigger.c+8 -43 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchOleg NesterovAndrii Nakryiko
1/3R-b A-b
2/3
3/3

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

Read the v1 thread

Cover letter [PATCH RFC bpf-next 0/3] uprobe: uretprobe speed up

hi,
as part of the effort on speeding up the uprobes [0] coming with return uprobe optimization by using syscall instead of the trap on the uretprobe trampoline.

The speed up depends on instruction type that uprobe is installed and depends on specific HW type, please check patch 1 for details.

I added extra bpf selftest to check on registers values before and after uretprobe to make sure the syscall saves all the needed regs.

reasons for this being RFC:

- I'm not sure we want specific uretprobe syscall and not generic uprobe syscall to extend in future.. when I added extra code to read registers from stack I did not see any notable performance degradation, so I think we could survive restoring another register for argument

- I'm not sure how we want to handle assembly code in bpf selftests

thanks,
jirka

[0] https://lore.kernel.org/bpf/ZeCXHKJ--iYYbmLj@krava/
---
Jiri Olsa (3):
uprobe: Add uretprobe syscall to speed up return probe selftests/bpf: Add uretprobe syscall test
selftests/bpf: Mark uprobe trigger functions with nocf_check attribute

 arch/x86/entry/syscalls/syscall_64.tbl                           |  1 +
 arch/x86/kernel/uprobes.c                                        | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/syscalls.h                                         |  2 ++
 include/linux/uprobes.h                                          |  2 ++
 include/uapi/asm-generic/unistd.h                                |  5 ++++-
 kernel/events/uprobes.c                                          | 18 ++++++++++++++----
 kernel/sys_ni.c                                                  |  2 ++
 tools/include/linux/compiler.h                                   |  4 ++++
 tools/testing/selftests/bpf/Makefile                             | 15 +++++++++++++--
 tools/testing/selftests/bpf/benchs/bench_trigger.c               |  6 +++---
 tools/testing/selftests/bpf/prog_tests/arch/x86/uprobe_syscall.S | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c          | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/progs/uprobe_syscall.c               | 15 +++++++++++++++
 13 files changed, 281 insertions(+), 10 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/arch/x86/uprobe_syscall.S
 create mode 100644 tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
 create mode 100644 tools/testing/selftests/bpf/progs/uprobe_syscall.c