watchdog: Respect watchdog cpumask on CPU hotplug
authorThomas Gleixner <[email protected]>
Tue, 26 Mar 2019 21:51:02 +0000 (22:51 +0100)
committerThomas Gleixner <[email protected]>
Thu, 28 Mar 2019 12:32:01 +0000 (13:32 +0100)
The rework of the watchdog core to use cpu_stop_work broke the watchdog
cpumask on CPU hotplug.

The watchdog_enable/disable() functions are now called unconditionally from
the hotplug callback, i.e. even on CPUs which are not in the watchdog
cpumask. As a consequence the watchdog can become unstoppable.

Only invoke them when the plugged CPU is in the watchdog cpumask.

Fixes: 9cf57731b63e ("watchdog/softlockup: Replace "watchdog/%u" threads with cpu_stop_work")
Reported-by: Maxime Coquelin <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Maxime Coquelin <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Ricardo Neri <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
kernel/watchdog.c

index 403c9bd9041395a1d7919977acc7ed68d8c746ca..6a578723311328a6394941aeb9ff4eef6130b4ac 100644 (file)
@@ -554,13 +554,15 @@ static void softlockup_start_all(void)
 
 int lockup_detector_online_cpu(unsigned int cpu)
 {
-       watchdog_enable(cpu);
+       if (cpumask_test_cpu(cpu, &watchdog_allowed_mask))
+               watchdog_enable(cpu);
        return 0;
 }
 
 int lockup_detector_offline_cpu(unsigned int cpu)
 {
-       watchdog_disable(cpu);
+       if (cpumask_test_cpu(cpu, &watchdog_allowed_mask))
+               watchdog_disable(cpu);
        return 0;
 }