LAPIC timer accounting fix
authorKeir Fraser <keir@xensource.com>
Fri, 26 Oct 2007 09:55:50 +0000 (10:55 +0100)
committerKeir Fraser <keir@xensource.com>
Fri, 26 Oct 2007 09:55:50 +0000 (10:55 +0100)
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 <bguthro@virtualron.com>
Signed-off-by: Gary Grebus <ggrebus@virtualiron.com>
xen/arch/x86/hvm/vpt.c

index 9ce899159468cb3bc09bed8b6a733a453ff4f053..ec0ac0b11cd5ffb6730cc0a27388085bcb2e0e2b 100644 (file)
@@ -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;