[RFC PATCH V3 3/3] Cpufreq: Hold cpu_add_remove_lock before change cpufreq_suspended flag

From: Lan Tianyu
Date: Thu Sep 25 2014 - 04:36:35 EST


Now, enabling non-boot cpus will parallel with resuming devices.
Cpu online may take place after cpufreq resume. But all cpu should be up
before clearing cpufreq_suspended flag in the cpufreq_resume(). Cpufreq
core uses this flag to decide to do light-weight init or full init. Light
-weight init/tear down is dedicated for cpu hotplug during system pm. To
keep this rule, hold cpu_add_remove_lock during changing cpufreq_suspended
flag.

Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
---
drivers/cpufreq/cpufreq.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 37951ec..b03f7dd 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1689,7 +1689,9 @@ void cpufreq_resume(void)
if (!cpufreq_driver)
return;

+ cpu_maps_update_begin();
cpufreq_suspended = false;
+ cpu_maps_update_done();

if (!has_target())
return;
--
1.8.4.rc0.1.g8f6a3e5.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/