msm: cpufreq: Fix store_powersave_bias to account for sync' CPUs.

Current code assumes that all online CPUs runs their own timers to
collect CPU samples for demand based switching (dbs). But in case of
synchronous CPUs, ondemand governor registers only one timer at init
time because both CPUs are accounted in the same timer call. Hence
trying to restart/cancel dbs timers for all online CPUs is not legal
for these CPUs. This change fixes above function to restart/cancel
timers only once for group of synchronous CPUs.

Change-Id: I23f1697783a65f125679a07a076620e8fa5e62d5
Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
This commit is contained in:
Krishna Vanka 2012-04-19 13:11:20 +05:30 committed by Stephen Boyd
parent 85d448090a
commit 8676f36913

View file

@ -469,9 +469,12 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
{
int input = 0;
int bypass = 0;
int ret, cpu, reenable_timer;
int ret, cpu, reenable_timer, j;
struct cpu_dbs_info_s *dbs_info;
struct cpumask cpus_timer_done;
cpumask_clear(&cpus_timer_done);
ret = sscanf(buf, "%d", &input);
if (ret != 1)
@ -504,10 +507,23 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
continue;
dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
for_each_cpu(j, &cpus_timer_done) {
if (!dbs_info->cur_policy) {
pr_err("Dbs policy is NULL\n");
goto skip_this_cpu;
}
if (cpumask_test_cpu(j, dbs_info->
cur_policy->cpus))
goto skip_this_cpu;
}
cpumask_set_cpu(cpu, &cpus_timer_done);
if (dbs_info->cur_policy) {
/* restart dbs timer */
dbs_timer_init(dbs_info);
}
skip_this_cpu:
unlock_policy_rwsem_write(cpu);
}
}
@ -520,6 +536,19 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
continue;
dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
for_each_cpu(j, &cpus_timer_done) {
if (!dbs_info->cur_policy) {
pr_err("Dbs policy is NULL\n");
goto skip_this_cpu_bypass;
}
if (cpumask_test_cpu(j, dbs_info->
cur_policy->cpus))
goto skip_this_cpu_bypass;
}
cpumask_set_cpu(cpu, &cpus_timer_done);
if (dbs_info->cur_policy) {
/* cpu using ondemand, cancel dbs timer */
mutex_lock(&dbs_info->timer_mutex);
@ -532,6 +561,7 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
mutex_unlock(&dbs_info->timer_mutex);
}
skip_this_cpu_bypass:
unlock_policy_rwsem_write(cpu);
}
}