From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Alan Maguire <alan.maguire@oracle.com>,
andrii@kernel.org, dwarves@vger.kernel.org, acme@kernel.org
Cc: bpf@vger.kernel.org, ast@kernel.org, eddyz87@gmail.com,
tj@kernel.org, kernel-team@meta.com
Subject: Re: [PATCH dwarves v1 0/3] btf_encoder: support for BPF magic kernel functions
Date: Tue, 4 Nov 2025 14:25:24 -0800 [thread overview]
Message-ID: <ba1650aa-fafd-49a8-bea4-bdddee7c38c9@linux.dev> (raw)
In-Reply-To: <517837f0-127e-42bc-83f4-2c85203ef468@oracle.com>
On 11/4/25 12:59 PM, Alan Maguire wrote:
> On 29/10/2025 19:02, Ihor Solodrai wrote:
>> This series implements BTF encoding of BPF kernel functions marked
>> with KF_MAGIC_ARGS flag in pahole.
>>
>> The kfunc flag indicates that the arguments of a kfunc with __magic
>> suffix are implicitly set by the verifier, and so pahole must emit two
>> functions to BTF:
>> * kfunc_impl() with the arguments matching kernel declaration
>> * kfunc() with __magic arguments omitted
>>
>> For more details see relevant patch series for BPF:
>> "bpf: magic kernel functions"
>>
>> This series is built upon KF_IMPLICIT_PROG_AUX_ARG support [1],
>> although the approach changed signifcantly to call it a v2.
>>
>> [1] https://lore.kernel.org/dwarves/20250924211512.1287298-1-ihor.solodrai@linux.dev/
>>
>> Ihor Solodrai (3):
>> btf_encoder: refactor btf_encoder__add_func_proto
>> btf_encoder: factor out btf_encoder__add_bpf_kfunc()
>> btf_encoder: support kfuncs with KF_MAGIC_ARGS flag
>>
>> btf_encoder.c | 292 ++++++++++++++++++++++++++++++++++++++------------
>> 1 file changed, 222 insertions(+), 70 deletions(-)
>>
>
> seems like we could potentially pull in patches 1 and 2 as cleanups
> prior to handling the KF_MAGIC/IMPLICIT change; would that be worthwhile?
>
Hi Alan.
Feel free to merge in the refactoring patches if you think they are
useful. No objections.
I've had another off-list discussion with Andrii, and I am going to
try implementing the next iteration of KF_IMPLICIT_ARGS (no magic,
sorry) feature via resolve_btfids in the kernel tree.
As you of course well know, maintaining backwards compatibility by
tracking pahole version and ensuring correct feature flags in the
Linux kernel build has been tiresome.
We are thinking to address this by separating BTF generation for the
kernel into two independent stages:
* generate BTF from DWARF with pahole
* then modify BTF with kernel-specific transformations (with
resolve_btfids, or however we rename it)
This will reduce the burden from pahole to know the kernel-specific
tweaks of the BTF: adding kfunc decl tags, handling kernel function
flags, etc. pahole will only be concerned with "generic" BTF
generation from DWARF.
This will also free us from the need to control exactly what pahole
features are available (maybe except specifying minimum version) in
the kernel build, because btf2btf transformations will live in the
Linux tree.
KF_IMPLICIT_ARGS will be the proof-of-concept for the approach. If it
works well, then eventually we can migrate existing kernel-specific
BTF generation out from pahole.
Let me know what you think about all this.
Thank you.
> Thanks!
>
> Alan
next prev parent reply other threads:[~2025-11-04 22:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 19:02 [PATCH dwarves v1 0/3] btf_encoder: support for BPF magic kernel functions Ihor Solodrai
2025-10-29 19:02 ` [PATCH dwarves v1 1/3] btf_encoder: refactor btf_encoder__add_func_proto Ihor Solodrai
2025-10-30 0:34 ` Eduard Zingerman
2025-10-29 19:02 ` [PATCH dwarves v1 2/3] btf_encoder: factor out btf_encoder__add_bpf_kfunc() Ihor Solodrai
2025-10-29 19:02 ` [PATCH dwarves v1 3/3] btf_encoder: support kfuncs with KF_MAGIC_ARGS flag Ihor Solodrai
2025-11-04 20:59 ` [PATCH dwarves v1 0/3] btf_encoder: support for BPF magic kernel functions Alan Maguire
2025-11-04 22:25 ` Ihor Solodrai [this message]
2025-11-04 22:33 ` Eduard Zingerman
2025-11-04 22:37 ` Ihor Solodrai
2025-11-14 18:33 ` Alan Maguire
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=ba1650aa-fafd-49a8-bea4-bdddee7c38c9@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=kernel-team@meta.com \
--cc=tj@kernel.org \
/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