It is the odp_timer_test (i.e. example) itself that is broken. It really depends on the scheduler being fair (distributing timeouts round robin to different waiting threads, each thread receiving the expected number of timeouts) but there is no guarantee for that. odp_schedule_one() was fairer but I don't think it actually *guaranteed* fairness.
With "unfair" scheduling of buffers to threads, the timer example must time out in the odp_schedule call otherwise the example cannot terminate cleanly. But odp_schedule timing out and returning ODP_BUFFER_INVALID doesn't mean the example has completed and the threads should terminate, it could just mean that this poor thread didn't receive any timeouts for some time but the example may still be running. So the "remain" counter must be checked and if more timeouts are expected, the thread must return to waiting for the scheduler. My previous fix for the removal of odp_schedule_one() didn't do just that, it actually also reset the latest timer the thread had received with a possible old timeout value, hence the ODP_TIMER_TOO_EARLY error message (old timeout value has already passed). There has a to be a loop around the call to odp_schedule() and continue invoking the scheduler as long as the example is running. On 14 January 2015 at 23:46, Mike Holmes <[email protected]> wrote: > Just tried, easy to replicate, same issue here > > odp_timer_test.c:151:test_abs_timeouts(): [6] timeout, tick 300 > odp_timer_test.c:151:test_abs_timeouts(): [6] timeout, tick 300 > odp_timer_test.c:125:test_abs_timeouts(): odp_timer_set_abs() failed: too > early > Aborted (core dumped) > > Let me make a proper bug for it while we work it out. > > > On 14 January 2015 at 17:39, Anders Roxell <[email protected]> wrote: >> >> Hi, >> >> I can't run the odp_timer_test example. >> >> odp_timer_test.c:151:test_abs_timeouts(): [7] timeout, tick 300 >> odp_timer_test.c:151:test_abs_timeouts(): [7] timeout, tick 300 >> odp_timer_test.c:151:test_abs_timeouts(): [1] timeout, tick 300 >> odp_timer_test.c:151:test_abs_timeouts(): [1] timeout, tick 300 >> odp_timer_test.c:151:test_abs_timeouts(): [1] timeout, tick 300 >> odp_timer_test.c:125:test_abs_timeouts(): odp_timer_set_abs() failed: too >> early >> zsh: abort ./example/timer/odp_timer_test >> >> >> I tracked down the bug to this commit with git bisect, didn't look >> closer into that patch 1100+ inserted lines... >> >> $ git bisect good >> 2d2e156c57921a45f656658f88ed9f79b16d7235 is the first bad commit >> commit 2d2e156c57921a45f656658f88ed9f79b16d7235 >> Author: Ola Liljedahl <[email protected]> >> Date: Thu Jan 8 22:35:22 2015 +0100 >> >> api: odp_timer.h: updated API, lock-less implementation >> >> The timer API is updated according to >> >> https://docs.google.com/a/linaro.org/document/d/1bfY_J8ecLJPsFTmYftb0NVmGnB9qkEc_NpcJ87yfaD8 >> A major change is that timers are allocated and freed separately from >> timeouts being set and cancelled. The life-length of a timer normally >> corresponds to the life-length of the associated stateful flow while >> the life-length of a timeout corresponds to individual packets being >> transmitted and received. >> The reference timer implementation is lock-less for platforms with >> support for 128-bit (16-byte) atomic exchange and CAS operations. >> Otherwise a lock-based implementation (using as many locks as desired) >> is used but some operations (e.g. reset reusing existing timeout >> buffer) >> may still be lock-less. >> Updated the example example/timer/odp_timer_test.c according to the >> updated API. >> >> Signed-off-by: Ola Liljedahl <[email protected]> >> Reviewed-by: Petri Savolainen <[email protected]> >> Reviewed-and-tested-by: Bill Fischofer <[email protected]> >> Signed-off-by: Mike Holmes <[email protected]> >> >> :040000 040000 c838290f76ee27fc70c183741fd9e376c3792043 >> 18c32996a1079e408c4443c0c22d40fb2095e068 M example >> :040000 040000 78264dcc08ba1199662183404f539f51a81c3861 >> 68b29ea04c87c6d1cc461cf71ab0e1c4d3af7b53 M platform >> >> >> Cheers, >> Anders >> >> _______________________________________________ >> lng-odp mailing list >> [email protected] >> http://lists.linaro.org/mailman/listinfo/lng-odp > > > > > -- > Mike Holmes > Linaro Sr Technical Manager > LNG - ODP > > _______________________________________________ > lng-odp mailing list > [email protected] > http://lists.linaro.org/mailman/listinfo/lng-odp > _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
