Skip to content

BPF raw tracepoint support for BPF cookie

Andrii Nakryiko bpf 3 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 3 repliesApplied 5/5
  2. v25 patches 11 repliesSuperseded
  3. v15 patches 3 repliesSuperseded

Changes in v3 from the cover letter

- s/bpf_raw_tp_open/bpf_raw_tracepoint_open_opts/ (Alexei, Eduard);

Patches in v3 All 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: flatten bpf_probe_register call chainkernel/trace/bpf_trace.c+1 -60 repliesApplied
2/5bpf: pass whole link instead of prog when triggering raw tracepointinclude/linux/bpf.h include/linux/trace_events.h include/trace/bpf_probe.h +2 more+38 -332 repliesApplied
3/5bpf: support BPF cookie in raw tracepoint (raw_tp, tp_btf) programsinclude/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/syscall.c +2 more+28 -60 repliesApplied
4/5libbpf: add support for BPF cookie for raw_tp/tp_btf programstools/lib/bpf/bpf.c tools/lib/bpf/bpf.h tools/lib/bpf/libbpf.c +2 more+53 -51 replyApplied
5/5selftests/bpf: add raw_tp/tp_btf BPF cookie subteststools/testing/selftests/bpf/prog_tests/bpf_cookie.c tools/testing/selftests/bpf/progs/test_bpf_cookie.c+129 -10 repliesApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchStanislav FomichevEduard Zingerman
1/5A-b
2/5A-b
3/5A-b A-b
4/5A-b A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 bpf-next 0/5] BPF raw tracepoint support for BPF cookie

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.

v2->v3:
- s/bpf_raw_tp_open/bpf_raw_tracepoint_open_opts/ (Alexei, Eduard);
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(-)
Signature · 1 line
2.43.0