Skip to content

Auto-guess program type on bpf_object__open

Andrii Nakryiko bpf netdev oe-lkp 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7tools: sync if_link.htools/include/uapi/linux/if_link.h+2 -00 replies
2/7libbpf: add bpf_program__get_{type, expected_attach_type) APIstools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h tools/lib/bpf/libbpf.map+18 -00 replies
3/7libbpf: add uprobe/uretprobe and tp/raw_tp section suffixestools/lib/bpf/libbpf.c+4 -00 replies
4/7libbpf: teach bpf_object__open to guess program typestools/lib/bpf/libbpf.c+36 -291 reply
5/7selftests/bpf: make a copy of subtest nametools/testing/selftests/bpf/test_progs.c+12 -50 replies
6/7selftests/bpf: make reference_tracking test use subteststools/testing/selftests/bpf/prog_tests/reference_tracking.c tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c+11 -100 replies
7/7selftest/bpf: get rid of a bunch of explicit BPF program type settingtools/testing/selftests/bpf/prog_tests/attach_probe.c tools/testing/selftests/bpf/prog_tests/core_reloc.c tools/testing/selftests/bpf/prog_tests/rdonly_maps.c +1 more+0 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/7] Auto-guess program type on bpf_object__open

This patch set's main goal is to teach bpf_object__open() (and its variants) to automatically derive BPF program type/expected attach type from section names, similarly to how bpf_prog_load() was doing it. This significantly improves user experience by eliminating yet another obvious-only-in-the-hindsight surprise, when using libbpf APIs.

There are a bunch of auxiliary clean-ups and improvements. E.g., bpf_program__get_type() and bpf_program__get_expected_attach_type() are added for completeness and symmetry with corresponding setter APIs. Some clean up and fixes in selftests/bpf are done as well.

Andrii Nakryiko (7):
tools: sync if_link.h
libbpf: add bpf_program__get_{type, expected_attach_type) APIs
libbpf: add uprobe/uretprobe and tp/raw_tp section suffixes
libbpf: teach bpf_object__open to guess program types selftests/bpf: make a copy of subtest name
selftests/bpf: make reference_tracking test use subtests selftest/bpf: get rid of a bunch of explicit BPF program type setting

 tools/include/uapi/linux/if_link.h            |  2 +
 tools/lib/bpf/libbpf.c                        | 80 ++++++++++++-------
 tools/lib/bpf/libbpf.h                        |  5 ++
 tools/lib/bpf/libbpf.map                      |  2 +
 .../selftests/bpf/prog_tests/attach_probe.c   |  5 --
 .../selftests/bpf/prog_tests/core_reloc.c     |  1 -
 .../selftests/bpf/prog_tests/rdonly_maps.c    |  4 -
 .../bpf/prog_tests/reference_tracking.c       |  3 +-
 .../selftests/bpf/progs/test_sk_lookup_kern.c | 18 ++---
 tools/testing/selftests/bpf/test_maps.c       |  4 -
 tools/testing/selftests/bpf/test_progs.c      | 17 ++--
 11 files changed, 83 insertions(+), 58 deletions(-)
Signature · 1 line
2.17.1