diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-09-18 20:08:05 -0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-10-05 08:27:56 -0700 |
commit | d1dbc751eb2a4aaf628cc9dac6954e1bd1afc531 (patch) | |
tree | 9a2fc8195db260062260b64158c6675cb3a1b0f4 /arch | |
parent | 322622336aace4c8fbf9e97a96f9cfa91d3cefac (diff) |
KVM: limit lapic periodic timer frequency
(cherry picked from commit 1444885a045fe3b1905a14ea1b52540bf556578b)
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')
-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 f0b67f2cdd69..dba1f4d08f2c 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -635,6 +635,15 @@ static void start_apic_timer(struct kvm_lapic *apic) if (!apic->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->timer.period < NSEC_PER_MSEC/2) + apic->timer.period = NSEC_PER_MSEC/2; + } hrtimer_start(&apic->timer.dev, ktime_add_ns(now, apic->timer.period), |