watchdog: Fix CPU hotplug regression
authorThomas Gleixner <tglx@linutronix.de>
Tue, 4 Dec 2012 17:59:34 +0000 (18:59 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 4 Dec 2012 18:56:59 +0000 (19:56 +0100)
Norbert reported:
"3.7-rc6 booted with nmi_watchdog=0 fails to suspend to RAM or
 offline CPUs. It's reproducable with a KVM guest and physical
 system."

The reason is that commit bcd951cf(watchdog: Use hotplug thread
infrastructure) missed to take this into account. So the cpu offline
code gets stuck in the teardown function because it accesses non
initialized data structures.

Add a check for watchdog_enabled into that path to cure the issue.

Reported-and-tested-by: Norbert Warmuth <nwarmuth@t-online.de>
Tested-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1211231033230.2701@ionos
Link: http://bugs.launchpad.net/bugs/1079534
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/watchdog.c

index dd4b80a9f1a986ff35b192655064db6db3b85883..c8c21be11ab48e25569b43a31aee148d7d89c6d1 100644 (file)
@@ -368,6 +368,9 @@ static void watchdog_disable(unsigned int cpu)
 {
        struct hrtimer *hrtimer = &__raw_get_cpu_var(watchdog_hrtimer);
 
+       if (!watchdog_enabled)
+               return;
+
        watchdog_set_prio(SCHED_NORMAL, 0);
        hrtimer_cancel(hrtimer);
        /* disable the perf event */