From 7ce59f734046248232a3827b5e4e6f16795f8331 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 26 Oct 2007 10:55:50 +0100 Subject: [PATCH] LAPIC timer accounting fix Offset emulated local APIC timer so it doesn't tick during guest's timer related processing. Otherwise, guests using the local APIC for process accounting can see long sequences of process ticks incorrectly charged to interrupt processing. Signed-off-by: Ben Guthro Signed-off-by: Gary Grebus --- xen/arch/x86/hvm/vpt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 9ce8991594..ec0ac0b11c 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -307,6 +307,13 @@ void create_periodic_time( pt->period_cycles = (u64)period * cpu_khz / 1000000L; pt->one_shot = one_shot; pt->scheduled = NOW() + period; + /* + * Offset LAPIC ticks from other timer ticks. Otherwise guests which use + * LAPIC ticks for process accounting can see long sequences of process + * ticks incorrectly accounted to interrupt processing. + */ + if ( is_lvtt(v, irq) ) + pt->scheduled += period >> 1; pt->cb = cb; pt->priv = data; -- 2.30.2