aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kvm/i8254.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-03-14 12:32:15 +0000
committerMark Brown <broonie@linaro.org>2014-03-14 12:32:15 +0000
commitf58d5ed0c4c47aa8dbcc4f7a58e4c52752ce6511 (patch)
treefb4b04d21b4d8654b0e7a615f2b3bc445b48d08c /arch/x86/kvm/i8254.c
parent8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff)
parenteb192460ccd50e73475b6092a8953ef7945921c8 (diff)
Merge branch 'linux-linaro-lsk-v3.10/be/32/core-20140413' of git://git.linaro.org/people/victor.kamensky/linux-linaro-tracking-be into lsk-v3.10-bev3.10/topic/old-arm64-bev3.10/topic/be
Diffstat (limited to 'arch/x86/kvm/i8254.c')
-rw-r--r--arch/x86/kvm/i8254.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 412a5aa0ef94..518d86471b76 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -37,6 +37,7 @@
#include "irq.h"
#include "i8254.h"
+#include "x86.h"
#ifndef CONFIG_X86_64
#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
@@ -349,6 +350,23 @@ static void create_pit_timer(struct kvm *kvm, u32 val, int is_period)
atomic_set(&ps->pending, 0);
ps->irq_ack = 1;
+ /*
+ * Do not allow the guest to program periodic timers with small
+ * interval, since the hrtimers are not throttled by the host
+ * scheduler.
+ */
+ if (ps->is_periodic) {
+ s64 min_period = min_timer_period_us * 1000LL;
+
+ if (ps->period < min_period) {
+ pr_info_ratelimited(
+ "kvm: requested %lld ns "
+ "i8254 timer period limited to %lld ns\n",
+ ps->period, min_period);
+ ps->period = min_period;
+ }
+ }
+
hrtimer_start(&ps->timer, ktime_add_ns(ktime_get(), interval),
HRTIMER_MODE_ABS);
}