The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: dennis@kernel.org, tj@kernel.org, cl@gentwo.org,
	chris@chrisdown.name, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	andrii@kernel.org, daniel@iogearbox.net, acme@kernel.org,
	yonghong.song@linux.dev, eddyz87@gmail.com, martin.lau@linux.dev,
	nathan@kernel.org, ndesaulniers@google.com, morbo@google.com,
	justinstitt@google.com, llvm@lists.linux.dev
Subject: Re: [PATCH v2] percpu: do not put btf_type_tag on per-cpu variable declarations
Date: Wed, 2 Dec 2026 13:04:04 -0700	[thread overview]
Message-ID: <71419c88-4411-4962-946e-d01968e44cfe@linux.dev> (raw)
In-Reply-To: <DNAI9O880A4Z.3AT1X3EJ6KHCM@gmail.com>

Hi,

Some comments below, mostly for Alexei; Andrew you can ignore ;-)

On 12/2/26 11:48 AM, Alexei Starovoitov wrote:
> On Wed, Dec 02, 2026 at 11:03 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>> On Tue, 17 Nov 2026 14:08:24 -0800 Vineet Gupta <vineet.gupta@linux.dev> wrote:
>>
>>> and GCC warns:
>>>
>>> 	processor.h:232:36: warning: ignoring attributes applied to
>>> 	'struct cpuinfo_x86' after definition [-Wattributes]
>>>
>>> which -Werror turns into a build failure.
> It's a prep for GCC support.
>
>> Sorry, I've been hiding from this patch because I don't understand the
>> BTF stuff at all :( Would it be more appropriate for a BPF person to
>> handle this?
> The BPF side is fine.
> It's really GCC behavior. clang does fine as-is.

Because clang ignores the construct GCC warns about.

> It's arguable whether it's a gcc bug or correct behavior.
> I feel the latter.

A GCC bug was opened PR/128480 [1] to silent the warning but was 
rejected won't fix, for the right reasons.

The issue is btf_type_tag being applied to a variant of an aggregate.

     struct mce { int status; };
     extern __attribute__((btf_type_tag("percpu")))
            __typeof__(struct mce) injectm;

     $ gcc -c t.c
     t.c:3:15: warning: ignoring attributes applied to 'struct mce' 
after definition [-Wattributes]

That warning is legit: In dwarf, every variant of an aggregate shares 
one DIE, so a btf_type_tag on such a variant has nowhere to live and is 
dropped. clang just does it silently, gcc complains.

Thx,
-Vineet

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128480

>> otoh, Chris had a good look at the previous version so that and a few
>> weeks of -next exposure is enough.
> I think it better fits in Nick's build tree, since it's about GCC
> and less about bpf/btf.
> But if folks are fine I can take it into bpf-next.

      reply	other threads:[~2026-12-02 20:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 22:08 [PATCH v2] percpu: do not put btf_type_tag on per-cpu variable declarations Vineet Gupta
2026-11-24 18:35 ` Vineet Gupta
2026-12-02 16:35   ` Vineet Gupta
2026-12-02 19:03 ` Andrew Morton
2026-12-02 19:48   ` Alexei Starovoitov
2026-12-02 20:04     ` Vineet Gupta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71419c88-4411-4962-946e-d01968e44cfe@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chris@chrisdown.name \
    --cc=cl@gentwo.org \
    --cc=daniel@iogearbox.net \
    --cc=dennis@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=martin.lau@linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=tj@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox