Skip to content

bpf/tracing: allow user space to query prog array on the same tp

Yonghong Song netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 4 repliesIn review
  2. v32 patches 3 repliesSuperseded
  3. v22 patches 3 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches3 repliesSuperseded

Changes in v4 from the cover letter

- Fix a compilation error with newer gcc like 6.3.1 while old gcc 4.8.5 is okay. I was using &uquery->ids to represent the address to the ids array to make it explicit that the address is passed, and this syntax is rightly rejected by gcc 6.3.1.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf/tracing: allow user space to query prog array on the same tpinclude/linux/bpf.h include/uapi/linux/perf_event.h kernel/bpf/core.c +2 more+73 -03 replies
2/2bpf/tracing: add a bpf test for new ioctl query interfacetools/include/uapi/linux/perf_event.h tools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/test_progs.c +1 more+183 -10 replies

Reviews trailers per patch

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

PatchPeter Zijlstra (Intel)Alexei Starovoitov
1/2A-b A-b
2/2A-b A-b

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

Read the v4 thread

Cover letter [PATCH net-next v4 0/2] bpf/tracing: allow user space to query prog array on the same tp

Commit e87c6bc3852b ("bpf: permit multiple bpf attachments for a single perf event") added support to attach multiple bpf programs to a single perf event. Given a perf event (kprobe, uprobe, or kernel tracepoint), the perf ioctl interface is used to query bpf programs attached to the same trace event.

There already exists a BPF_PROG_QUERY command for introspection currently used by cgroup+bpf. We did have an implementation for querying tracepoint+bpf through the same interface. However, it looks cleaner to use ioctl() style of api here, since attaching bpf prog to tracepoint/kuprobe is also done via ioctl.

Patch #1 had the core implementation and patch #2 added a test case in tools bpf selftests suite.

Changelogs:
v3 -> v4:
- Fix a compilation error with newer gcc like 6.3.1 while old gcc 4.8.5 is okay. I was using &uquery->ids to represent the address to the ids array to make it explicit that the address is passed, and this syntax is rightly rejected by gcc 6.3.1.
v2 -> v3:
- Change uapi structure perf_event_query_bpf to be more clearer based on Peter's suggestion, and adjust other codes accordingly.
v1 -> v2:
- Rebase on top of net-next.
- Use existing bpf_prog_array_length function instead of implementing the same functionality in function bpf_prog_array_copy_info.

Yonghong Song (2):
bpf/tracing: allow user space to query prog array on the same tp bpf/tracing: add a bpf test for new ioctl query interface

 include/linux/bpf.h                           |   4 +
 include/uapi/linux/perf_event.h               |  22 +++++
 kernel/bpf/core.c                             |  21 ++++
 kernel/events/core.c                          |   3 +
 kernel/trace/bpf_trace.c                      |  23 +++++
 tools/include/uapi/linux/perf_event.h         |  22 +++++
 tools/testing/selftests/bpf/Makefile          |   2 +-
 tools/testing/selftests/bpf/test_progs.c      | 134 ++++++++++++++++++++++++++
 tools/testing/selftests/bpf/test_tracepoint.c |  26 +++++
 9 files changed, 256 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/bpf/test_tracepoint.c
Signature · 1 line
2.9.5