Commit 08cc334c authored by Philippe Gerum's avatar Philippe Gerum

ipipe/timer: apply minimum delay on close timer shot

When programming the timer, eagerly raising a timer IRQ by software
via the pipeline for close shots (i.e. below the clock chip's minimum
delay) may cause such event to happen too early for the co-kernel to
actually deliver it to any handler, which in turn may trigger yet
another request for programming the timer with too close a delay, and
so on, until the current time eventually matches some pending event

In such a case, the system may spend a lot of time trying to converge
on a proper trigger date by looping into the clock event handling
logic, delaying the co-kernel by the same amount.

To fix this, always go through the clock hardware for programming a
close shot with the minimum acceptable delay, which ensures that we
won't receive the next timer event too early.
parent 08bde997
......@@ -449,9 +449,10 @@ void ipipe_timer_set(unsigned long cdelay)
tdelay *= t->c2t_integ;
if (t->c2t_frac)
tdelay += ((unsigned long long)cdelay * t->c2t_frac) >> 32;
if (tdelay < t->min_delay_ticks)
tdelay = t->min_delay_ticks;
if (tdelay < t->min_delay_ticks
|| t->set(tdelay, t->timer_set) < 0)
if (t->set(tdelay, t->timer_set) < 0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment