All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, linux-kernel <linux-kernel@vger.kernel.org>,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH] x86/irqflags: Force a register output in native_save_fl()
Date: Thu, 18 Dec 2025 11:22:56 +0100	[thread overview]
Message-ID: <20251218102256.GP3707891@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CANn89iK6Gs_hNgvFH0EA+0rB2KkbTbke6ewMmpEeYteg20Ry-w@mail.gmail.com>

On Thu, Dec 18, 2025 at 11:15:37AM +0100, Eric Dumazet wrote:

> > >--- a/arch/x86/include/asm/irqflags.h
> > >+++ b/arch/x86/include/asm/irqflags.h
> > >@@ -18,14 +18,9 @@ extern __always_inline unsigned long native_save_fl(void)
> > > {
> > >       unsigned long flags;
> > >
> > >-      /*
> > >-       * "=rm" is safe here, because "pop" adjusts the stack before
> > >-       * it evaluates its effective address -- this is part of the
> > >-       * documented behavior of the "pop" instruction.
> > >-       */
> > >       asm volatile("# __raw_save_flags\n\t"
> > >                    "pushf ; pop %0"
> > >-                   : "=rm" (flags)
> > >+                   : "=r" (flags)
> > >                    : /* no input */
> > >                    : "memory");
> > >
> >
> > Maybe report a bug to the clang team?
> 
> This has been done 8 years ago. No progress so far...
> 
> They claim we should use __builtin_ia32_readeflags_u64 /
> __builtin_ia32_writeeflags_u64, which seems unlikely to please x86
> maintainers ?

Yeah, because the "rm" thing not being supported properly goes way
further than just this one case. And it really is abysmal that clang
hasn't managed to implement it in all that time :/

  parent reply	other threads:[~2025-12-18 10:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18  9:54 [PATCH] x86/irqflags: Force a register output in native_save_fl() Eric Dumazet
2025-12-18 10:12 ` H. Peter Anvin
2025-12-18 10:15   ` Eric Dumazet
2025-12-18 10:21     ` Eric Dumazet
2025-12-18 10:22     ` Peter Zijlstra [this message]
2025-12-18 10:58       ` Eric Dumazet
2025-12-18 17:41 ` Uros Bizjak
2025-12-19  8:35   ` Eric Dumazet

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=20251218102256.GP3707891@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.