vmm: Use relative alarms for periodic LAPIC timers With relative alarms, we'll try to inject another IPI in X ticks from now, instead of X ticks from when we wanted the previous alarm to go off. If the VMM is descheduled for a long time, perhaps due to being an SCP or otherwise low-priority, the "incremental" alarms will build up, since we don't run our alarm handler immediately. If the guest clocks off the ticks, it'll have problems. If that happens, we can come up with something else. I tested tinycore by giving it the period it wanted * 2, and it thought time passed correctly (date). Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/tests/vmm/vmrunkernel.c b/tests/vmm/vmrunkernel.c index 584c95d..023dfe4 100644 --- a/tests/vmm/vmrunkernel.c +++ b/tests/vmm/vmrunkernel.c
@@ -341,7 +341,7 @@ if (vector && initial_count && timer_mode == 0x01) { /* This is periodic, we reset the alarm */ - set_awaiter_inc(waiter, initial_count << multiplier); + set_awaiter_rel(waiter, initial_count << multiplier); __set_alarm(waiter); }