@@ -836,12 +836,13 @@ static void kvm_kick_cpu(int cpu)
static void kvm_wait(u8 *ptr, u8 val)
{
- unsigned long flags;
+ bool disabled = irqs_disabled();
if (in_nmi())
return;
- local_irq_save(flags);
+ if (!disabled)
+ local_irq_disable();
if (READ_ONCE(*ptr) != val)
goto out;
@@ -851,13 +852,14 @@ static void kvm_wait(u8 *ptr, u8 val)
* for irq enabled case to avoid hang when lock info is overwritten
* in irq spinlock slowpath and no spurious interrupt occur to save us.
*/
- if (arch_irqs_disabled_flags(flags))
+ if (disabled)
halt();
else
safe_halt();
out:
- local_irq_restore(flags);
+ if (!disabled)
+ local_irq_enable();
}
#ifdef CONFIG_X86_32