Re: [PATCH v4 1/3] libbpf: load vmlinux BTF in gen_loader mode for struct_ops
From: Alexei Starovoitov
Date: Wed May 27 2026 - 10:17:37 EST
On Wed May 27, 2026 at 6:39 AM PDT, bot+bpf-ci wrote:
>> commit 29cedaf6d7d80a7e880a2e639f40fbafcbaf2e65
>> Author: Siddharth Nayyar <sidnayyar@xxxxxxxxxx>
>> Date: Wed May 27 12:52:57 2026 +0000
>>
>> libbpf: load vmlinux BTF in gen_loader mode for struct_ops
>>
>> During light skeleton generation (`bpftool gen skeleton -L`), libbpf
>> runs in gen_loader mode. Previously, `bpf_object__load_vmlinux_btf()`
>> completely bypassed loading the kernel vmlinux BTF (`obj->btf_vmlinux`)
>> if `gen_loader` was active.
>>
>> However, BPF `struct_ops` maps (such as `sched_ext_ops` maps) require
>> resolving the kernel-side struct type IDs and member sizes at
>> compile/skeleton generation time. Without loading `btf_vmlinux`, libbpf
>> cannot query the kernel BTF types, causing light skeleton generation for
>> `struct_ops` to fail or omit crucial type information.
>>
>> Fix this by modifying the check to load `btf_vmlinux` even in
>> `gen_loader` mode if the BPF object contains `struct_ops` maps.
>>
>> Signed-off-by: Siddharth Nayyar <sidnayyar@xxxxxxxxxx>
>
> Alexei Starovoitov requested in v3 review that a selftest be added to
> prove struct_ops light skeletons work end-to-end:
>
> "The selftest is mandatory to prove that."
> https://lore.kernel.org/bpf/CAADnVQ+AA_fmRw7uRwdL2TMyMbpWeebOQKb=0wvpKiQR6Ee5xQ@xxxxxxxxxxxxxx/
>
> This requirement has not been addressed in v4. Should a selftest be added
> to demonstrate that struct_ops light skeletons work correctly with this
> change?
thanks bot.
pw-bot: cr