diff options
author | Jiri Kosina <jkosina@suse.cz> | 2014-09-03 09:04:28 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-09-03 17:05:55 -0400 |
commit | 6726655dfdd2dc60c035c690d9f10cb69d7ea075 (patch) | |
tree | 911f2815276b78131592c4c5f1e1992819af685a /drivers/acpi | |
parent | 69e273c0b0a3c337a521d083374c918dc52c666f (diff) |
ACPI / cpuidle: fix deadlock between cpuidle_lock and cpu_hotplug.lock
There is a following AB-BA dependency between cpu_hotplug.lock and
cpuidle_lock:
1) cpu_hotplug.lock -> cpuidle_lock
enable_nonboot_cpus()
_cpu_up()
cpu_hotplug_begin()
LOCK(cpu_hotplug.lock)
cpu_notify()
...
acpi_processor_hotplug()
cpuidle_pause_and_lock()
LOCK(cpuidle_lock)
2) cpuidle_lock -> cpu_hotplug.lock
acpi_os_execute_deferred() workqueue
...
acpi_processor_cst_has_changed()
cpuidle_pause_and_lock()
LOCK(cpuidle_lock)
get_online_cpus()
LOCK(cpu_hotplug.lock)
Fix this by reversing the order acpi_processor_cst_has_changed() does
thigs -- let it first execute the protection against CPU hotplug by
calling get_online_cpus() and obtain the cpuidle lock only after that (and
perform the symmentric change when allowing CPUs hotplug again and
dropping cpuidle lock).
Spotted by lockdep.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/processor_idle.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 3dca36d4ad26..17f9ec501972 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -1071,9 +1071,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1071 | 1071 | ||
1072 | if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { | 1072 | if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { |
1073 | 1073 | ||
1074 | cpuidle_pause_and_lock(); | ||
1075 | /* Protect against cpu-hotplug */ | 1074 | /* Protect against cpu-hotplug */ |
1076 | get_online_cpus(); | 1075 | get_online_cpus(); |
1076 | cpuidle_pause_and_lock(); | ||
1077 | 1077 | ||
1078 | /* Disable all cpuidle devices */ | 1078 | /* Disable all cpuidle devices */ |
1079 | for_each_online_cpu(cpu) { | 1079 | for_each_online_cpu(cpu) { |
@@ -1100,8 +1100,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1100 | cpuidle_enable_device(dev); | 1100 | cpuidle_enable_device(dev); |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | put_online_cpus(); | ||
1104 | cpuidle_resume_and_unlock(); | 1103 | cpuidle_resume_and_unlock(); |
1104 | put_online_cpus(); | ||
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | return 0; | 1107 | return 0; |