* [PATCH] KVM: x86: Add module parameter for lapic periodic timer limit
@ 2011-09-12 12:10 Jan Kiszka
2011-09-14 10:55 ` Marcelo Tosatti
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2011-09-12 12:10 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm
Certain guests, specifically RTOSes, request faster periodic timers than
what we allow by default. Add a module parameter to adjust the limit for
non-standard setups. Also add a rate-limited warning in case the guest
requested more.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/lapic.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 4b53b81..2fb20ca 100644
--- a/arch/x86/kvm/lapic.c
+++ b/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,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: x86: Add module parameter for lapic periodic timer limit
2011-09-12 12:10 [PATCH] KVM: x86: Add module parameter for lapic periodic timer limit Jan Kiszka
@ 2011-09-14 10:55 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2011-09-14 10:55 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm
On Mon, Sep 12, 2011 at 02:10:22PM +0200, Jan Kiszka wrote:
> Certain guests, specifically RTOSes, request faster periodic timers than
> what we allow by default. Add a module parameter to adjust the limit for
> non-standard setups. Also add a rate-limited warning in case the guest
> requested more.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> arch/x86/kvm/lapic.c | 15 +++++++++++++--
> 1 files changed, 13 insertions(+), 2 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-14 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-12 12:10 [PATCH] KVM: x86: Add module parameter for lapic periodic timer limit Jan Kiszka
2011-09-14 10:55 ` Marcelo Tosatti
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.