The resolution of schedule time can be more than 1ns. As result
can happen that 1ns corresponds 0 ticks of timer counter, but if
passed 1ns it's obvious that user wanted to schedule at least once.
Currently it can lead to wait forever, as 0 corresponds to
ODP_SCHED_WAIT, it can block program flow at all.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronz...@linaro.org>
---

Prerequisit for this patch was taken from:
"[lng-odp] [Patch] validation: scheduler: increase time check"
https://lists.linaro.org/pipermail/lng-odp/2015-August/014738.html

 platform/linux-generic/odp_schedule.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index c6619e5..05497de 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -646,10 +646,13 @@ void odp_schedule_resume(void)
 
 uint64_t odp_schedule_wait_time(uint64_t ns)
 {
-       if (ns <= ODP_SCHED_NO_WAIT)
-               ns = ODP_SCHED_NO_WAIT + 1;
+       uint64_t time;
 
-       return odp_time_ns_to_cycles(ns);
+       time = odp_time_ns_to_cycles(ns);
+       if (!time)
+               time = ODP_SCHED_NO_WAIT;
+
+       return time;
 }
 
 
-- 
1.9.1

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to