A simple patch, just like suggested by Gilles, to avoid looping over periodic xntimer handlers in case of overruns.
It saves the current TSC on loop entry and uses this value later when forwarding the timer. Is is the overhead of re-reading the TSC on all archs negligible and should we rather go that way? Jan
--- ksrc/nucleus/timer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Index: xenomai/ksrc/nucleus/timer.c =================================================================== --- xenomai.orig/ksrc/nucleus/timer.c +++ xenomai/ksrc/nucleus/timer.c @@ -200,12 +200,13 @@ static void xntimer_do_tick_aperiodic(vo xntimerq_t *timerq = &sched->timerqueue; xntimerh_t *holder; xntimer_t *timer; + xnticks_t now; while ((holder = xntimerq_head(timerq)) != NULL) { timer = aplink2timer(holder); - if (xntimerh_date(&timer->aplink) - nkschedlat > - xnarch_get_cpu_tsc()) + now = xnarch_get_cpu_tsc(); + if (xntimerh_date(&timer->aplink) - nkschedlat > now) /* No need to continue in aperiodic mode since timeout dates are ordered by increasing values. */ break; @@ -236,8 +237,8 @@ static void xntimer_do_tick_aperiodic(vo } #endif /* CONFIG_XENO_OPT_DEBUG || __XENO_SIM__ */ } else if (timer->interval == XN_INFINITE) { - xntimerh_date(&timer->aplink) += - nkpod->htimer.interval; + while ((xntimerh_date(&timer->aplink) += + nkpod->htimer.interval) < now); continue; } } else
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core