docs, resolve_btfids: Document kfunc BTF annotation emission

resolve_btfids now emits the bpf_kfunc and bpf_fastcall BTF decl tags and
the arena address_space(1) type attribute for kfuncs, which were
previously produced by pahole.

Reflect this in the in-tree comments and documentation.

Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://patch.msgid.link/20260807032029.78092-7-ihor.solodrai@linux.dev
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
This commit is contained in:
Ihor Solodrai 2026-08-06 20:20:29 -07:00 committed by Eduard Zingerman
parent 9f3881ecad
commit fd5425b673
3 changed files with 18 additions and 5 deletions

View File

@ -472,6 +472,13 @@ type. An example is shown below::
}
late_initcall(init_subsystem);
At kernel build time the ``resolve_btfids`` tool finds all kfuncs declared with
``BTF_KFUNCS_START()`` and emits their BTF annotations into the kernel's BTF.
For each kfunc it emits a ``bpf_kfunc`` BTF decl tag, a ``bpf_fastcall`` decl
tag when the kfunc is flagged ``KF_FASTCALL``, and the ``address_space(1)`` type
attribute on the return value and/or arguments flagged ``KF_ARENA_RET``,
``KF_ARENA_ARG1`` or ``KF_ARENA_ARG2`` (see section 2.8).
2.7 Specifying no-cast aliases with ___init
--------------------------------------------

View File

@ -147,11 +147,6 @@ Since Linux 5.2, if CONFIG_DEBUG_INFO_BTF is selected, the build system
generates BTF (BPF Type Format) from DWARF in vmlinux, a bit later from kernel
modules as well. This requires pahole v1.22 or later.
Since Linux 7.0, kfuncs annotated with KF_IMPLICIT_ARGS require pahole v1.26
or later. Without it, such kfuncs will have incorrect BTF prototypes in
vmlinux, causing BPF programs to fail to load with a "func_proto incompatible
with vmlinux" error. Many sched_ext kfuncs are affected.
It is found in the 'dwarves' or 'pahole' distro packages or from
https://fedorapeople.org/~acme/dwarves/.

View File

@ -58,6 +58,17 @@
* __BTF_ID__func__vfs_fallocate__5:
* .zero 4
* .word (1 << 3) | (1 << 1) | (1 << 2)
*
* In addition to resolving BTF IDs, resolve_btfids performs kernel-specific
* BTF-to-BTF transformations for kfuncs found in BTF_SET8_KFUNCS sets. For
* each such kfunc it:
*
* - emits a "bpf_kfunc" decl tag, and "bpf_fastcall" when KF_FASTCALL is set;
* - wraps the return value and/or arguments flagged KF_ARENA_RET,
* KF_ARENA_ARG1 or KF_ARENA_ARG2 with the "address_space(1)" type attribute;
* - rewrites the prototype of KF_IMPLICIT_ARGS kfuncs.
*
* These kfunc annotations were historically produced by pahole.
*/
#define _GNU_SOURCE