A timer pool's tick starts at t0 (zero). Once the first period has passed,
the timer pool is scanned for any timers that have expired since t0 + 1.

Current code does an atomic fetch increment on the tick, but uses the
previous tick during timer expiration processing. What is needed is the
previous tick + 1.

The observable effect without this patch is that timers are expired one tick
period (timer resolution) later than they should be.

Signed-off-by: Brian Brooks <brian.bro...@linaro.org>
---
 platform/linux-generic/odp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_timer.c 
b/platform/linux-generic/odp_timer.c
index becea9d..b26ac6b 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -691,7 +691,7 @@ static void timer_notify(odp_timer_pool *tp)
        prev_tick = odp_atomic_fetch_inc_u64(&tp->cur_tick);
 
        /* Scan timer array, looking for timers to expire */
-       (void)odp_timer_pool_expire(tp, prev_tick);
+       (void)odp_timer_pool_expire(tp, prev_tick + 1);
 
        /* Else skip scan of timers. cur_tick was updated and next itimer
         * invocation will process older expiration ticks as well */
-- 
2.7.4

Reply via email to