From 294c7e5076bd6702a7e08fc752a5e25e679ce9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Tue, 31 May 2016 13:49:48 +0200 Subject: [PATCH] lx_kit: handle truncation of hrtimer timeouts Fixes #1986. --- repos/dde_linux/src/include/lx_emul/impl/timer.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repos/dde_linux/src/include/lx_emul/impl/timer.h b/repos/dde_linux/src/include/lx_emul/impl/timer.h index 6ad73bcae1..153523a71c 100644 --- a/repos/dde_linux/src/include/lx_emul/impl/timer.h +++ b/repos/dde_linux/src/include/lx_emul/impl/timer.h @@ -61,6 +61,12 @@ int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, { unsigned long expires = tim.tv64 / (NSEC_PER_MSEC * HZ); + /* + * Prevent truncation through rounding the values by adding 1 jiffy + * in this case. + */ + expires += (expires == jiffies); + if (!Lx::timer().find(timer)) Lx::timer().add(timer, Lx::Timer::HR);