Commit 7b6dd52e authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka
Browse files

cobalt/tick: dovetail: improve accuracy of the host tick delay

Expiration dates of in-band timers are based on the monotonic time
base read by ktime_get(), which is ok for us to use from non-NMI
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent ac499690
......@@ -55,19 +55,21 @@ void pipeline_set_timer_shot(unsigned long delay) /* ns */
static int proxy_set_next_ktime(ktime_t expires,
struct clock_event_device *proxy_dev)
struct clock_event_device *proxy_dev) /* hard irqs on/off */
struct xnsched *sched;
ktime_t delta;
unsigned long flags;
ktime_t delta;
int ret;
* When Negative delta have been observed, we set delta zero.
* Or else exntimer_start() will return -ETIMEDOUT and do not
* trigger shot
* Expiration dates of in-band timers are based on the common
* monotonic time base. If the timeout date has already
* elapsed, make sure xntimer_start() does not fail with
* -ETIMEDOUT but programs the hardware for ticking
* immediately instead.
delta = ktime_sub(expires, ktime_get_mono_fast_ns());
delta = ktime_sub(expires, ktime_get());
if (delta < 0)
delta = 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