aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/i8254.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2008-10-20 04:20:03 -0400
committerAvi Kivity <avi@redhat.com>2008-12-31 09:51:47 -0500
commitcc6e462cd54e64858ea25816df87d033229efe56 (patch)
tree3f34b8be2ec3eb63e06c223b1d75d7068a717318 /arch/x86/kvm/i8254.c
parent8fdb2351d51b040146f10a624387bbd102d851c0 (diff)
KVM: x86: Optimize NMI watchdog delivery
As suggested by Avi, this patch introduces a counter of VCPUs that have LVT0 set to NMI mode. Only if the counter > 0, we push the PIT ticks via all LAPIC LVT0 lines to enable NMI watchdog support. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8254.c')
-rw-r--r--arch/x86/kvm/i8254.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index b6fcf5a9e502..e665d1c623ca 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -620,11 +620,12 @@ static void __inject_pit_timer_intr(struct kvm *kvm)
620 * LVT0 to NMI delivery. Other PIC interrupts are just sent to 620 * LVT0 to NMI delivery. Other PIC interrupts are just sent to
621 * VCPU0, and only if its LVT0 is in EXTINT mode. 621 * VCPU0, and only if its LVT0 is in EXTINT mode.
622 */ 622 */
623 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 623 if (kvm->arch.vapics_in_nmi_mode > 0)
624 vcpu = kvm->vcpus[i]; 624 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
625 if (vcpu) 625 vcpu = kvm->vcpus[i];
626 kvm_apic_nmi_wd_deliver(vcpu); 626 if (vcpu)
627 } 627 kvm_apic_nmi_wd_deliver(vcpu);
628 }
628} 629}
629 630
630void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu) 631void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu)