]> Git Repo - linux.git/commitdiff
watchdog/core: Rework CPU hotplug locking
authorThomas Gleixner <[email protected]>
Tue, 12 Sep 2017 19:37:00 +0000 (21:37 +0200)
committerIngo Molnar <[email protected]>
Thu, 14 Sep 2017 09:41:04 +0000 (11:41 +0200)
The watchdog proc interface causes extensive recursive locking of the CPU
hotplug percpu rwsem, which is deadlock prone.

Replace the get/put_online_cpus() pairs with cpu_hotplug_disable()/enable()
calls for now. Later patches will remove that requirement completely.

Reported-by: Borislav Petkov <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Don Zickus <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sebastian Siewior <[email protected]>
Cc: Ulrich Obergfell <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
kernel/watchdog.c

index b2d46757917ec81b7c1ec472d389fce9bd9788ac..cd79f644ea34f868bb10835f9ca90bb13883ac28 100644 (file)
@@ -703,7 +703,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
        int err, old, new;
        int *watchdog_param = (int *)table->data;
 
-       get_online_cpus();
+       cpu_hotplug_disable();
        mutex_lock(&watchdog_proc_mutex);
 
        /*
@@ -752,7 +752,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
        }
 out:
        mutex_unlock(&watchdog_proc_mutex);
-       put_online_cpus();
+       cpu_hotplug_enable();
        return err;
 }
 
@@ -794,7 +794,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
 {
        int err, old, new;
 
-       get_online_cpus();
+       cpu_hotplug_disable();
        mutex_lock(&watchdog_proc_mutex);
 
        old = ACCESS_ONCE(watchdog_thresh);
@@ -818,7 +818,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
        }
 out:
        mutex_unlock(&watchdog_proc_mutex);
-       put_online_cpus();
+       cpu_hotplug_enable();
        return err;
 }
 
@@ -833,7 +833,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write,
 {
        int err;
 
-       get_online_cpus();
+       cpu_hotplug_disable();
        mutex_lock(&watchdog_proc_mutex);
 
        err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
@@ -856,7 +856,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write,
        }
 
        mutex_unlock(&watchdog_proc_mutex);
-       put_online_cpus();
+       cpu_hotplug_enable();
        return err;
 }
 
This page took 0.053156 seconds and 4 git commands to generate.