aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorEddie Dong <eddie.dong@intel.com>2007-09-03 09:56:58 -0400
committerAvi Kivity <avi@qumranet.com>2007-10-13 04:18:26 -0400
commit1b9778dae71dc64d3678d766c0f1fbed79c80f9f (patch)
tree3196bbfe474119a849f35aefddb5e0922205850f /drivers/kvm/svm.c
parent6e5d865c0b9679b00b5e5f0754c9fc2b6b9894d6 (diff)
KVM: Keep track of missed timer irq injections
APIC timer IRQ is set every time when a certain period expires at host time, but the guest may be descheduled at that time and thus the irq be overwritten by later fire. This patch keep track of firing irq numbers and decrease only when the IRQ is injected to guest or buffered in APIC. Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong@intel.com> Signed-off-by: Qing He <qing.he@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r--drivers/kvm/svm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index c8cd242f36ff..00119ec41669 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1331,7 +1331,9 @@ static void svm_intr_assist(struct vcpu_svm *svm)
1331{ 1331{
1332 struct vmcb *vmcb = svm->vmcb; 1332 struct vmcb *vmcb = svm->vmcb;
1333 int intr_vector = -1; 1333 int intr_vector = -1;
1334 struct kvm_vcpu *vcpu = &svm->vcpu;
1334 1335
1336 kvm_inject_pending_timer_irqs(vcpu);
1335 if ((vmcb->control.exit_int_info & SVM_EVTINJ_VALID) && 1337 if ((vmcb->control.exit_int_info & SVM_EVTINJ_VALID) &&
1336 ((vmcb->control.exit_int_info & SVM_EVTINJ_TYPE_MASK) == 0)) { 1338 ((vmcb->control.exit_int_info & SVM_EVTINJ_TYPE_MASK) == 0)) {
1337 intr_vector = vmcb->control.exit_int_info & 1339 intr_vector = vmcb->control.exit_int_info &
@@ -1344,7 +1346,7 @@ static void svm_intr_assist(struct vcpu_svm *svm)
1344 if (vmcb->control.int_ctl & V_IRQ_MASK) 1346 if (vmcb->control.int_ctl & V_IRQ_MASK)
1345 return; 1347 return;
1346 1348
1347 if (!kvm_cpu_has_interrupt(&svm->vcpu)) 1349 if (!kvm_cpu_has_interrupt(vcpu))
1348 return; 1350 return;
1349 1351
1350 if (!(vmcb->save.rflags & X86_EFLAGS_IF) || 1352 if (!(vmcb->save.rflags & X86_EFLAGS_IF) ||
@@ -1356,8 +1358,9 @@ static void svm_intr_assist(struct vcpu_svm *svm)
1356 return; 1358 return;
1357 } 1359 }
1358 /* Okay, we can deliver the interrupt: grab it and update PIC state. */ 1360 /* Okay, we can deliver the interrupt: grab it and update PIC state. */
1359 intr_vector = kvm_cpu_get_interrupt(&svm->vcpu); 1361 intr_vector = kvm_cpu_get_interrupt(vcpu);
1360 svm_inject_irq(svm, intr_vector); 1362 svm_inject_irq(svm, intr_vector);
1363 kvm_timer_intr_post(vcpu, intr_vector);
1361} 1364}
1362 1365
1363static void kvm_reput_irq(struct vcpu_svm *svm) 1366static void kvm_reput_irq(struct vcpu_svm *svm)