From 0247586f76f5e37ca63285fee24e527e7b80a20d Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 12 Sep 2011 14:10:22 +0200 Subject: [PATCH] --- yaml --- r: 271523 b: refs/heads/master c: 9bc5791d4aa78b72abd76f506c0a391a54abc4d1 h: refs/heads/master i: 271521: b4080b22504b3db722d2e9336b4f4b4bc07c02f7 271519: b2538392cbe65abc73c24c6b5c9270a84ec7f36a v: v3 --- [refs] | 2 +- trunk/arch/x86/kvm/lapic.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index ee7121a68ab2..aa7ac0fe85ee 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bd80158aff71a80292f96d9baea1a65bc0ce87b3 +refs/heads/master: 9bc5791d4aa78b72abd76f506c0a391a54abc4d1 diff --git a/trunk/arch/x86/kvm/lapic.c b/trunk/arch/x86/kvm/lapic.c index 4b53b811d1c1..2fb20caae5d8 100644 --- a/trunk/arch/x86/kvm/lapic.c +++ b/trunk/arch/x86/kvm/lapic.c @@ -68,6 +68,9 @@ #define VEC_POS(v) ((v) & (32 - 1)) #define REG_POS(v) (((v) >> 5) << 4) +static unsigned int min_timer_period_us = 500; +module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR); + static inline u32 apic_get_reg(struct kvm_lapic *apic, int reg_off) { return *((u32 *) (apic->regs + reg_off)); @@ -677,8 +680,16 @@ static void start_apic_timer(struct kvm_lapic *apic) * scheduler. */ if (apic_lvtt_period(apic)) { - if (apic->lapic_timer.period < NSEC_PER_MSEC/2) - apic->lapic_timer.period = NSEC_PER_MSEC/2; + s64 min_period = min_timer_period_us * 1000LL; + + if (apic->lapic_timer.period < min_period) { + pr_info_ratelimited( + "kvm: vcpu %i: requested %lld ns " + "lapic timer period limited to %lld ns\n", + apic->vcpu->vcpu_id, apic->lapic_timer.period, + min_period); + apic->lapic_timer.period = min_period; + } } hrtimer_start(&apic->lapic_timer.timer,