On 25/06/2025 10:19 am, Jan Beulich wrote:
> On 24.06.2025 18:39, Andrew Cooper wrote:
>> They're not used by any other translation unit, so shouldn't live in
>> asm/processor.h, which is included almost everywhere.
>>
>> Our new toolchain baseline knows the MONITOR/MWAIT instructions, so use them
>> directly rather than using raw hex.
>>
>> Change the hint/extention parameters from long to int.  They're specified to
>> remain 32bit operands even 64-bit mode.
>>
>> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
> Reviewed-by: Jan Beulich <jbeul...@suse.com>

Thanks.

> We may need to undo this though if we ever meant to use mwait elsewhere, like
> for spinlocks. Many years ago that idea was entertained some, but it may well
> be that it was given up altogether by now.

If they need to move back into a header, that's fine, but it will be
something new.

That said, I'm not sure how useful it would be to mwait on a spinlock. 
You'd need the spinlock in its own cacheline or you'll get false wakeups
triggered by CPU which has the has the lock writing adjacent to the
lock.  Transitions in and out of idle like this are almost certainly
more expensive than a pause loop.

~Andrew

Reply via email to