diff options
author | Avi Kivity <avi@qumranet.com> | 2008-02-24 07:37:50 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-03-04 08:19:48 -0500 |
commit | 0b975a3c2d53829fa978e18fabae7d99031f588f (patch) | |
tree | 6423319b2f1e6437cae279bce0aad9d348e055d9 /arch/x86/kvm | |
parent | 24993d53495d1f9b844f8eb3ebd1b9efd3521617 (diff) |
KVM: Avoid infinite-frequency local apic timer
If the local apic initial count is zero, don't start a an hrtimer with infinite
frequency, locking up the host.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/lapic.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 2cbee9479ce4..68a6b1511934 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -647,6 +647,10 @@ static void start_apic_timer(struct kvm_lapic *apic) | |||
647 | apic->timer.period = apic_get_reg(apic, APIC_TMICT) * | 647 | apic->timer.period = apic_get_reg(apic, APIC_TMICT) * |
648 | APIC_BUS_CYCLE_NS * apic->timer.divide_count; | 648 | APIC_BUS_CYCLE_NS * apic->timer.divide_count; |
649 | atomic_set(&apic->timer.pending, 0); | 649 | atomic_set(&apic->timer.pending, 0); |
650 | |||
651 | if (!apic->timer.period) | ||
652 | return; | ||
653 | |||
650 | hrtimer_start(&apic->timer.dev, | 654 | hrtimer_start(&apic->timer.dev, |
651 | ktime_add_ns(now, apic->timer.period), | 655 | ktime_add_ns(now, apic->timer.period), |
652 | HRTIMER_MODE_ABS); | 656 | HRTIMER_MODE_ABS); |