[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAEFD2WH7HRV.2SOG9Q00QSEXH@bootlin.com>
Date: Thu, 05 Jun 2025 09:35:15 +0200
From: Alexis Lothoré <alexis.lothore@...tlin.com>
To: "Ihor Solodrai" <ihor.solodrai@...ux.dev>, "Andrii Nakryiko"
<andrii.nakryiko@...il.com>
Cc: "Alexei Starovoitov" <ast@...nel.org>, "Daniel Borkmann"
<daniel@...earbox.net>, "John Fastabend" <john.fastabend@...il.com>,
"Andrii Nakryiko" <andrii@...nel.org>, "Martin KaFai Lau"
<martin.lau@...ux.dev>, "Eduard Zingerman" <eddyz87@...il.com>, "Song Liu"
<song@...nel.org>, "Yonghong Song" <yonghong.song@...ux.dev>, "KP Singh"
<kpsingh@...nel.org>, "Stanislav Fomichev" <sdf@...ichev.me>, "Hao Luo"
<haoluo@...gle.com>, "Jiri Olsa" <jolsa@...nel.org>, "Puranjay Mohan"
<puranjay@...nel.org>, "Xu Kuohai" <xukuohai@...weicloud.com>, "Catalin
Marinas" <catalin.marinas@....com>, "Will Deacon" <will@...nel.org>,
"Mykola Lysenko" <mykolal@...com>, "Shuah Khan" <shuah@...nel.org>, "Maxime
Coquelin" <mcoquelin.stm32@...il.com>, "Alexandre Torgue"
<alexandre.torgue@...s.st.com>, "Florent Revest" <revest@...omium.org>,
"Bastien Curutchet" <bastien.curutchet@...tlin.com>,
<ebpf@...uxfoundation.org>, "Thomas Petazzoni"
<thomas.petazzoni@...tlin.com>, <bpf@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kselftest@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>, <dwarves@...r.kernel.org>
Subject: Re: [Question] attributes encoding in BTF
Hi Ihor,
On Wed Jun 4, 2025 at 7:31 PM CEST, Ihor Solodrai wrote:
> On 6/4/25 2:02 AM, Alexis Lothoré wrote:
[...]
>> Could I be missing something obvious ? Or did I misunderstand the actual
>> attribute encoding feature ?
>
> Hi Alexis.
>
> The changes recently landed in pahole and libbpf re attributes had a
> very narrow goal: passing through particular attributes for some BPF
> kfuncs from the kernel source to vmlinux.h
>
> BTF now has a way of encoding any attribute (as opposed to only bpf
> type/decl tags) by setting type/decl tag kind flag [1]. So it is
> possible to represent attributes like packed and aligned in BTF.
>
> However, the BTF tags need to be generated by something, in case of
> vmlinux by pahole. Pahole generates BTF by parsing DWARF. And, as far as
> I understand, attributes are not (can not be?) represented in DWARF in a
> generic way, it really depends on specifics of the attribute.
>
> In order to support packed/aligned, pahole needs to know how to figure
> them out from DWARF input and add the tags to BTF. And this does not
> happen right now, which is why you don't see anything in bpftool output.
>
> [1]
> https://lore.kernel.org/bpf/20250130201239.1429648-1-ihor.solodrai@linux.dev/
Thanks for the details ! I have missed this possibility, as I have been
assuming that DWARF info was exposing the needed info. I'll take a look at
it, but if those attributes can not be represented by DWARF, I'll have to
find another way of getting those packing/alignment modifications on data
type (eg: re-use/share btf__align_of from libbpf, as suggested by Andrii,
but it may not able to cover all cases).
Thanks,
Alexis
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists