Skip to content

Commit 57ccdf4

Browse files
Wanpeng LiKAGA-KOKO
authored andcommitted
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 f7ea0fd ("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>
1 parent 2ea3401 commit 57ccdf4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

kernel/time/tick-sched.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ static bool check_tick_dependency(atomic_t *dep)
186186
return false;
187187
}
188188

189-
static bool can_stop_full_tick(struct tick_sched *ts)
189+
static bool can_stop_full_tick(int cpu, struct tick_sched *ts)
190190
{
191191
WARN_ON_ONCE(!irqs_disabled());
192192

193+
if (unlikely(!cpu_online(cpu)))
194+
return false;
195+
193196
if (check_tick_dependency(&tick_dep_mask))
194197
return false;
195198

@@ -843,7 +846,7 @@ static void tick_nohz_full_update_tick(struct tick_sched *ts)
843846
if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE)
844847
return;
845848

846-
if (can_stop_full_tick(ts))
849+
if (can_stop_full_tick(cpu, ts))
847850
tick_nohz_stop_sched_tick(ts, ktime_get(), cpu);
848851
else if (ts->tick_stopped)
849852
tick_nohz_restart_sched_tick(ts, ktime_get());

0 commit comments

Comments
 (0)