diff options
author | Eddie Dong <eddie.dong@intel.com> | 2007-09-03 09:56:58 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:26 -0400 |
commit | 1b9778dae71dc64d3678d766c0f1fbed79c80f9f (patch) | |
tree | 3196bbfe474119a849f35aefddb5e0922205850f /drivers/kvm/vmx.c | |
parent | 6e5d865c0b9679b00b5e5f0754c9fc2b6b9894d6 (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/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 5c2c6e71abf2..eeecadf5da46 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -2151,7 +2151,9 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu) | |||
2151 | { | 2151 | { |
2152 | u32 idtv_info_field, intr_info_field; | 2152 | u32 idtv_info_field, intr_info_field; |
2153 | int has_ext_irq, interrupt_window_open; | 2153 | int has_ext_irq, interrupt_window_open; |
2154 | int vector; | ||
2154 | 2155 | ||
2156 | kvm_inject_pending_timer_irqs(vcpu); | ||
2155 | update_tpr_threshold(vcpu); | 2157 | update_tpr_threshold(vcpu); |
2156 | 2158 | ||
2157 | has_ext_irq = kvm_cpu_has_interrupt(vcpu); | 2159 | has_ext_irq = kvm_cpu_has_interrupt(vcpu); |
@@ -2183,9 +2185,11 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu) | |||
2183 | interrupt_window_open = | 2185 | interrupt_window_open = |
2184 | ((vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) && | 2186 | ((vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) && |
2185 | (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0); | 2187 | (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0); |
2186 | if (interrupt_window_open) | 2188 | if (interrupt_window_open) { |
2187 | vmx_inject_irq(vcpu, kvm_cpu_get_interrupt(vcpu)); | 2189 | vector = kvm_cpu_get_interrupt(vcpu); |
2188 | else | 2190 | vmx_inject_irq(vcpu, vector); |
2191 | kvm_timer_intr_post(vcpu, vector); | ||
2192 | } else | ||
2189 | enable_irq_window(vcpu); | 2193 | enable_irq_window(vcpu); |
2190 | } | 2194 | } |
2191 | 2195 | ||