All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/5] sleepable uprobe support
@ 2022-04-28 16:53 Delyan Kratunov
  2022-04-28 16:53 ` [PATCH bpf-next 4/5] libbpf: add support for sleepable kprobe and uprobe programs Delyan Kratunov
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Delyan Kratunov @ 2022-04-28 16:53 UTC (permalink / raw)
  To: daniel, ast, andrii, bpf; +Cc: paulmck

This series implements support for sleepable uprobe programs.
Key work is in patches 2 and 3, the rest is plumbing and tests.

The main observation is that the only obstacle in the way of sleepable uprobe
programs is not the uprobe infrastructure, which already runs in a user context,
but the rcu usage around bpf_prog_array.

Details are in patch 2 but the tl;dr is that we chain trace_tasks and normal rcu
grace periods when releasing to array to accommodate users of either rcu type.
This introduces latency on non-sleepable users but that's deemed acceptable, given
recent benchmarks by Andrii [1]. We're a couple of orders of magnitude under
the rate of bpf_prog_array churn that would raise flags (~1MM/s per Paul).

  [1]: https://lore.kernel.org/bpf/CAEf4BzbpjN6ca7D9KOTiFPOoBYkciYvTz0UJNp5c-_3ptm=Mrg@mail.gmail.com/

Delyan Kratunov (5):
  bpf: move bpf_prog to bpf.h
  bpf: implement sleepable uprobes by chaining tasks and normal rcu
  bpf: allow sleepable uprobe programs to attach
  libbpf: add support for sleepable kprobe and uprobe programs
  selftests/bpf: add tests for sleepable kprobes and uprobes

 include/linux/bpf.h                           | 96 +++++++++++++++++++
 include/linux/filter.h                        | 34 -------
 include/linux/trace_events.h                  |  1 +
 kernel/bpf/core.c                             | 10 +-
 kernel/bpf/syscall.c                          |  8 ++
 kernel/bpf/verifier.c                         |  4 +-
 kernel/trace/bpf_trace.c                      | 23 +++++
 kernel/trace/trace_uprobe.c                   |  4 +-
 tools/lib/bpf/libbpf.c                        | 10 +-
 .../selftests/bpf/prog_tests/attach_probe.c   | 35 +++++++
 .../selftests/bpf/progs/test_attach_probe.c   | 44 +++++++++
 11 files changed, 228 insertions(+), 41 deletions(-)

--
2.35.1

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

end of thread, other threads:[~2022-05-02 17:31 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 16:53 [PATCH bpf-next 0/5] sleepable uprobe support Delyan Kratunov
2022-04-28 16:53 ` [PATCH bpf-next 4/5] libbpf: add support for sleepable kprobe and uprobe programs Delyan Kratunov
2022-04-28 18:33   ` Andrii Nakryiko
2022-04-28 19:11     ` Delyan Kratunov
2022-04-28 16:53 ` [PATCH bpf-next 5/5] selftests/bpf: add tests for sleepable kprobes and uprobes Delyan Kratunov
2022-04-28 18:41   ` Andrii Nakryiko
2022-04-28 16:53 ` [PATCH bpf-next 1/5] bpf: move bpf_prog to bpf.h Delyan Kratunov
2022-04-28 16:54 ` [PATCH bpf-next 2/5] bpf: implement sleepable uprobes by chaining tasks and normal rcu Delyan Kratunov
2022-04-28 18:19   ` Andrii Nakryiko
2022-04-28 19:15     ` Delyan Kratunov
2022-04-28 20:58       ` Alexei Starovoitov
2022-04-28 21:35         ` Delyan Kratunov
2022-04-28 22:52           ` Alexei Starovoitov
2022-05-02 17:31             ` Delyan Kratunov
2022-04-28 16:54 ` [PATCH bpf-next 3/5] bpf: allow sleepable uprobe programs to attach Delyan Kratunov
2022-04-28 18:22   ` Andrii Nakryiko
2022-04-28 18:40     ` Alexei Starovoitov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.