Commit 0b975a3c authored by Avi Kivity's avatar Avi Kivity

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: default avatarAvi Kivity <avi@qumranet.com>
parent 24993d53
...@@ -647,6 +647,10 @@ static void start_apic_timer(struct kvm_lapic *apic) ...@@ -647,6 +647,10 @@ static void start_apic_timer(struct kvm_lapic *apic)
apic->timer.period = apic_get_reg(apic, APIC_TMICT) * apic->timer.period = apic_get_reg(apic, APIC_TMICT) *
APIC_BUS_CYCLE_NS * apic->timer.divide_count; APIC_BUS_CYCLE_NS * apic->timer.divide_count;
atomic_set(&apic->timer.pending, 0); atomic_set(&apic->timer.pending, 0);
if (!apic->timer.period)
return;
hrtimer_start(&apic->timer.dev, hrtimer_start(&apic->timer.dev,
ktime_add_ns(now, apic->timer.period), ktime_add_ns(now, apic->timer.period),
HRTIMER_MODE_ABS); HRTIMER_MODE_ABS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment