From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Alan Maguire <alan.maguire@oracle.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Jiri Olsa <jolsa@kernel.org>, Song Liu <song@kernel.org>,
Tejun Heo <tj@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
sched-ext@lists.linux.dev
Subject: Re: [PATCH bpf-next v3 1/6] libbpf: Separate interfaces shared with in-tree tools
Date: Tue, 24 Nov 2026 15:50:14 -0700 [thread overview]
Message-ID: <10ad779b-708b-4b0b-b6af-54f3d7414f82@linux.dev> (raw)
In-Reply-To: <20261124224811.16134-2-ihor.solodrai@linux.dev>
On 2026-11-24 3:48 p.m., Ihor Solodrai wrote:
> resolve_btfids and bpftool link libbpf statically and use some of its
> internal helpers from libbpf_internal.h. That header also defines
> logging macros and poisons kernel integer typedefs, so resolve_btfids
> wraps the SHA-256 helper in a separate source file.
>
> Move the declarations these tools use to libbpf_tools.h and include it
> instead of libbpf_internal.h. The header is for in-tree tools and stays
> uninstalled. No shared-library symbols change.
>
> No functional change.
I posted v3 with the refactoring as described in my comment [1].
However now I'm thinking it might be an overkill. With the re-design
vs v1, resolve_btfids now only needs btf_kfunc_proto_match(), if it
includes relo_core.h, so the new libbpf_tools.h is not as appealing.
Speaking of "API levels", libbpf_internal.h has already been
functioning as the "in-tree users only", and there is another special
user among those: the selftests (see paste below). So if v3 is landed
as posted, we now have two "levels" of in-tree users.
It's... fine, but not exciting. Adding libbpf_tools.h doesn't help
that much, and dropping it doesn't hurt. It's all bikeshedding, not
directly relevant to the series, ultimately caused by name collisions
between resolve_btfids and libbpf (u32 poisoning and pr_* macros).
Quentin, Andrii, Eduard, please let me know if anyone has a strong
preference here, I'm happy to respin. Thanks!
[1]
https://lore.kernel.org/bpf/faecfef3-ac9f-41be-8bc3-83a66572066a@linux.dev/
$ grep -rl --include="*.[ch]" 'include.*libbpf_internal.h'
tools/testing/selftests/bpf
tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c
tools/testing/selftests/bpf/prog_tests/btf_field_iter.c
tools/testing/selftests/bpf/prog_tests/btf_sanitize.c
tools/testing/selftests/bpf/prog_tests/core_reloc_raw.c
tools/testing/selftests/bpf/prog_tests/cpu_mask.c
tools/testing/selftests/bpf/prog_tests/fill_link_info.c
tools/testing/selftests/bpf/prog_tests/get_smp_processor_id.c
tools/testing/selftests/bpf/prog_tests/global_data_init.c
tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
tools/testing/selftests/bpf/prog_tests/kprobe_multi_testmod_test.c
tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c
tools/testing/selftests/bpf/prog_tests/perf_branches.c
tools/testing/selftests/bpf/prog_tests/perf_buffer.c
tools/testing/selftests/bpf/prog_tests/raw_tp_test_run.c
tools/testing/selftests/bpf/prog_tests/recursive_attach.c
tools/testing/selftests/bpf/prog_tests/sha256.c
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
tools/testing/selftests/bpf/prog_tests/signed_loader.c
tools/testing/selftests/bpf/prog_tests/tracing_multi.c
tools/testing/selftests/bpf/urandom_read.c
tools/testing/selftests/bpf/urandom_read_lib1.c
tools/testing/selftests/bpf/trace_helpers.c
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> ---
> tools/bpf/bpftool/Makefile | 6 +-
> tools/bpf/bpftool/common.c | 2 +-
> tools/bpf/bpftool/gen.c | 3 +-
> tools/bpf/bpftool/prog.c | 2 +-
> tools/bpf/bpftool/xlated_dumper.c | 2 +-
> tools/bpf/resolve_btfids/btf_colors.c | 15 +--
> tools/bpf/resolve_btfids/btf_colors.h | 4 -
> tools/bpf/resolve_btfids/main.c | 5 +-
> tools/lib/bpf/libbpf_internal.h | 162 +----------------------
> tools/lib/bpf/libbpf_tools.h | 184 ++++++++++++++++++++++++++
> 10 files changed, 199 insertions(+), 186 deletions(-)
> create mode 100644 tools/lib/bpf/libbpf_tools.h
>
> [...]
next prev parent reply other threads:[~2026-11-24 22:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 22:48 [PATCH bpf-next v3 0/6] libbpf: Support kernel-side kfunc variants Ihor Solodrai
2026-11-24 22:48 ` [PATCH bpf-next v3 1/6] libbpf: Separate interfaces shared with in-tree tools Ihor Solodrai
2026-11-24 22:50 ` Ihor Solodrai [this message]
2026-11-24 22:48 ` [PATCH bpf-next v3 2/6] sched_ext: Prefer ___v2 kfunc names in compat.bpf.h Ihor Solodrai
2026-11-24 22:48 ` [PATCH bpf-next v3 3/6] libbpf: Resolve kfunc variants by prototype Ihor Solodrai
2026-11-24 22:48 ` [PATCH bpf-next v3 4/6] selftests/bpf: Test kfunc variant selection " Ihor Solodrai
2026-11-24 22:48 ` [PATCH bpf-next v3 5/6] resolve_btfids: Reject ambiguous kfunc variants Ihor Solodrai
2026-11-24 22:48 ` [PATCH bpf-next v3 6/6] docs/bpf: Describe how to change a kfunc's prototype Ihor Solodrai
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=10ad779b-708b-4b0b-b6af-54f3d7414f82@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=sched-ext@lists.linux.dev \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=yonghong.song@linux.dev \
/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