From: Avi Kivity Date: Sun, 24 Feb 2008 12:37:50 +0000 (+0200) Subject: KVM: Avoid infinite-frequency local apic timer X-Git-Tag: v2.6.25-rc4~97^2~4 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=0b975a3c2d53829fa978e18fabae7d99031f588f;p=linux-2.6-omap-h63xx.git 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 --- diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 2cbee9479ce..68a6b151193 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) apic->timer.period = apic_get_reg(apic, APIC_TMICT) * APIC_BUS_CYCLE_NS * apic->timer.divide_count; atomic_set(&apic->timer.pending, 0); + + if (!apic->timer.period) + return; + hrtimer_start(&apic->timer.dev, ktime_add_ns(now, apic->timer.period), HRTIMER_MODE_ABS);