[PATCH] clockevents: Update clockevents device next_event

From: Prasad Sodagudi
Date: Thu Oct 26 2017 - 14:37:42 EST


Usually clockevent device's next_event is updated in
clockevents_program_event() and next_event indicates
the next timer event on that cpu. Whenever there are
no timers on a CPU, corresponding clockevent device
is going into ONESHOT_STOPPED state but clockevent
device next_event is not updated, because
clockevents_program_event() not called.

As next_event is not updated properly, resulting in spurious
wakeups, so update the clockevent device next_event
with proper value(KTIME_MAX) to avoid spurious wakeups.

Signed-off-by: Prasad Sodagudi <psodagud@xxxxxxxxxxxxxx>
---
kernel/time/tick-oneshot.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index 6b009c2..c1f518e 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -33,6 +33,7 @@ int tick_program_event(ktime_t expires, int force)
* We don't need the clock event device any more, stop it.
*/
clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED);
+ dev->next_event = KTIME_MAX;
return 0;
}

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project