]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
KVM: Avoid double interrupt injection with vapic
authorAvi Kivity <avi@redhat.com>
Mon, 25 Oct 2010 13:23:55 +0000 (15:23 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 12 Jan 2011 09:23:36 +0000 (11:23 +0200)
After an interrupt injection, the PPR changes, and we have to reflect that
into the vapic.  This causes a KVM_REQ_EVENT to be set, which causes the
whole interrupt injection routine to be run again (harmlessly).

Optimize by only setting KVM_REQ_EVENT if the ppr was lowered; otherwise
there is no chance that a new injection is needed.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/lapic.c

index 413f8973a85575975a98eabf3b43d42063946e43..93cf9d0d36532621495dea80d5cd28589a5de15d 100644 (file)
@@ -277,7 +277,8 @@ static void apic_update_ppr(struct kvm_lapic *apic)
 
        if (old_ppr != ppr) {
                apic_set_reg(apic, APIC_PROCPRI, ppr);
-               kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
+               if (ppr < old_ppr)
+                       kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
        }
 }