瀏覽代碼

KVM: Avoid double interrupt injection with vapic

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>
Avi Kivity 14 年之前
父節點
當前提交
83bcacb1a5
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      arch/x86/kvm/lapic.c

+ 2 - 1
arch/x86/kvm/lapic.c

@@ -277,7 +277,8 @@ static void apic_update_ppr(struct kvm_lapic *apic)
 
 
 	if (old_ppr != ppr) {
 	if (old_ppr != ppr) {
 		apic_set_reg(apic, APIC_PROCPRI, 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);
 	}
 	}
 }
 }