Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1575865 > unrolled thread
| Started by | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| First post | 2017-02-07 17:50 +0100 |
| Last post | 2017-02-10 09:50 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH] nohz: Fix possible missing clock reprog after tick soft restart Frederic Weisbecker <fweisbec@gmail.com> - 2017-02-07 17:50 +0100
Re: [PATCH] nohz: Fix possible missing clock reprog after tick soft restart Rik van Riel <riel@redhat.com> - 2017-02-07 21:10 +0100
Re: [PATCH] nohz: Fix possible missing clock reprog after tick soft restart Wanpeng Li <kernellwp@gmail.com> - 2017-02-08 03:00 +0100
[tip:timers/urgent] tick/nohz: Fix possible missing clock reprog after tick soft restart tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2017-02-10 09:50 +0100
| From | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2017-02-07 17:50 +0100 |
| Subject | [PATCH] nohz: Fix possible missing clock reprog after tick soft restart |
| Message-ID | <t8h7Q-5ki-5@gated-at.bofh.it> |
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.
Lets fix this with a ts->next_tick reset on soft tick restart.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
---
kernel/time/tick-sched.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 74e0388..fc6f740 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -725,6 +725,11 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
*/
if (delta == 0) {
tick_nohz_restart(ts, now);
+ /*
+ * Make sure next tick stop doesn't get fooled by past
+ * clock deadline
+ */
+ ts->next_tick = 0;
goto out;
}
}
--
2.7.4
[toc] | [next] | [standalone]
| From | Rik van Riel <riel@redhat.com> |
|---|---|
| Date | 2017-02-07 21:10 +0100 |
| Subject | Re: [PATCH] nohz: Fix possible missing clock reprog after tick soft restart |
| Message-ID | <t8kfo-7qC-11@gated-at.bofh.it> |
| In reply to | #1575865 |
On Tue, 2017-02-07 at 17:44 +0100, Frederic Weisbecker wrote: > 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. > > Lets fix this with a ts->next_tick reset on soft tick restart. > > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Wanpeng Li <wanpeng.li@hotmail.com> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Rik van Riel <riel@redhat.com> > Cc: Ingo Molnar <mingo@kernel.org> > Cc: stable@vger.kernel.org > Acked-by: Rik van Riel <riel@redhat.com>
[toc] | [prev] | [next] | [standalone]
| From | Wanpeng Li <kernellwp@gmail.com> |
|---|---|
| Date | 2017-02-08 03:00 +0100 |
| Message-ID | <t8pI5-2cw-9@gated-at.bofh.it> |
| In reply to | #1575865 |
2017-02-08 0:44 GMT+08:00 Frederic Weisbecker <fweisbec@gmail.com>:
> 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.
>
> Lets fix this with a ts->next_tick reset on soft tick restart.
>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Wanpeng Li <wanpeng.li@hotmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: stable@vger.kernel.org
Reviewed-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> kernel/time/tick-sched.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 74e0388..fc6f740 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -725,6 +725,11 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
> */
> if (delta == 0) {
> tick_nohz_restart(ts, now);
> + /*
> + * Make sure next tick stop doesn't get fooled by past
> + * clock deadline
> + */
> + ts->next_tick = 0;
> goto out;
> }
> }
> --
> 2.7.4
>
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Frederic Weisbecker <tipbot@zytor.com> |
|---|---|
| Date | 2017-02-10 09:50 +0100 |
| Subject | [tip:timers/urgent] tick/nohz: Fix possible missing clock reprog after tick soft restart |
| Message-ID | <t9f3Z-140-25@gated-at.bofh.it> |
| In reply to | #1575865 |
Commit-ID: 7bdb59f1ad474bd7161adc8f923cdef10f2638d1
Gitweb: http://git.kernel.org/tip/7bdb59f1ad474bd7161adc8f923cdef10f2638d1
Author: Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Tue, 7 Feb 2017 17:44:54 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 10 Feb 2017 09:43:48 +0100
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>
---
kernel/time/tick-sched.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 74e0388..fc6f740 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -725,6 +725,11 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
*/
if (delta == 0) {
tick_nohz_restart(ts, now);
+ /*
+ * Make sure next tick stop doesn't get fooled by past
+ * clock deadline
+ */
+ ts->next_tick = 0;
goto out;
}
}
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web