bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 0/9] Future-proof more tricky libbpf APIs
@ 2021-11-11  5:36 Andrii Nakryiko
  2021-11-11  5:36 ` [PATCH v2 bpf-next 1/9] bpftool: normalize compile rules to specify output file last Andrii Nakryiko
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Andrii Nakryiko @ 2021-11-11  5:36 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

This patch set continues the work of revamping libbpf APIs that are not
extensible, as they were added before we figured out all the intricacies of
building APIs that can preserve ABI compatibility (both backward and forward).

What makes them tricky is that (most of) these APIs are actively used by
multiple applications, so we need to be careful about refactoring them. See
individual patches for details, but the general approach is similar to
previous bpf_prog_load() API revamp. The biggest different and complexity is
in changing btf_dump__new(), because function overloading through macro magic
doesn't work based on number of arguments, as both new and old APIs have
4 arguments. Because of that, another overloading approach is taken; overload
happens based on argument types.

I've validated manually (by using local test_progs-shared flavor that is
compiling test_progs against libbpf as a shared library) that compiling "old
application" (selftests before being adapted to using new variants of revamped
APIs) are compiled and successfully run against newest libbpf version as well
as the older libbpf version (provided no new variants are used). All these
scenarios seem to be working as expected.

v1->v2:
  - add explicit printf_fn NULL check in btf_dump__new() (Alexei);
  - replaced + with || in __builtin_choose_expr() (Alexei);
  - dropped test_progs-shared flavor (Alexei).

Andrii Nakryiko (9):
  bpftool: normalize compile rules to specify output file last
  selftests/bpf: minor cleanups and normalization of Makefile
  libbpf: turn btf_dedup_opts into OPTS-based struct
  libbpf: ensure btf_dump__new() and btf_dump_opts are future-proof
  libbpf: make perf_buffer__new() use OPTS-based interface
  selftests/bpf: migrate all deprecated perf_buffer uses
  selftests/bpf: update btf_dump__new() uses to v1.0+ variant
  tools/runqslower: update perf_buffer__new() calls
  bpftool: update btf_dump__new() and perf_buffer__new_raw() calls

 tools/bpf/bpftool/Makefile                    | 16 ++--
 tools/bpf/bpftool/btf.c                       |  2 +-
 tools/bpf/bpftool/gen.c                       |  2 +-
 tools/bpf/bpftool/map_perf_ring.c             |  9 +-
 tools/bpf/runqslower/runqslower.c             |  6 +-
 tools/lib/bpf/btf.c                           | 46 ++++++----
 tools/lib/bpf/btf.h                           | 71 +++++++++++++--
 tools/lib/bpf/btf_dump.c                      | 31 +++++--
 tools/lib/bpf/libbpf.c                        | 70 +++++++++++----
 tools/lib/bpf/libbpf.h                        | 86 ++++++++++++++++---
 tools/lib/bpf/libbpf.map                      |  8 ++
 tools/lib/bpf/linker.c                        |  4 +-
 tools/testing/selftests/bpf/Makefile          | 32 +++----
 .../selftests/bpf/benchs/bench_ringbufs.c     |  8 +-
 tools/testing/selftests/bpf/btf_helpers.c     |  4 +-
 tools/testing/selftests/bpf/prog_tests/btf.c  | 46 ++--------
 .../bpf/prog_tests/btf_dedup_split.c          |  6 +-
 .../selftests/bpf/prog_tests/btf_dump.c       | 33 +++----
 .../selftests/bpf/prog_tests/btf_split.c      |  4 +-
 .../bpf/prog_tests/get_stack_raw_tp.c         |  5 +-
 .../selftests/bpf/prog_tests/kfree_skb.c      |  6 +-
 .../selftests/bpf/prog_tests/perf_buffer.c    |  6 +-
 .../selftests/bpf/prog_tests/xdp_bpf2bpf.c    |  7 +-
 .../selftests/bpf/test_tcpnotify_user.c       |  4 +-
 24 files changed, 318 insertions(+), 194 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2021-12-23 13:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11  5:36 [PATCH v2 bpf-next 0/9] Future-proof more tricky libbpf APIs Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 1/9] bpftool: normalize compile rules to specify output file last Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 2/9] selftests/bpf: minor cleanups and normalization of Makefile Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 3/9] libbpf: turn btf_dedup_opts into OPTS-based struct Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 4/9] libbpf: ensure btf_dump__new() and btf_dump_opts are future-proof Andrii Nakryiko
2021-12-22 14:55   ` Jiri Olsa
2021-12-22 22:14     ` Andrii Nakryiko
2021-12-23 10:23       ` Jiri Olsa
2021-12-23 13:16         ` Jiri Olsa
2021-11-11  5:36 ` [PATCH v2 bpf-next 5/9] libbpf: make perf_buffer__new() use OPTS-based interface Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 6/9] selftests/bpf: migrate all deprecated perf_buffer uses Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 7/9] selftests/bpf: update btf_dump__new() uses to v1.0+ variant Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 8/9] tools/runqslower: update perf_buffer__new() calls Andrii Nakryiko
2021-11-11  5:36 ` [PATCH v2 bpf-next 9/9] bpftool: update btf_dump__new() and perf_buffer__new_raw() calls Andrii Nakryiko
2021-11-12  0:59 ` [PATCH v2 bpf-next 0/9] Future-proof more tricky libbpf APIs Alexei Starovoitov

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).