diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2017-09-12 15:37:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-09-14 05:41:04 -0400 |
commit | b7a349819d4b9b5db64e523351e66a79a758eaa5 (patch) | |
tree | 92f64ad56f0be008103710de0f8911fc8548820b /kernel | |
parent | 5490125d77a43016b26f629d4b485e2c62172551 (diff) |
watchdog/core: Rework CPU hotplug locking
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 <bp@alien8.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Link: http://lkml.kernel.org/r/20170912194146.568079057@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/watchdog.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index b2d46757917e..cd79f644ea34 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -703,7 +703,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write, | |||
703 | int err, old, new; | 703 | int err, old, new; |
704 | int *watchdog_param = (int *)table->data; | 704 | int *watchdog_param = (int *)table->data; |
705 | 705 | ||
706 | get_online_cpus(); | 706 | cpu_hotplug_disable(); |
707 | mutex_lock(&watchdog_proc_mutex); | 707 | mutex_lock(&watchdog_proc_mutex); |
708 | 708 | ||
709 | /* | 709 | /* |
@@ -752,7 +752,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write, | |||
752 | } | 752 | } |
753 | out: | 753 | out: |
754 | mutex_unlock(&watchdog_proc_mutex); | 754 | mutex_unlock(&watchdog_proc_mutex); |
755 | put_online_cpus(); | 755 | cpu_hotplug_enable(); |
756 | return err; | 756 | return err; |
757 | } | 757 | } |
758 | 758 | ||
@@ -794,7 +794,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write, | |||
794 | { | 794 | { |
795 | int err, old, new; | 795 | int err, old, new; |
796 | 796 | ||
797 | get_online_cpus(); | 797 | cpu_hotplug_disable(); |
798 | mutex_lock(&watchdog_proc_mutex); | 798 | mutex_lock(&watchdog_proc_mutex); |
799 | 799 | ||
800 | old = ACCESS_ONCE(watchdog_thresh); | 800 | old = ACCESS_ONCE(watchdog_thresh); |
@@ -818,7 +818,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write, | |||
818 | } | 818 | } |
819 | out: | 819 | out: |
820 | mutex_unlock(&watchdog_proc_mutex); | 820 | mutex_unlock(&watchdog_proc_mutex); |
821 | put_online_cpus(); | 821 | cpu_hotplug_enable(); |
822 | return err; | 822 | return err; |
823 | } | 823 | } |
824 | 824 | ||
@@ -833,7 +833,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write, | |||
833 | { | 833 | { |
834 | int err; | 834 | int err; |
835 | 835 | ||
836 | get_online_cpus(); | 836 | cpu_hotplug_disable(); |
837 | mutex_lock(&watchdog_proc_mutex); | 837 | mutex_lock(&watchdog_proc_mutex); |
838 | 838 | ||
839 | err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); | 839 | err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); |
@@ -856,7 +856,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write, | |||
856 | } | 856 | } |
857 | 857 | ||
858 | mutex_unlock(&watchdog_proc_mutex); | 858 | mutex_unlock(&watchdog_proc_mutex); |
859 | put_online_cpus(); | 859 | cpu_hotplug_enable(); |
860 | return err; | 860 | return err; |
861 | } | 861 | } |
862 | 862 | ||