From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>
Subject: [PATCH bpf-next 00/11] Future-proof more tricky libbpf APIs
Date: Sun, 7 Nov 2021 22:13:05 -0800 [thread overview]
Message-ID: <20211108061316.203217-1-andrii@kernel.org> (raw)
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.
To validate that not just source code compatibility is preserved, but that
applications using libbpf as a shared library stay compatible as well, first
few patches extend selftests/bpf with another flavor of test_progs (-shared),
that compiles against libbpf.so. Using this flavor I've validated manually
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.
Currently, the way that selftests are set up we'll build three variants of BPF
object files (alu32, no-alu32, and alu32 but for shared flavor), which is
suboptimal. It is possible to rework Makefile to only generate alu32 vs
no-alu32 variants and use them in appropriate flavors, minimizing unnecessary
work. But that was left for follow up patches as there are already a lot of
changes across selftests and libbpf.
Andrii Nakryiko (11):
bpftool: normalize compile rules to specify output file last
selftests/bpf: minor cleanups and normalization of Makefile
selftests/bpf: allow to generate per-flavor list of tests
selftests/bpf: add test_progs flavor using libbpf as a shared lib
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 | 72 ++++++++++++--
tools/lib/bpf/btf_dump.c | 26 ++++--
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/.gitignore | 9 +-
tools/testing/selftests/bpf/Makefile | 93 +++++++++++--------
.../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 +-
tools/testing/selftests/bpf/test_maps.c | 4 +-
tools/testing/selftests/bpf/test_progs.c | 6 +-
.../selftests/bpf/test_tcpnotify_user.c | 4 +-
27 files changed, 363 insertions(+), 225 deletions(-)
--
2.30.2
next reply other threads:[~2021-11-08 6:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 6:13 Andrii Nakryiko [this message]
2021-11-08 6:13 ` [PATCH bpf-next 01/11] bpftool: normalize compile rules to specify output file last Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 02/11] selftests/bpf: minor cleanups and normalization of Makefile Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 03/11] selftests/bpf: allow to generate per-flavor list of tests Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 04/11] selftests/bpf: add test_progs flavor using libbpf as a shared lib Andrii Nakryiko
2021-11-09 3:44 ` Alexei Starovoitov
2021-11-09 15:42 ` Andrii Nakryiko
2021-11-09 17:53 ` Alexei Starovoitov
2021-11-10 0:52 ` Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 05/11] libbpf: turn btf_dedup_opts into OPTS-based struct Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 06/11] libbpf: ensure btf_dump__new() and btf_dump_opts are future-proof Andrii Nakryiko
2021-11-09 3:38 ` Alexei Starovoitov
2021-11-09 15:37 ` Andrii Nakryiko
2021-11-09 17:40 ` Alexei Starovoitov
2021-11-10 0:10 ` Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 07/11] libbpf: make perf_buffer__new() use OPTS-based interface Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 08/11] selftests/bpf: migrate all deprecated perf_buffer uses Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 09/11] selftests/bpf: update btf_dump__new() uses to v1.0+ variant Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 10/11] tools/runqslower: update perf_buffer__new() calls Andrii Nakryiko
2021-11-08 6:13 ` [PATCH bpf-next 11/11] bpftool: update btf_dump__new() and perf_buffer__new_raw() calls Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211108061316.203217-1-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox