public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM/x86: Do not clear SIPI while in SMM
@ 2024-04-16 20:47 Boris Ostrovsky
  2024-04-16 20:53 ` Paolo Bonzini
  0 siblings, 1 reply; 18+ messages in thread
From: Boris Ostrovsky @ 2024-04-16 20:47 UTC (permalink / raw)
  To: kvm; +Cc: seanjc, pbonzini, linux-kernel

When a processor is running in SMM and receives INIT message the interrupt
is left pending until SMM is exited. On the other hand, SIPI, which
typically follows INIT, is discarded. This presents a problem since sender
has no way of knowing that its SIPI has been dropped, which results in
processor failing to come up.

Keeping the SIPI pending avoids this scenario.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
I am not sure whether non-SMM cases should clear the bit.

 arch/x86/kvm/lapic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index cf37586f0466..4a57b69efc7f 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -3308,13 +3308,13 @@ int kvm_apic_accept_events(struct kvm_vcpu *vcpu)
 	}
 
 	/*
-	 * INITs are blocked while CPU is in specific states (SMM, VMX root
-	 * mode, SVM with GIF=0), while SIPIs are dropped if the CPU isn't in
-	 * wait-for-SIPI (WFS).
+	 * INIT/SIPI are blocked while CPU is in specific states (SMM, VMX root
+	 * mode, SVM with GIF=0).
 	 */
 	if (!kvm_apic_init_sipi_allowed(vcpu)) {
 		WARN_ON_ONCE(vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED);
-		clear_bit(KVM_APIC_SIPI, &apic->pending_events);
+		if (!is_smm(vcpu))
+			clear_bit(KVM_APIC_SIPI, &apic->pending_events);
 		return 0;
 	}
 
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-10-01  8:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-16 20:47 [PATCH] KVM/x86: Do not clear SIPI while in SMM Boris Ostrovsky
2024-04-16 20:53 ` Paolo Bonzini
2024-04-16 20:57   ` boris.ostrovsky
2024-04-16 22:03     ` Paolo Bonzini
2024-04-16 22:14       ` Sean Christopherson
2024-04-16 23:02         ` boris.ostrovsky
2024-04-16 22:56       ` boris.ostrovsky
2024-04-16 23:17         ` Sean Christopherson
2024-04-16 23:37           ` boris.ostrovsky
2024-04-17 12:40             ` Igor Mammedov
2024-04-17 13:58               ` boris.ostrovsky
2024-04-19 16:17                 ` boris.ostrovsky
2024-09-24  9:40                   ` Igor Mammedov
2024-09-24 21:59                     ` boris.ostrovsky
2024-09-27  1:22                       ` Eric Mackay
2024-09-27  9:28                         ` Igor Mammedov
2024-09-30 23:34                           ` Eric Mackay
2024-10-01  8:18                             ` Igor Mammedov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox