WSL2-Linux-Kernel/kernel/time
Frederic Weisbecker 7bdb59f1ad tick/nohz: Fix possible missing clock reprog after tick soft restart
ts->next_tick keeps track of the next tick deadline in order to optimize
clock programmation on irq exit and avoid redundant clock device writes.

Now if ts->next_tick missed an update, we may spuriously miss a clock
reprog later as the nohz code is fooled by an obsolete next_tick value.

This is what happens here on a specific path: when we observe an
expired timer from the nohz update code on irq exit, we perform a soft
tick restart which simply fires the closest possible tick without
actually exiting the nohz mode and restoring a periodic state. But we
forget to update ts->next_tick accordingly.

As a result, after the next tick resulting from such soft tick restart,
the nohz code sees a stale value on ts->next_tick which doesn't match
the clock deadline that just expired. If that obsolete ts->next_tick
value happens to collide with the actual next tick deadline to be
scheduled, we may spuriously bypass the clock reprogramming. In the
worst case, the tick may never fire again.

Fix this with a ts->next_tick reset on soft tick restart.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed: Wanpeng Li <wanpeng.li@hotmail.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1486485894-29173-1-git-send-email-fweisbec@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2017-02-10 09:43:48 +01:00
..
Kconfig
Makefile
alarmtimer.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
clockevents.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
clocksource.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
hrtimer.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
itimer.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
jiffies.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
ntp.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
ntp_internal.h
posix-clock.c
posix-cpu-timers.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
posix-stubs.c
posix-timers.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
sched_clock.c
test_udelay.c
tick-broadcast-hrtimer.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
tick-broadcast.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
tick-common.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
tick-internal.h
tick-oneshot.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
tick-sched.c tick/nohz: Fix possible missing clock reprog after tick soft restart 2017-02-10 09:43:48 +01:00
tick-sched.h nohz: Fix collision between tick and other hrtimers 2017-01-11 10:41:33 +01:00
time.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
timeconst.bc
timeconv.c
timecounter.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
timekeeping.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
timekeeping.h
timekeeping_debug.c
timekeeping_internal.h clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
timer.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
timer_list.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
timer_stats.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00