On Fri, Jan 16, 2015 at 4:34 AM, Ola Liljedahl <[email protected]>
wrote:

> Since the scheduler does not guarantee fairness in scheduling, threads must
> time out and check if the example is still running. If so, just restart the
> scheduling, not the whole example loop which has (undesired) side effects.
> The bug was caused by restarting the example loop which then reset the last
> used timer with an old tick value, this could eventually fail (because that
> tick value was in the past) with the too late error message.
>
> https://bugs.linaro.org/show_bug.cgi?id=1068
>
> Reported-by: [email protected]
> Reported-by: [email protected]
> Signed-off-by: Ola Liljedahl <[email protected]>
>

Reviewed-and-tested-by: Bill Fischofer <[email protected]>


> ---
> (This document/code contribution attached is provided under the terms of
> agreement LES-LTM-21309)
>
>  example/timer/odp_timer_test.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/example/timer/odp_timer_test.c
> b/example/timer/odp_timer_test.c
> index 5de499b..d18378a 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -125,14 +125,23 @@ static void test_abs_timeouts(int thr, test_args_t
> *args)
>                                       timerset2str(rc));
>                 }
>
> -               /* Get the next expired timeout */
> -               /* Use 1.5 second timeout for scheduler */
> -               uint64_t sched_tmo = odp_schedule_wait_time(1500000000ULL);
> -               buf = odp_schedule(&queue, sched_tmo);
> -               /* Check if odp_schedule() timed out, possibly there are no
> -                * remaining timeouts to receive */
> +               /* Get the next expired timeout.
> +                * We invoke the scheduler in a loop with a timeout because
> +                * we are not guaranteed to receive any more timeouts. The
> +                * scheduler isn't guaranteeing fairness when scheduling
> +                * buffers to threads.
> +                * Use 1.5 second timeout for scheduler */
> +               uint64_t sched_tmo =
> +                       odp_schedule_wait_time(1500000000ULL);
> +               do {
> +                       buf = odp_schedule(&queue, sched_tmo);
> +                       /* Check if odp_schedule() timed out, possibly
> there
> +                        * are no remaining timeouts to receive */
> +               } while (buf == ODP_BUFFER_INVALID &&
> +                        (int)odp_atomic_load_u32(&remain) > 0);
> +
>                 if (buf == ODP_BUFFER_INVALID)
> -                       continue; /* Re-check the remain counter */
> +                       break; /* No more timeouts */
>                 if (odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT) {
>                         /* Not a default timeout buffer */
>                         EXAMPLE_ABORT("Unexpected buffer type (%u)
> received\n",
> --
> 1.9.1
>
>
> _______________________________________________
> 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

Reply via email to