Re: [PATCH bpf-next v1 1/8] bpf: Add BTF_ID_LIST_END and BTF_ID_LIST_SIZE macros

bot+bpf-ci
2025-10-29T19:41:17Z

[-- Attachment #1: Type: text/plain, Size: 1844 bytes --]

```
commit d616f53ce936875dd9f44cc77f9bed1198596463
Author: Ihor Solodrai <ihor.solodrai@linux.dev>

bpf: Add BTF_ID_LIST_END and BTF_ID_LIST_SIZE macros

This commit adds two new preprocessor macros to btf_ids.h for
calculating the size of BTF_ID_LIST arrays using pointer arithmetic
between a list and its __end marker.

> diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
> index 139bdecec..27a4724d5 100644
> --- a/include/linux/btf_ids.h
> +++ b/include/linux/btf_ids.h
> @@ -97,6 +97,16 @@ asm( \
> __BTF_ID_LIST(name, local) \
> extern u32 name[];
>
> +/*
> + * The BTF_ID_LIST_END macro may be used to denote an end
> + * of a BTF_ID_LIST. This enables calculation of the list
> + * size with BTF_ID_LIST_SIZE.
> + */
> +#define BTF_ID_LIST_END(name) \
> +BTF_ID_LIST(name##__end)
> +#define BTF_ID_LIST_SIZE(name) \
> +(name##__end - name)
> +

Are the fallback definitions missing for CONFIG_DEBUG_INFO_BTF=n?

Looking at the #else branch starting at line 228, all existing macros
like BTF_ID_LIST, BTF_ID, BTF_SET_START, etc. have fallback definitions.
These new macros BTF_ID_LIST_END and BTF_ID_LIST_SIZE only exist in the
CONFIG_DEBUG_INFO_BTF=y path. When CONFIG_DEBUG_INFO_BTF is disabled,
code using these macros will fail to compile.

While there's no current usage that would break, the API is incomplete
compared to the established pattern in this header where every macro
works in both config states.

> #define BTF_ID_LIST_GLOBAL(name, n) \
> __BTF_ID_LIST(name, globl)

```

---
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

In-Reply-To-Subject: `bpf: Add BTF_ID_LIST_END and BTF_ID_LIST_SIZE macros`
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/18919699520