Skip to content

Commit

Permalink
KVM: Avoid infinite-frequency local apic timer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
avikivity committed Mar 4, 2008
1 parent 24993d5 commit 0b975a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/x86/kvm/lapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0b975a3

Please sign in to comment.