Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59bf61d1 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Sanrio Alvares
Browse files

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.

Change-Id: If3d528d940b20bca12c8d2b15bcef9774605fa00
Reported-by: default avatarSimon Horman <horms@verge.net.au>
Reported-by: default avatarIngo Molnar <mingo@kernel.org>
Tested-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarThomas 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: default avatarIngo Molnar <mingo@kernel.org>
Git-commit: 6b442bc81337913eb775965a67ffdb8a36935422
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git


[salvares@codeaurora.org: resolved context conflicts in tick-sched.c]
Signed-off-by: default avatarSanrio Alvares <salvares@codeaurora.org>
parent c8df36dc
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -1058,11 +1058,9 @@ static void tick_nohz_switch_to_nohz(void)
	if (!tick_nohz_enabled)
		return;

	local_irq_disable();
	if (tick_switch_to_oneshot(tick_nohz_handler)) {
		local_irq_enable();
	if (tick_switch_to_oneshot(tick_nohz_handler))
		return;
	}

	tick_nohz_active = 1;
	ts->nohz_mode = NOHZ_MODE_LOWRES;

@@ -1080,7 +1078,6 @@ static void tick_nohz_switch_to_nohz(void)
			break;
		next = ktime_add(next, tick_period);
	}
	local_irq_enable();
}

/*
@@ -1331,7 +1328,7 @@ void tick_oneshot_notify(void)
 * Called cyclic from the hrtimer softirq (driven by the timer
 * softirq) allow_nohz signals, that we can switch into low-res nohz
 * mode, because high resolution timers are disabled (either compile
 * or runtime).
 * or runtime). Called with interrupts disabled.
 */
int tick_check_oneshot_change(int allow_nohz)
{