From: Jay Wang <wanjay@amazon.com>
To: <alan.maguire@oracle.com>
Cc: <abuehaze@amazon.com>, <andrii@kernel.org>, <arnd@arndb.de>,
<ast@kernel.org>, <bpf@vger.kernel.org>, <daniel@iogearbox.net>,
<doebel@amazon.de>, <eddyz87@gmail.com>,
<jay.wang.upstream@gmail.com>, <jolsa@kernel.org>,
<linux-kbuild@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-modules@vger.kernel.org>, <martin.lau@linux.dev>,
<mcgrof@kernel.org>, <memxor@gmail.com>, <mpohlack@amazon.de>,
<nathan@kernel.org>, <nsc@kernel.org>, <ojeda@kernel.org>,
<petr.pavlu@suse.com>, <rust-for-linux@vger.kernel.org>,
<samitolvanen@google.com>, <yonghong.song@linux.dev>
Subject: Re: [PATCH bpf-next v3 9/9] kbuild, bpf: allow building the vmlinux BTF as a module
Date: Thu, 1 Oct 2026 23:53:17 +0000 [thread overview]
Message-ID: <20261001235317.7760-1-wanjay@amazon.com> (raw)
In-Reply-To: <dbbb6cde-9889-4445-abf6-0486c380925d@oracle.com>
On 29/09/2026 19:25, Alan Maguire wrote:
> The idea is close to what you had; we have a .BTF.link / .BTF.inline.link ELF section which consists of:
>
> #define BTF_LINK_SHA256_LEN 32
>
> /*
> * A .BTF.link or .BTF.inline.link section identifies the module which
> * carries a vmlinux BTF section. The module name is NUL terminated and the
> * field is padded to __MODULE_NAME_LEN.
> */
> struct btf_link {
> char module_name[__MODULE_NAME_LEN];
> u8 sha256[BTF_LINK_SHA256_LEN];
> u32 btf_size;
> } __packed;
Thanks, this works well for this series too, and it also covers both
points of your first mail. v4 has it:
https://lore.kernel.org/bpf/20261001225214.12351-1-wanjay@amazon.com/
struct btf_link has this layout, and the kernel now takes the name of
the module to load from it: request_module() and the module notifier use
module_name instead of a hard-coded "btf_vmlinux" (patch 4/12).
> The link section is populated at the same time resolve_btfids populates the .BTF_ids section;
> we add support to resolve_btfids for a --btf_link option of the form
>
> --btf_link <section>:<module>:<raw-btf-file>
>
> So in your case it will be
>
> --btf_link .BTF:btf_vmlinux:vmlinux.BTF
That is what link-vmlinux.sh passes to the final --patch_btfids now,
with .tmp_vmlinux1.BTF as the file, which gen-btf.sh keeps for it with
=m (patch 12/12). The printf code in gen-btf.sh is gone.
Filling the record in at the end also removed v3's placeholder object
for the first link: the zeroed record is now defined in C next to
struct btf_link, so it has its final size in every link, and the size
check in resolve_btfids also catches the kernel and the tool disagreeing
on the layout.
> resolve_btfids is written to support multiple --btf_link options, so whichever work lands
> first could add the support that the other series uses. Hope this helps,
Your patch is 10/12, without the inline BTF context, which I will
leave to a separate patch series later. I reworded its subject and
changelog and made a few small changes, all listed in the bracketed
note above my Signed-off-by. Please check that you are fine with it in
that form.
Tested with 32- and 64-bit, little- and big-endian objects, also with
two --btf_link options in one run, and on x86-64 and i386 =m kernels,
where .BTF.link matches the BTF in btf_vmlinux.ko.
Jay
prev parent reply other threads:[~2026-10-01 23:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 22:42 [PATCH bpf-next v3 0/9] bpf: make the vmlinux BTF an on-demand loadable module (CONFIG_DEBUG_INFO_BTF=m) to save ~5.4 MB memory Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 1/9] bpf: pass the vmlinux BTF to btf_parse_module() and let it adopt the data Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 2/9] bpf: split the kfunc, dtor kfunc and struct_ops registration bodies Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 3/9] bpf: fetch the vmlinux BTF where kernel types enter a program Jay Wang
2026-09-25 23:10 ` sashiko-bot
2026-10-01 23:51 ` Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 4/9] bpf: take the vmlinux BTF from the btf_vmlinux module Jay Wang
2026-09-25 23:23 ` bot+bpf-ci
2026-10-01 23:51 ` Jay Wang
2026-09-26 8:29 ` Alexei Starovoitov
2026-10-01 23:51 ` Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 5/9] bpf: defer vmlinux kfunc and struct_ops registrations Jay Wang
2026-09-25 23:34 ` bot+bpf-ci
2026-10-01 23:52 ` Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 6/9] bpf: keep module BTF until the vmlinux BTF is available Jay Wang
2026-09-25 22:59 ` sashiko-bot
2026-10-01 23:52 ` Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 7/9] bpf: expose deferred .BTF.base module BTF in sysfs from module load Jay Wang
2026-09-25 23:23 ` bot+bpf-ci
2026-10-01 23:52 ` Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 8/9] bpf, trace, net: prepare CONFIG_DEBUG_INFO_BTF checks for a tristate Jay Wang
2026-09-25 23:23 ` bot+bpf-ci
2026-10-01 23:53 ` Jay Wang
2026-09-25 22:42 ` [PATCH bpf-next v3 9/9] kbuild, bpf: allow building the vmlinux BTF as a module Jay Wang
2026-09-25 23:34 ` bot+bpf-ci
2026-10-01 23:53 ` Jay Wang
2026-09-28 10:00 ` Alan Maguire
[not found] ` <DM6PR18MB2666F6B235D5B356AA157A7DA98D2@DM6PR18MB2666.namprd18.prod.outlook.com>
2026-09-29 18:25 ` Alan Maguire
2026-10-01 23:53 ` Jay Wang [this message]
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=20261001235317.7760-1-wanjay@amazon.com \
--to=wanjay@amazon.com \
--cc=abuehaze@amazon.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=doebel@amazon.de \
--cc=eddyz87@gmail.com \
--cc=jay.wang.upstream@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mcgrof@kernel.org \
--cc=memxor@gmail.com \
--cc=mpohlack@amazon.de \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.