From: Lai Jiangshan Date: Sat, 14 Aug 2021 03:51:29 +0000 (+0800) Subject: x86/kvm: Don't enable IRQ when IRQ enabled in kvm_wait X-Git-Tag: v5.15~336^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a40b2fd064bb7c0425c7cbdca2120cf0609a90a2;p=platform%2Fkernel%2Flinux-starfive.git x86/kvm: Don't enable IRQ when IRQ enabled in kvm_wait Commit f4e61f0c9add3 ("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 Cc: Peter Zijlstra (Intel) Signed-off-by: Lai Jiangshan Message-Id: <20210814035129.154242-1-jiangshanlai@gmail.com> Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index a26643dc..b656456 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -884,10 +884,11 @@ static void kvm_wait(u8 *ptr, u8 val) } else { local_irq_disable(); + /* safe_halt() will enable IRQ */ if (READ_ONCE(*ptr) == val) safe_halt(); - - local_irq_enable(); + else + local_irq_enable(); } }