BPF List
 help / color / mirror / Atom feed
* [PATCH RFC bpf-next 0/3] uprobe: uretprobe speed up
@ 2024-03-18  9:31 Jiri Olsa
  2024-03-18  9:31 ` [PATCH RFC bpf-next 1/3] uprobe: Add uretprobe syscall to speed up return probe Jiri Olsa
                   ` (3 more replies)
  0 siblings, 4 replies; 33+ messages in thread
From: Jiri Olsa @ 2024-03-18  9:31 UTC (permalink / raw)
  To: Oleg Nesterov, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko
  Cc: bpf, Song Liu, Yonghong Song, John Fastabend, Peter Zijlstra,
	Thomas Gleixner, Borislav Petkov (AMD), x86

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

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

end of thread, other threads:[~2024-03-22 13:40 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18  9:31 [PATCH RFC bpf-next 0/3] uprobe: uretprobe speed up Jiri Olsa
2024-03-18  9:31 ` [PATCH RFC bpf-next 1/3] uprobe: Add uretprobe syscall to speed up return probe Jiri Olsa
2024-03-18 14:22   ` Oleg Nesterov
2024-03-19  1:11   ` Andrii Nakryiko
2024-03-19  6:32     ` Oleg Nesterov
2024-03-19 16:20       ` Andrii Nakryiko
2024-03-19 10:54     ` Jiri Olsa
2024-03-18  9:31 ` [PATCH RFC bpf-next 2/3] selftests/bpf: Add uretprobe syscall test Jiri Olsa
2024-03-19  1:16   ` Andrii Nakryiko
2024-03-19 11:09     ` Jiri Olsa
2024-03-18  9:31 ` [PATCH RFC bpf-next 3/3] selftests/bpf: Mark uprobe trigger functions with nocf_check attribute Jiri Olsa
2024-03-19  1:22   ` Andrii Nakryiko
2024-03-19 11:11     ` Jiri Olsa
2024-03-22 13:40       ` Jiri Olsa
2024-03-19 10:25 ` [PATCH RFC bpf-next 4/3] uprobe: ensure sys_uretprobe uses sysret Oleg Nesterov
2024-03-19 11:08   ` Jiri Olsa
2024-03-19 16:25     ` Andrii Nakryiko
2024-03-19 16:38       ` Oleg Nesterov
2024-03-19 19:35       ` Jiri Olsa
2024-03-19 19:31     ` Jiri Olsa
2024-03-19 20:13       ` Andrii Nakryiko
2024-03-20 11:04       ` Jiri Olsa
2024-03-20 14:37         ` Oleg Nesterov
2024-03-20 15:28           ` Oleg Nesterov
2024-03-20 17:44             ` Andrii Nakryiko
2024-03-20 19:08               ` Jiri Olsa
2024-03-21 10:10                 ` Oleg Nesterov
2024-03-21  9:59             ` Jiri Olsa
2024-03-21 10:17               ` Oleg Nesterov
2024-03-21 10:52                 ` Jiri Olsa
2024-03-21 12:14                   ` Oleg Nesterov
2024-03-21 20:29                     ` Jiri Olsa
2024-03-22  8:48                       ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox