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

From: Chris Down

Date: Fri Nov 13 2026 - 15:31:57 EST


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?

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.

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

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

Thanks!

Chris