Skip to content

Commit a40b2fd

Browse files
Lai Jiangshanbonzini
authored andcommitted
x86/kvm: Don't enable IRQ when IRQ enabled in kvm_wait
Commit f4e61f0 ("x86/kvm: Fix broken irq restoration in kvm_wait") replaced "local_irq_restore() when IRQ enabled" with "local_irq_enable() when IRQ enabled" to suppress a warnning. Although there is no similar debugging warnning for doing local_irq_enable() when IRQ enabled as doing local_irq_restore() in the same IRQ situation. But doing local_irq_enable() when IRQ enabled is no less broken as doing local_irq_restore() and we'd better avoid it. Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Lai Jiangshan <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 3cc4e14 commit a40b2fd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/x86/kernel/kvm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,10 +884,11 @@ static void kvm_wait(u8 *ptr, u8 val)
884884
} else {
885885
local_irq_disable();
886886

887+
/* safe_halt() will enable IRQ */
887888
if (READ_ONCE(*ptr) == val)
888889
safe_halt();
889-
890-
local_irq_enable();
890+
else
891+
local_irq_enable();
891892
}
892893
}
893894

0 commit comments

Comments
 (0)