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>
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;