cpufreq: ondemand: Fix store_powersave_bias() race with hotplug
store_powersave_bias() assumes that CPUs will not be taken offline or
brought online while executing its for_each_online_cpu() loops. Fix
this race by blocking hotplug while executing in these loop.
CRs-Fixed: 494407
Change-Id: I0d5520444ec21a8d9b12fb73c06ac8442449fa85
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 79f7174..a6cd941 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -585,6 +585,7 @@
POWERSAVE_BIAS_MINLEVEL));
dbs_tuners_ins.powersave_bias = input;
+ get_online_cpus();
if (!bypass) {
if (reenable_timer) {
/* reinstate dbs timer */
@@ -651,6 +652,7 @@
unlock_policy_rwsem_write(cpu);
}
}
+ put_online_cpus();
return count;
}