diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-07-27 23:41:01 -0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-24 08:44:10 -0700 |
commit | 47c69905b9d2d8ffa5f74845f0ccbff1ee0028f0 (patch) | |
tree | 69831b2880ace2e1fb457398d7cd6bd4895f0512 /arch/x86/kvm | |
parent | eac89540d832baac64c018c3952926e12e04b72c (diff) |
KVM: limit lapic periodic timer frequency
commit 1444885a045fe3b1905a14ea1b52540bf556578b upstream.
Otherwise its possible to starve the host by programming lapic timer
with a very high frequency.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/lapic.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index ae99d83f81a3..bb6277d5b2c0 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -573,6 +573,15 @@ static void start_apic_timer(struct kvm_lapic *apic) if (!apic->lapic_timer.period) return; + /* + * Do not allow the guest to program periodic timers with small + * interval, since the hrtimers are not throttled by the host + * scheduler. + */ + if (apic_lvtt_period(apic)) { + if (apic->lapic_timer.period < NSEC_PER_MSEC/2) + apic->lapic_timer.period = NSEC_PER_MSEC/2; + } hrtimer_start(&apic->lapic_timer.timer, ktime_add_ns(now, apic->lapic_timer.period), |