linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv6 bpf-next,perf/core 00/16] uprobe, bpf: Add session support
@ 2024-10-10 20:09 Jiri Olsa
  2024-10-10 20:09 ` [PATCHv6 perf/core 01/16] uprobe: Add data pointer to consumer handlers Jiri Olsa
                   ` (15 more replies)
  0 siblings, 16 replies; 34+ messages in thread
From: Jiri Olsa @ 2024-10-10 20:09 UTC (permalink / raw)
  To: Oleg Nesterov, Peter Zijlstra, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Steven Rostedt,
	Masami Hiramatsu, linux-kernel, linux-trace-kernel

hi,
this patchset is adding support for session uprobe attachment and
using it through bpf link for bpf programs.

The session means that the uprobe consumer is executed on entry
and return of probed function with additional control:
  - entry callback can control execution of the return callback
  - entry and return callbacks can share data/cookie

On more details please see patch #2.

The patchset is based on Peter's perf/core [1] tree merged in bpf-next/master.

There's an proposal from Andrii how to get this merged in [2]:

> I think uprobe parts should stay in tip/perf/core (if that's where all
> uprobe code goes in), as we have a bunch of ongoing work that all will
> conflict a bit with each other, if it lands across multiple trees.
> 
> So that means that patches #1 and #2 ideally land in tip/perf/core.
> But you have a lot of BPF-specific things that would be inconvenient
> to route through tip, so I'd say those should go through bpf-next.
> 
> What we can do, if Ingo and Peter are OK with that, is to create a
> stable (non-rebaseable) branch off of your first two patches (applied
> in tip/perf/core), which we'll merge into bpf-next/master and land the
> rest of your patch set there. We've done that with recent struct fd
> changes, and there were few other similar cases in the past, and that
> all worked well.
> 
> Peter, Ingo, are you guys OK with that approach?


v6 changes:
  - added acks [Andrii, Oleg]
  - added missing Fixes tags
  - added fix to force uprobe bpf program to always return 0 [Andrii]
  - separated kprobe session verifier check for return value check
    and squashed similar uprobe session fix in patch 5 [Andrii]
  - move session return handler check for cookie data to handle_uretprobe_chain [Andrii]
  - added threads the session test to speed it up
  - several smaller fixes [Andrii]

thanks,
jirka


[1] git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
[2] https://lore.kernel.org/bpf/CAEf4BzY8tGCstcD4BVBLPd0V92p--b_vUmQyWydObRJHZPgCLA@mail.gmail.com/
---
Jiri Olsa (16):
      uprobe: Add data pointer to consumer handlers
      uprobe: Add support for session consumer
      bpf: Allow return values 0 and 1 for kprobe session
      bpf: Force uprobe bpf program to always return 0
      bpf: Add support for uprobe multi session attach
      bpf: Add support for uprobe multi session context
      libbpf: Add support for uprobe multi session attach
      selftests/bpf: Add uprobe session test
      selftests/bpf: Add uprobe session cookie test
      selftests/bpf: Add uprobe session recursive test
      selftests/bpf: Add uprobe session verifier test for return value
      selftests/bpf: Add kprobe session verifier test for return value
      selftests/bpf: Add uprobe session single consumer test
      selftests/bpf: Scale down uprobe multi consumer test
      selftests/bpf: Add uprobe sessions to consumer test
      selftests/bpf: Add threads to consumer test

 include/linux/uprobes.h                                            |  25 ++++++-
 include/uapi/linux/bpf.h                                           |   1 +
 kernel/bpf/syscall.c                                               |   9 ++-
 kernel/bpf/verifier.c                                              |  10 +++
 kernel/events/uprobes.c                                            | 148 +++++++++++++++++++++++++++++--------
 kernel/trace/bpf_trace.c                                           |  63 +++++++++++-----
 kernel/trace/trace_uprobe.c                                        |  12 ++-
 tools/include/uapi/linux/bpf.h                                     |   1 +
 tools/lib/bpf/bpf.c                                                |   1 +
 tools/lib/bpf/libbpf.c                                             |  19 ++++-
 tools/lib/bpf/libbpf.h                                             |   4 +-
 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c              |   2 +-
 tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c         |   2 +
 tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c         | 336 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
 tools/testing/selftests/bpf/progs/kprobe_multi_verifier.c          |  31 ++++++++
 tools/testing/selftests/bpf/progs/uprobe_multi_consumers.c         |   6 +-
 tools/testing/selftests/bpf/progs/uprobe_multi_session.c           |  71 ++++++++++++++++++
 tools/testing/selftests/bpf/progs/uprobe_multi_session_cookie.c    |  48 ++++++++++++
 tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c |  44 +++++++++++
 tools/testing/selftests/bpf/progs/uprobe_multi_session_single.c    |  44 +++++++++++
 tools/testing/selftests/bpf/progs/uprobe_multi_verifier.c          |  31 ++++++++
 21 files changed, 808 insertions(+), 100 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi_verifier.c
 create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session.c
 create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session_cookie.c
 create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c
 create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session_single.c
 create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_verifier.c

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

end of thread, other threads:[~2024-10-16  6:41 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 20:09 [PATCHv6 bpf-next,perf/core 00/16] uprobe, bpf: Add session support Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 perf/core 01/16] uprobe: Add data pointer to consumer handlers Jiri Olsa
2024-10-15 22:24   ` Masami Hiramatsu
2024-10-16  6:41     ` Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 perf/core 02/16] uprobe: Add support for session consumer Jiri Olsa
2024-10-11 11:27   ` Oleg Nesterov
2024-10-16  0:07   ` Masami Hiramatsu
2024-10-10 20:09 ` [PATCHv6 bpf-next 03/16] bpf: Allow return values 0 and 1 for kprobe session Jiri Olsa
2024-10-11  2:19   ` Andrii Nakryiko
2024-10-10 20:09 ` [PATCHv6 bpf-next 04/16] bpf: Force uprobe bpf program to always return 0 Jiri Olsa
2024-10-11  2:20   ` Andrii Nakryiko
2024-10-10 20:09 ` [PATCHv6 bpf-next 05/16] bpf: Add support for uprobe multi session attach Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 bpf-next 06/16] bpf: Add support for uprobe multi session context Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 bpf-next 07/16] libbpf: Add support for uprobe multi session attach Jiri Olsa
2024-10-11  2:21   ` Andrii Nakryiko
2024-10-10 20:09 ` [PATCHv6 bpf-next 08/16] selftests/bpf: Add uprobe session test Jiri Olsa
2024-10-11  2:22   ` Andrii Nakryiko
2024-10-10 20:09 ` [PATCHv6 bpf-next 09/16] selftests/bpf: Add uprobe session cookie test Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 bpf-next 10/16] selftests/bpf: Add uprobe session recursive test Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 bpf-next 11/16] selftests/bpf: Add uprobe session verifier test for return value Jiri Olsa
2024-10-11  2:23   ` Andrii Nakryiko
2024-10-10 20:09 ` [PATCHv6 bpf-next 12/16] selftests/bpf: Add kprobe " Jiri Olsa
2024-10-11  2:24   ` Andrii Nakryiko
2024-10-10 20:09 ` [PATCHv6 bpf-next 13/16] selftests/bpf: Add uprobe session single consumer test Jiri Olsa
2024-10-11  2:25   ` Andrii Nakryiko
2024-10-11 11:33     ` Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 bpf-next 14/16] selftests/bpf: Scale down uprobe multi " Jiri Olsa
2024-10-11  2:27   ` Andrii Nakryiko
2024-10-11 11:36     ` Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 bpf-next 15/16] selftests/bpf: Add uprobe sessions to " Jiri Olsa
2024-10-11  2:30   ` Andrii Nakryiko
2024-10-11 11:36     ` Jiri Olsa
2024-10-10 20:09 ` [PATCHv6 bpf-next 16/16] selftests/bpf: Add threads " Jiri Olsa
2024-10-11  2:35   ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).