Patch "tick/nohz: Fix possible missing clock reprog after tick soft restart" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
tick/nohz: Fix possible missing clock reprog after tick soft restart
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tick-nohz-fix-possible-missing-clock-reprog-after-tick-soft-restart.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
7bdb59f1ad474bd7161adc8f923cdef10f2638d1Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <[email protected]>
Date: Tue, 7 Feb 2017 17:44:54 +0100
Subject: tick/nohz: Fix possible missing clock reprog after tick soft restart
From: Frederic Weisbecker <[email protected]>
commit 7bdb59f1ad474bd7161adc8f923cdef10f2638d1 upstream.
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.
Reviewed: Wanpeng Li <[email protected]>
--- kernel/time/tick-sched.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/time/tick-sched.c +5 -0
@@ -613,6 +613,11 @@ static ktime_t tick_nohz_stop_sched_tickif (delta ==0 ) {/* Tick is stopped, but required now. Enforce it */ tick_nohz_restart (ts, now); +/* +* Make sure next tick stop doesn't get fooled by past +* clock deadline +*/ + ts->next_tick =0 ; goto out; } }
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/tick-nohz-fix-possible-missing-clock-reprog-after-tick-soft-restart.patch