Commit 5f1601261050251a5ca293378b492a69d590dacb
Committed by
Len Brown
1 parent
76e10d158e
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff
drivers/acpi/acpi_pad.c
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" |
37 | 37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 |
38 | 38 | static DEFINE_MUTEX(isolated_cpus_lock); |
39 | +static DEFINE_MUTEX(round_robin_lock); | |
39 | 40 | |
40 | 41 | static unsigned long power_saving_mwait_eax; |
41 | 42 | |
... | ... | @@ -107,7 +108,7 @@ |
107 | 108 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) |
108 | 109 | return; |
109 | 110 | |
110 | - mutex_lock(&isolated_cpus_lock); | |
111 | + mutex_lock(&round_robin_lock); | |
111 | 112 | cpumask_clear(tmp); |
112 | 113 | for_each_cpu(cpu, pad_busy_cpus) |
113 | 114 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); |
... | ... | @@ -116,7 +117,7 @@ |
116 | 117 | if (cpumask_empty(tmp)) |
117 | 118 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); |
118 | 119 | if (cpumask_empty(tmp)) { |
119 | - mutex_unlock(&isolated_cpus_lock); | |
120 | + mutex_unlock(&round_robin_lock); | |
120 | 121 | return; |
121 | 122 | } |
122 | 123 | for_each_cpu(cpu, tmp) { |
... | ... | @@ -131,7 +132,7 @@ |
131 | 132 | tsk_in_cpu[tsk_index] = preferred_cpu; |
132 | 133 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); |
133 | 134 | cpu_weight[preferred_cpu]++; |
134 | - mutex_unlock(&isolated_cpus_lock); | |
135 | + mutex_unlock(&round_robin_lock); | |
135 | 136 | |
136 | 137 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); |
137 | 138 | } |