On 02.07.2025 16:41, Andrew Cooper wrote: > The check of this_softirq_pending must be performed with irqs disabled, but > this property was broken by an attempt to optimise entry/exit latency. > > Commit c227233ad64c in Linux (which we copied into Xen) was fixed up by > edc8fc01f608 in Linux, which we have so far missed. > > Going to sleep without waking on interrupts is nonsensical outside of > play_dead(), so overload this to select between two possible MWAITs, the > second using the STI shadow to cover MWAIT for exactly the same reason as we > do in safe_halt(). > > Fixes: b17e0ec72ede ("x86/mwait-idle: enable interrupts before C1 on Xeons") > Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
Reviewed-by: Jan Beulich <jbeul...@suse.com> with ... > --- a/xen/arch/x86/cpu/mwait-idle.c > +++ b/xen/arch/x86/cpu/mwait-idle.c > @@ -946,12 +946,8 @@ static void cf_check mwait_idle(void) > > update_last_cx_stat(power, cx, before); > > - if (cx->irq_enable_early) > - local_irq_enable(); > - > - mwait_idle_with_hints(cx->address, MWAIT_ECX_INTERRUPT_BREAK); > - > - local_irq_disable(); > + mwait_idle_with_hints(cx->address, > + cx->irq_enable_early ? 0 : > MWAIT_ECX_INTERRUPT_BREAK); ... indentation here switched to Linux style (to match the rest of the file). Jan