From: Nick Alcock <nick.alcock@oracle.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Alan Maguire <alan.maguire@oracle.com>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Clark Williams <williams@redhat.com>,
Yonghong Song <yonghong.song@linux.dev>,
dwarves@vger.kernel.org, Nick Alcock <nick.alcock@oracle.com>,
Kate Carcia <kcarcia@redhat.com>,
"Jose E. Marchesi" <jose.marchesi@oracle.com>
Subject: Re: [RFC 0/4] BTF archive with unmodified pahole+toolchain
Date: Fri, 08 Aug 2025 15:45:24 +0100 [thread overview]
Message-ID: <87bjopj2ij.fsf@esperi.org.uk> (raw)
In-Reply-To: <7F061596-C814-42DA-AD6A-F766B21A188A@gmail.com> (Arnaldo Carvalho de Melo's message of "Fri, 08 Aug 2025 00:25:46 -0300")
On 8 Aug 2025, Arnaldo Carvalho de Melo said:
> On August 7, 2025 11:52:51 PM GMT-03:00, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>>On Thu, Aug 7, 2025 at 7:36 PM Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
>
>>> On Thu, Aug 7, 2025, 11:09 PM Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>
>>Agree with that as well, but I'm just not easy about "BTF archives" :)
>>The name is too ambitious. Concatenated BTF sections is fine,
>>but let's not make a big deal out of it.
>
> Well, other proposals being discussed would add more metadata to
> traverse these archives, I was just tagging along on the jargon being
> created :-)
We don't actually need *much* more. I think concatenation is less than
ideal simply because it's hard to tell when to stop looking for more
archive members in a concatenated stream.
In the model Jose proposed (more or less the model split BTF is
basically already using), the first member is special, being the parent
and holding most of the shared types, vmlinux etc. Because it's special,
I think we want to be able to identify it even if you, say, take two
sections full of concatenated members and concatenate *them*. Just
relying on straight concat would have all the tools treating the second
vmlinux in that concatenated stream as if it were a module! If there was
a link field (or just a "stop here" bit), it could say "there are no
more members" reliably, or you could ask tools to hunt through
concatenated streams of BTF and tell you which ones in that stream look
like they're vmlinuxes (and all the non-vmlinuxes after those are
modules).
e.g. if you accidentally concatenated
vmlinux -> a -> b -> c
and
vmlinux -> d -> e -> f
You would get
vmlinux -> a -> b -> c -> vmlinux -> d -> e -> f
and it would be nice if the format could at least *tell* that the second
vmlinux *was* a vmlinux without relying on awful hacks like "oh it
contains basic integer or mm types, it must be vmlinux". We can do that
with a link field, or with one single bit saying "stop here", or with a
bit saying "this is the parent, start here". I don't mind which.
We could also do with a single field (long-existing in CTF, which calls
it "cuname") which lets you tell the source of types in different BTF
members. The first, the vmlinux/shared one, is easily identifiable, it's
first: but all the others need to be told apart somehow. Since each
corresponds to a module (in vmlinux) or a compilation unit containing
conflicted types (in userspace CTF), giving it *some* sort of optional
name field in the header seems necessary. I don't really mind what we
call the field: cuname, btf_name, member_name, file_name, anything.
> It was just convenient that an unmodified linker was concatenating
> everything and that from the existing BTF headers I could use a
> preexisting libbpf API, btf__add_btf() merge everything to then use
> another preexisting API, btf__dedup() to get to the same end result.
Yeah.
> I don't see, so far, any other use for a "BTF archive", only as a
> happy intermediate step from a one line change to the kernel to get
> the linker to have the BTF "Compile Units" put together in the same
> order as the DWARF ones for the final merge+dedup.
We use them in userspace. (I think I can converge enough, without BTF
format changes beyond this one, to completely eliminate .ctf in
userspace and just let us use BTF everywhere: but as described in
https://lore.kernel.org/dwarves/87bjpkmak2.fsf@esperi.org.uk/, the BTF
we're using will usually be archives of BTF stuck into a single ELF
section, whether we use a link field or concatenation or some weird
archive format like I used to, it's going to be multiple BTFs-full in a
great many programs).
--
NULL && (void)
next prev parent reply other threads:[~2025-08-08 14:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 18:25 [RFC 0/4] BTF archive with unmodified pahole+toolchain Arnaldo Carvalho de Melo
2025-08-07 18:25 ` [PATCH 1/4] libbpf: Simplify error handling removing needless repeated err checks Arnaldo Carvalho de Melo
2025-08-07 18:25 ` [PATCH 2/4] libbpf: Check if there is extra data at the end of a BTF Arnaldo Carvalho de Melo
2025-08-07 18:25 ` [PATCH 3/4] libbpf: Add support for detecting and dedup'ing a BTF archive Arnaldo Carvalho de Melo
2025-08-07 18:25 ` [PATCH 4/4] libbpf: Check if an ELF .BTF section is an archive and combine/dedup Arnaldo Carvalho de Melo
2025-08-07 18:46 ` [RFC 0/4] BTF archive with unmodified pahole+toolchain Arnaldo Carvalho de Melo
2025-08-07 20:23 ` Arnaldo Carvalho de Melo
2025-08-08 2:09 ` Alexei Starovoitov
[not found] ` <CA+JHD92DODDESCfwiiCs_ZQ5bGesK5NC+xe5EvONF5g+-Bg+9Q@mail.gmail.com>
2025-08-08 2:52 ` Alexei Starovoitov
2025-08-08 3:25 ` Arnaldo Carvalho de Melo
2025-08-08 3:33 ` Sam James
2025-08-08 3:54 ` Arnaldo Carvalho de Melo
2025-08-08 14:45 ` Nick Alcock [this message]
2025-08-08 15:15 ` Nick Alcock
2025-08-08 18:28 ` Eduard Zingerman
2025-08-08 19:10 ` Arnaldo Carvalho de Melo
2025-08-08 20:15 ` Eduard Zingerman
2025-08-08 20:59 ` Arnaldo Carvalho de Melo
2025-08-21 21:35 ` Nick Alcock
2025-08-27 0:14 ` Alexei Starovoitov
2025-09-15 10:11 ` Nick Alcock
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=87bjopj2ij.fsf@esperi.org.uk \
--to=nick.alcock@oracle.com \
--cc=alan.maguire@oracle.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=arnaldo.melo@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=jose.marchesi@oracle.com \
--cc=kcarcia@redhat.com \
--cc=namhyung@kernel.org \
--cc=williams@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox