BPF List
 help / color / mirror / Atom feed
* [LSF/MM/BPF TOPIC] faster uprobes
@ 2024-02-29 14:39 Jiri Olsa
  2024-03-01  0:25 ` Andrii Nakryiko
  2024-03-01 19:39 ` Kui-Feng Lee
  0 siblings, 2 replies; 31+ messages in thread
From: Jiri Olsa @ 2024-02-29 14:39 UTC (permalink / raw)
  To: bpf, Alexei Starovoitov, lsf-pc, Andrii Nakryiko, Yonghong Song,
	Oleg Nesterov, Daniel Borkmann

One of uprobe pain points is having slow execution that involves
two traps in worst case scenario or single trap if the original
instruction can be emulated. For return uprobes there's one extra
trap on top of that.

My current idea on how to make this faster is to follow the optimized
kprobes and replace the normal uprobe trap instruction with jump to
user space trampoline that:

  - executes syscall to call uprobe consumers callbacks
  - executes original instructions
  - jumps back to continue with the original code

There are of course corner cases where above will have trouble or
won't work completely, like:

  - executing original instructions in the trampoline is tricky wrt
    rip relative addressing

  - some instructions we can't move to trampoline at all

  - the uprobe address is on page boundary so the jump instruction to
    trampoline would span across 2 pages, hence the page replace won't
    be atomic, which might cause issues

  - ... ? many others I'm sure

Still with all the limitations I think we could be able to speed up
some amount of the uprobes, which seems worth doing.

I'd like to have the discussion on the topic and get some agreement
or directions on how this should be done.

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

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

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29 14:39 [LSF/MM/BPF TOPIC] faster uprobes Jiri Olsa
2024-03-01  0:25 ` Andrii Nakryiko
2024-03-01  8:18   ` Jiri Olsa
2024-03-01 17:01     ` Alexei Starovoitov
2024-03-01 17:26       ` Andrii Nakryiko
2024-03-01 18:08         ` Yunwei 123
2024-03-03 10:20         ` Jiri Olsa
2024-03-05  0:55           ` Andrii Nakryiko
2024-03-05  8:24             ` Jiri Olsa
2024-03-05 15:30               ` Jiri Olsa
2024-03-05 17:30                 ` Andrii Nakryiko
2024-03-11 10:59               ` Jiri Olsa
2024-03-11 15:06                 ` Oleg Nesterov
2024-03-11 16:46                   ` Jiri Olsa
2024-03-11 17:02                     ` Oleg Nesterov
2024-03-11 21:11                       ` Jiri Olsa
2024-03-11 17:32                 ` Andrii Nakryiko
2024-03-11 21:26                   ` Jiri Olsa
2024-03-11 23:05                     ` Andrii Nakryiko
2024-03-02 20:46       ` Jiri Olsa
2024-03-02 21:08         ` Alexei Starovoitov
2024-03-02 21:49           ` Oleg Nesterov
2024-03-01 19:39 ` Kui-Feng Lee
2024-03-05 17:18   ` Jiri Olsa
2024-03-05 23:53     ` Song Liu
2024-03-07  9:15       ` Jiri Olsa
2024-03-07 23:02       ` Kui-Feng Lee
2024-03-08 15:43         ` Andrei Matei
2024-03-12 17:16           ` Kui-Feng Lee
2024-03-13  1:32             ` Andrei Matei
2024-03-13  5:42               ` Kui-Feng Lee

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