Re: [PATCH v3 bpf-next 6/6] Documentation/bpf: Update btf doc with updated vlen, kind sizes

Alan Maguire
2026-04-20T08:10:02Z

On 17/04/2026 16:39, bot+bpf-ci@kernel.org wrote:
>> diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst
>> index 3b60583f5db2..3f05f17990ad 100644
>> --- a/Documentation/bpf/btf.rst
>> +++ b/Documentation/bpf/btf.rst
>> @@ -97,10 +97,8 @@ Each type contains the following common data::
>> struct btf_type {
>> __u32 name_off;
>> /* "info" bits arrangement
>> - * bits 0-15: vlen (e.g. # of struct's members)
>> - * bits 16-23: unused
>> - * bits 24-28: kind (e.g. int, ptr, array...etc)
>> - * bits 29-30: unused
>> + * bits 0-23: vlen (e.g. # of struct's members)
>> + * bits 24-30: kind (e.g. int, ptr, array...etc)
>
> Does the kind field documentation accurately match the UAPI implementation?
> The UAPI defines BTF_INFO_KIND as:
>
> #define BTF_INFO_KIND(info) (((info) >> 24) & 0x7f)
>
> The mask 0x7f is 7 bits, which means kind occupies bits 24-30. This
> documentation shows "bits 24-30" which appears correct.
>
> However, checking the actual implementation confirms the kind field uses
> only 7 bits (0x7f mask), leaving bit 31 exclusively for kind_flag.
>

maybe I'm misreading this (I've reread it several times) but I think the AI has
misfired here; it's seems be questioning whether the docs match the UAPI change
while at the same time confirming they match the UAPI change. Again I may be
missing something...

>
> Should the documentation have removed the "bits 16-23: unused" description?
> The previous documentation listed bits 16-23 as unused, but after expanding
> vlen to bits 0-23, these bits are now part of vlen. The current bit
> allocation is:
>
> - Bits 0-23: vlen (24 bits)
> - Bits 24-30: kind (7 bits)
> - Bit 31: kind_flag (1 bit)
>
> The patch removes the "bits 16-23: unused" line from the struct comment,
> which correctly reflects that these bits are now part of the expanded vlen
> field.
>
>> * bit 31: kind_flag, currently used by
>> * struct, union, enum, fwd, enum64,
>> * decl_tag and type_tag
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/24570998051