BPF List
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 0/5] BPF raw tracepoint support for BPF cookie
@ 2024-03-18 18:40 Andrii Nakryiko
  2024-03-18 18:40 ` [PATCH v2 bpf-next 1/5] bpf: flatten bpf_probe_register call chain Andrii Nakryiko
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Andrii Nakryiko @ 2024-03-18 18:40 UTC (permalink / raw)
  To: bpf, ast, daniel, martin.lau; +Cc: andrii, kernel-team

Add ability to specify and retrieve BPF cookie for raw tracepoint programs.
Both BTF-aware (SEC("tp_btf")) and non-BTF-aware (SEC("raw_tp")) are
supported, as they are exactly the same at runtime.

This issue recently came up in production use cases, where custom tried to
switch from slower classic tracepoints to raw tracepoints and ran into this
limitation. Luckily, it's not that hard to support this for raw_tp programs.

v1->v2:
  - fixed type definition for stubs of bpf_probe_{register,unregister};
  - added __u32 :u32 and aligned raw_tp fields (Jiri);
  - added Stanislav's ack.

Andrii Nakryiko (5):
  bpf: flatten bpf_probe_register call chain
  bpf: pass whole link instead of prog when triggering raw tracepoint
  bpf: support BPF cookie in raw tracepoint (raw_tp, tp_btf) programs
  libbpf: add support for BPF cookie for raw_tp/tp_btf programs
  selftests/bpf: add raw_tp/tp_btf BPF cookie subtests

 include/linux/bpf.h                           |   6 +
 include/linux/trace_events.h                  |  36 +++---
 include/trace/bpf_probe.h                     |   3 +-
 include/uapi/linux/bpf.h                      |   6 +-
 kernel/bpf/syscall.c                          |  22 ++--
 kernel/trace/bpf_trace.c                      |  36 ++++--
 tools/include/uapi/linux/bpf.h                |   1 +
 tools/lib/bpf/bpf.c                           |  16 ++-
 tools/lib/bpf/bpf.h                           |   9 ++
 tools/lib/bpf/libbpf.c                        |  20 ++-
 tools/lib/bpf/libbpf.h                        |  11 ++
 tools/lib/bpf/libbpf.map                      |   2 +
 .../selftests/bpf/prog_tests/bpf_cookie.c     | 114 +++++++++++++++++-
 .../selftests/bpf/progs/test_bpf_cookie.c     |  16 +++
 14 files changed, 248 insertions(+), 50 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2024-03-19 16:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18 18:40 [PATCH v2 bpf-next 0/5] BPF raw tracepoint support for BPF cookie Andrii Nakryiko
2024-03-18 18:40 ` [PATCH v2 bpf-next 1/5] bpf: flatten bpf_probe_register call chain Andrii Nakryiko
2024-03-18 18:40 ` [PATCH v2 bpf-next 2/5] bpf: pass whole link instead of prog when triggering raw tracepoint Andrii Nakryiko
2024-03-18 18:40 ` [PATCH v2 bpf-next 3/5] bpf: support BPF cookie in raw tracepoint (raw_tp, tp_btf) programs Andrii Nakryiko
2024-03-19  9:19   ` Eduard Zingerman
2024-03-19 12:48     ` Jiri Olsa
2024-03-19 16:09       ` Andrii Nakryiko
2024-03-19 16:23         ` Jiri Olsa
2024-03-19 16:26         ` Eduard Zingerman
2024-03-18 18:40 ` [PATCH v2 bpf-next 4/5] libbpf: add support for BPF cookie for raw_tp/tp_btf programs Andrii Nakryiko
2024-03-19  7:20   ` Alexei Starovoitov
2024-03-19 16:15     ` Andrii Nakryiko
2024-03-19 10:41   ` Eduard Zingerman
2024-03-19 16:16     ` Andrii Nakryiko
2024-03-19 16:24       ` Eduard Zingerman
2024-03-19 16:27         ` Andrii Nakryiko
2024-03-18 18:40 ` [PATCH v2 bpf-next 5/5] selftests/bpf: add raw_tp/tp_btf BPF cookie subtests Andrii Nakryiko

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