summaryrefslogtreecommitdiff
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2019-09-10 17:03:52 +0200
committerRichard Weinberger <richard@nod.at>2019-09-15 21:37:13 +0200
commiteec94b8acb03aaaa6fb050883624381f5c07a3f0 (patch)
tree90e4a11640b16618d8180fc0af500be66dbbefc3 /arch/um/kernel
parent786b2384bf1c1b53dc23dc493aaaae29ef01e6ce (diff)
um: time-travel: Fix periodic timers
Periodic timers are broken, because the also only fire once. As it happens, Linux doesn't care because it only sets the timer to periodic very briefly during boot, and then switches it only between one-shot and off later. Nevertheless, fix the logic (we shouldn't even be looking at time_travel_timer_expiry unless the timer is enabled) and change the code to fire the timer periodically in periodic mode, in case it ever gets used in the future. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/process.c7
-rw-r--r--arch/um/kernel/time.c1
2 files changed, 7 insertions, 1 deletions
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 6bede7888fc2..cf242fc5fe94 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -210,7 +210,12 @@ static void time_travel_sleep(unsigned long long duration)
if (time_travel_mode != TT_MODE_INFCPU)
os_timer_disable();
- if (time_travel_timer_mode != TT_TMR_DISABLED ||
+ while (time_travel_timer_mode == TT_TMR_PERIODIC &&
+ time_travel_timer_expiry < time_travel_time)
+ time_travel_set_timer_expiry(time_travel_timer_expiry +
+ time_travel_timer_interval);
+
+ if (time_travel_timer_mode != TT_TMR_DISABLED &&
time_travel_timer_expiry < next) {
if (time_travel_timer_mode == TT_TMR_ONESHOT)
time_travel_set_timer_mode(TT_TMR_DISABLED);
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 234757233355..4ecabf7e54c9 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -65,6 +65,7 @@ static int itimer_set_periodic(struct clock_event_device *evt)
if (time_travel_mode != TT_MODE_OFF) {
time_travel_set_timer_mode(TT_TMR_PERIODIC);
time_travel_set_timer_expiry(time_travel_time + interval);
+ time_travel_set_timer_interval(interval);
}
if (time_travel_mode != TT_MODE_INFCPU)