Commit f57ad63a authored by Maxim Levitsky's avatar Maxim Levitsky Committed by Paolo Bonzini
Browse files

KVM: x86: ignore SIPIs that are received while not in wait-for-sipi state



In the commit 1c96dcce
("KVM: x86: fix apic_accept_events vs check_nested_events"),

we accidently started latching SIPIs that are received while the cpu is not
waiting for them.

This causes vCPUs to never enter a halted state.

Fixes: 1c96dcce ("KVM: x86: fix apic_accept_events vs check_nested_events")
Signed-off-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20201203143319.159394-2-mlevitsk@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent dee734a7
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -2892,9 +2892,9 @@ void kvm_apic_accept_events(struct kvm_vcpu *vcpu)
		else
			vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED;
	}
	if (test_bit(KVM_APIC_SIPI, &pe) &&
	    vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) {
	if (test_bit(KVM_APIC_SIPI, &pe)) {
		clear_bit(KVM_APIC_SIPI, &apic->pending_events);
		if (vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) {
			/* evaluate pending_events before reading the vector */
			smp_rmb();
			sipi_vector = apic->sipi_vector;
@@ -2902,6 +2902,7 @@ void kvm_apic_accept_events(struct kvm_vcpu *vcpu)
			vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
		}
	}
}

void kvm_lapic_init(void)
{