diff options
author | Stuart Hayes <Stuart_Hayes@Dell.com> | 2012-06-13 17:10:45 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-06-30 00:51:13 -0400 |
commit | 5f1601261050251a5ca293378b492a69d590dacb (patch) | |
tree | e2395916caa5bc1ab2a3b28770f6433551e3b16f /drivers/acpi/acpi_pad.c | |
parent | 76e10d158efb6d4516018846f60c2ab5501900bc (diff) |
acpi_pad: fix power_saving thread deadlock
The acpi_pad driver can get stuck in destroy_power_saving_task()
waiting for kthread_stop() to stop a power_saving thread. The problem
is that the isolated_cpus_lock mutex is owned when
destroy_power_saving_task() calls kthread_stop(), which waits for a
power_saving thread to end, and the power_saving thread tries to
acquire the isolated_cpus_lock when it calls round_robin_cpu(). This
patch fixes the issue by making round_robin_cpu() use its own mutex.
https://bugzilla.kernel.org/show_bug.cgi?id=42981
Cc: stable@vger.kernel.org
Signed-off-by: Stuart Hayes <Stuart_Hayes@Dell.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_pad.c')
-rw-r--r-- | drivers/acpi/acpi_pad.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index a43fa1a57d57..1502c50273b5 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" | 36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" |
37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 | 37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 |
38 | static DEFINE_MUTEX(isolated_cpus_lock); | 38 | static DEFINE_MUTEX(isolated_cpus_lock); |
39 | static DEFINE_MUTEX(round_robin_lock); | ||
39 | 40 | ||
40 | static unsigned long power_saving_mwait_eax; | 41 | static unsigned long power_saving_mwait_eax; |
41 | 42 | ||
@@ -107,7 +108,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
107 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) | 108 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) |
108 | return; | 109 | return; |
109 | 110 | ||
110 | mutex_lock(&isolated_cpus_lock); | 111 | mutex_lock(&round_robin_lock); |
111 | cpumask_clear(tmp); | 112 | cpumask_clear(tmp); |
112 | for_each_cpu(cpu, pad_busy_cpus) | 113 | for_each_cpu(cpu, pad_busy_cpus) |
113 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); | 114 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); |
@@ -116,7 +117,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
116 | if (cpumask_empty(tmp)) | 117 | if (cpumask_empty(tmp)) |
117 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); | 118 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); |
118 | if (cpumask_empty(tmp)) { | 119 | if (cpumask_empty(tmp)) { |
119 | mutex_unlock(&isolated_cpus_lock); | 120 | mutex_unlock(&round_robin_lock); |
120 | return; | 121 | return; |
121 | } | 122 | } |
122 | for_each_cpu(cpu, tmp) { | 123 | for_each_cpu(cpu, tmp) { |
@@ -131,7 +132,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
131 | tsk_in_cpu[tsk_index] = preferred_cpu; | 132 | tsk_in_cpu[tsk_index] = preferred_cpu; |
132 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); | 133 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); |
133 | cpu_weight[preferred_cpu]++; | 134 | cpu_weight[preferred_cpu]++; |
134 | mutex_unlock(&isolated_cpus_lock); | 135 | mutex_unlock(&round_robin_lock); |
135 | 136 | ||
136 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); | 137 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); |
137 | } | 138 | } |