x86/idle: Drop incorrect smp_mb() in mwait_idle_with_hints()

With the recent simplifications, it becomes obvious that smp_mb() isn't the
right barrier.  Strictly speaking, MONITOR is ordered as a load, but smp_rmb()
isn't correct either, as this only pertains to local ordering.  All we need is
a compiler barrier().

Merge the barier() into the monitor() itself, along with an explantion.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
(cherry picked from commit e7710dd843)
This commit is contained in:
Andrew Cooper committed 2025-07-07 22:52:21 +01:00
1 parent f5dd06f9b1
commit d6727b7e25
1 file changed
+5 -2
+5 -2
View File
@@ -66,8 +66,12 @@ static always_inline void monitor(
alternative_input("", "clflush (%[addr])", X86_BUG_CLFLUSH_MONITOR,
[addr] "a" (addr));
/*
* The memory clobber is a compiler barrier. Subseqeunt reads from the
* monitored cacheline must not be reordered over MONITOR.
*/
asm volatile ( "monitor"
:: "a" (addr), "c" (ecx), "d" (edx) );
:: "a" (addr), "c" (ecx), "d" (edx) : "memory" );
}
static always_inline void mwait(unsigned int eax, unsigned int ecx)
@@ -453,7 +457,6 @@ void mwait_idle_with_hints(unsigned int eax, unsigned int ecx)
const unsigned int *this_softirq_pending = &softirq_pending(cpu);
monitor(this_softirq_pending, 0, 0);
smp_mb();
if ( !*this_softirq_pending )
{
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.