diff options
author | Wanpeng Li <wanpeng.li@hotmail.com> | 2016-09-07 06:51:13 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-09-13 11:53:52 -0400 |
commit | 57ccdf449f962ab5fc8cbf26479402f13bdb8be7 (patch) | |
tree | 89cd6859175a3aa2503903af7d11813e2edabddb | |
parent | 2ea3401e2a84eed3f5f55b2075706f88df160d85 (diff) |
tick/nohz: Prevent stopping the tick on an offline CPU
can_stop_full_tick() has no check for offline cpus. So it allows to stop
the tick on an offline cpu from the interrupt return path, which is wrong
and subsequently makes irq_work_needs_cpu() warn about being called for an
offline cpu.
Commit f7ea0fd639c2c4 ("tick: Don't invoke tick_nohz_stop_sched_tick() if
the cpu is offline") added prevention for can_stop_idle_tick(), but forgot
to do the same in can_stop_full_tick(). Add it.
[ tglx: Massaged changelog ]
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1473245473-4463-1-git-send-email-wanpeng.li@hotmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/time/tick-sched.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 2ec7c00228f3..3bcb61b52f6c 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -186,10 +186,13 @@ static bool check_tick_dependency(atomic_t *dep) | |||
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | 188 | ||
189 | static bool can_stop_full_tick(struct tick_sched *ts) | 189 | static bool can_stop_full_tick(int cpu, struct tick_sched *ts) |
190 | { | 190 | { |
191 | WARN_ON_ONCE(!irqs_disabled()); | 191 | WARN_ON_ONCE(!irqs_disabled()); |
192 | 192 | ||
193 | if (unlikely(!cpu_online(cpu))) | ||
194 | return false; | ||
195 | |||
193 | if (check_tick_dependency(&tick_dep_mask)) | 196 | if (check_tick_dependency(&tick_dep_mask)) |
194 | return false; | 197 | return false; |
195 | 198 | ||
@@ -843,7 +846,7 @@ static void tick_nohz_full_update_tick(struct tick_sched *ts) | |||
843 | if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE) | 846 | if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE) |
844 | return; | 847 | return; |
845 | 848 | ||
846 | if (can_stop_full_tick(ts)) | 849 | if (can_stop_full_tick(cpu, ts)) |
847 | tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); | 850 | tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); |
848 | else if (ts->tick_stopped) | 851 | else if (ts->tick_stopped) |
849 | tick_nohz_restart_sched_tick(ts, ktime_get()); | 852 | tick_nohz_restart_sched_tick(ts, ktime_get()); |