[Barrelfish-users] One-shot timer: deadline already elapsed
Chothia Zaheer
zchothia at student.ethz.ch
Wed Apr 3 19:37:32 CEST 2013
Hello again,
With oneshot_timer enabled, this assertion would regularly trip on nos6:
kernel 0: ** arch_set_timer: t = 10319, kernel_now = 10453
kernel 0 PANIC! kernel assertion "t > kernel_now" failed at ../kernel/arch/x86/timing.c:257
The code essentially assumes that kernel_now will not change during this sequence:
schedule() -> update_timer() -> arch_set_timer()
However, here is a scenario where that doesn't hold (occurs every few seconds):
* Setup a timer for the next deadline at t = 10319 which is in the future.
(In scheduler_rbed, line 386 with kernel_now = 10239, wcet = 80, etime = 0.)
* In the interim, an APIC timer interrupt arrives and kernel_now is updated to
t = 10453.
* update_timer resumes with timer = 10319 but that has already elapsed.
A simple fix is to ignore expired timer requests, but I don't know if this might
violate assumptions of the client code:
diff --git a/kernel/timer.c b/kernel/timer.c
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -31,7 +31,7 @@
{
systime_t timer = MIN(next_sched_timer, next_wakeup_timer);
assert(timer != 0);
- if (last_timer != timer) {
+ if (last_timer != timer && timer > kernel_now) {
#if 0 /* does not seem to create a problem */
if (timer == TIMER_INF) {
printk(LOG_WARN, "********* %s:%s() timer == TIMER_INF\n", __FILE__, __FUNCTION__);
Regards,
--Zaheer
More information about the Barrelfish-users
mailing list