aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-05-07 08:35:59 -0400
committerIngo Molnar <mingo@kernel.org>2015-05-07 10:15:50 -0400
commit6b442bc81337913eb775965a67ffdb8a36935422 (patch)
treec98932b4f91567c23eb77bb6596a0d1fa5207036
parent38d23a6cc16c02f7b0c920266053f340b5601735 (diff)
nohz: Fix !HIGH_RES_TIMERS hang
Simon Horman reported this crash on a system with high-res timers disabled but nohz enabled: > ------------[ cut here ]------------ > kernel BUG at kernel/irq_work.c:135! BUG_ON(!irqs_disabled()); So something enabled interrupts in the periodic tick handling machinery, and that code path indeed has a local_irq_disable()/enable pair in tick_nohz_switch_to_nohz() which causes havoc. Fix it. This patch also fixes a +nohz -hrtimers hang reported by Ingo Molnar. Reported-by: Simon Horman <horms@verge.net.au> Reported-by: Ingo Molnar <mingo@kernel.org> Tested-by: Simon Horman <horms@verge.net.au> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: LAK <linux-arm-kernel@lists.infradead.org> Cc: Magnus Damm <magnus.damm@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1505071425520.4225@nanos Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/time/tick-sched.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 753c211f6195..812f7a3b9898 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -967,11 +967,9 @@ static void tick_nohz_switch_to_nohz(void)
967 if (!tick_nohz_enabled) 967 if (!tick_nohz_enabled)
968 return; 968 return;
969 969
970 local_irq_disable(); 970 if (tick_switch_to_oneshot(tick_nohz_handler))
971 if (tick_switch_to_oneshot(tick_nohz_handler)) {
972 local_irq_enable();
973 return; 971 return;
974 } 972
975 tick_nohz_active = 1; 973 tick_nohz_active = 1;
976 ts->nohz_mode = NOHZ_MODE_LOWRES; 974 ts->nohz_mode = NOHZ_MODE_LOWRES;
977 975
@@ -986,7 +984,6 @@ static void tick_nohz_switch_to_nohz(void)
986 hrtimer_forward_now(&ts->sched_timer, tick_period); 984 hrtimer_forward_now(&ts->sched_timer, tick_period);
987 hrtimer_set_expires(&ts->sched_timer, next); 985 hrtimer_set_expires(&ts->sched_timer, next);
988 tick_program_event(next, 1); 986 tick_program_event(next, 1);
989 local_irq_enable();
990} 987}
991 988
992/* 989/*
@@ -1171,7 +1168,7 @@ void tick_oneshot_notify(void)
1171 * Called cyclic from the hrtimer softirq (driven by the timer 1168 * Called cyclic from the hrtimer softirq (driven by the timer
1172 * softirq) allow_nohz signals, that we can switch into low-res nohz 1169 * softirq) allow_nohz signals, that we can switch into low-res nohz
1173 * mode, because high resolution timers are disabled (either compile 1170 * mode, because high resolution timers are disabled (either compile
1174 * or runtime). 1171 * or runtime). Called with interrupts disabled.
1175 */ 1172 */
1176int tick_check_oneshot_change(int allow_nohz) 1173int tick_check_oneshot_change(int allow_nohz)
1177{ 1174{