Re: [RFC PATCH 1/2] percpu: do not put btf_type_tag on per-cpu variable declarations

From: Vineet Gupta

Date: Fri Nov 13 2026 - 17:36:20 EST


On 11/13/26 11:58 AM, Chris Down wrote:
Hi Vineet,

Vineet Gupta <vineet.gupta@xxxxxxxxx> writes:
The message is confusing: this is a declaration, not a definition. But
the compiler is right to object to a type tag on the aggregate, and the
issue is fundamental: every variant of an aggregate shares one DIE, so
there is nowhere to put it. clang drops it silently and GCC warns.
Not a big deal, but the definition in GCC's message is the definition of
struct cpuinfo_x86, not of cpu_info. It's saying the attribute is being
applied to the struct type after the struct was already defined, which is
accurate. So maybe just drop that first sentence?

Oops, thanks for catching that. I misread which definition it meant. Dropping the first sentence in v2.

I've tested this with clang 23 and GCC 16. With clang, the same 280 types
and 3360 bytes of BTF go away. Likewise, with GCC, the per-cpu
declarations no longer warn, and the non-enclosed address space errors
are gone.

Thanks for verifying, with both the compilers.

Once the commit message nits are fixed, please feel free to add:

Reviewed-by: Chris Down <chris@xxxxxxxxxxxxxx>
Tested-by: Chris Down <chris@xxxxxxxxxxxxxx>

Awesome, I'll add these in v2

Thx,
-Vineet