[PATCH] kvm: Clear stale posted interrupts when restoring apic state.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrew Honig <ahonig@xxxxxxxxxx>

Prior to this change if userspace set the local apic state while there
was a posted interrupt waiting, then the posted interrupt would not be
cleared.

To fix this issue we clear all the not-yet-delivered posted interrupts
and put them in the apic, so that when userspace overwrites the apic,
registers, it also clears any posted interrupts.

Signed-off-by: Andrew Honig <ahonig@xxxxxxxxxx>
Signed-off-by: Peter Shier <pshier@xxxxxxxxxx>
---
 arch/x86/kvm/x86.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0046aa70205aa..cbb097946d32f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3163,6 +3163,9 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
 {
 	int r;
 
+	if (vcpu->arch.apicv_active)
+		kvm_x86_ops->sync_pir_to_irr(vcpu);
+
 	r = kvm_apic_set_state(vcpu, s);
 	if (r)
 		return r;
-- 
2.18.0.203.gfac676dfb9-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux