diff options
author | Fabio Baltieri <fabio.baltieri@linaro.org> | 2013-01-31 05:39:19 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-01 18:01:16 -0500 |
commit | 09dca5ae7531c9df379a2c2484a17438b9e947bc (patch) | |
tree | 859bbcfda0b5414c446bbc6c92955620ee9f6f62 | |
parent | 2624f90c16413990ecb0414400174a066319a9f5 (diff) |
cpufreq: governors: fix misuse of cdbs.cpu
Fix governors code to set all cpu's cdbs->cpu to the the actual cpu id
and use cur_policy->cpu istead of cdbs->cpu to track current governor's
leader cpu.
Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 5 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 5 |
3 files changed, 7 insertions, 5 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 653fb0652412..c18a304b3a38 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -114,7 +114,7 @@ static void cs_check_cpu(int cpu, unsigned int load) | |||
114 | static void cs_timer_update(struct cs_cpu_dbs_info_s *dbs_info, bool sample, | 114 | static void cs_timer_update(struct cs_cpu_dbs_info_s *dbs_info, bool sample, |
115 | struct delayed_work *dw) | 115 | struct delayed_work *dw) |
116 | { | 116 | { |
117 | unsigned int cpu = dbs_info->cdbs.cpu; | 117 | unsigned int cpu = dbs_info->cdbs.cur_policy->cpu; |
118 | int delay = delay_for_sampling_rate(cs_tuners.sampling_rate); | 118 | int delay = delay_for_sampling_rate(cs_tuners.sampling_rate); |
119 | 119 | ||
120 | if (sample) | 120 | if (sample) |
@@ -132,7 +132,8 @@ static void cs_timer_coordinated(struct cs_cpu_dbs_info_s *dbs_info_local, | |||
132 | bool sample = true; | 132 | bool sample = true; |
133 | 133 | ||
134 | /* use leader CPU's dbs_info */ | 134 | /* use leader CPU's dbs_info */ |
135 | dbs_info = &per_cpu(cs_cpu_dbs_info, dbs_info_local->cdbs.cpu); | 135 | dbs_info = &per_cpu(cs_cpu_dbs_info, |
136 | dbs_info_local->cdbs.cur_policy->cpu); | ||
136 | mutex_lock(&dbs_info->cdbs.timer_mutex); | 137 | mutex_lock(&dbs_info->cdbs.timer_mutex); |
137 | 138 | ||
138 | time_now = ktime_get(); | 139 | time_now = ktime_get(); |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 67e235acf43b..46f1c78bd16f 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -208,11 +208,11 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
208 | mutex_lock(&dbs_data->mutex); | 208 | mutex_lock(&dbs_data->mutex); |
209 | 209 | ||
210 | dbs_data->enable++; | 210 | dbs_data->enable++; |
211 | cpu_cdbs->cpu = cpu; | ||
212 | for_each_cpu(j, policy->cpus) { | 211 | for_each_cpu(j, policy->cpus) { |
213 | struct cpu_dbs_common_info *j_cdbs; | 212 | struct cpu_dbs_common_info *j_cdbs; |
214 | j_cdbs = dbs_data->get_cpu_cdbs(j); | 213 | j_cdbs = dbs_data->get_cpu_cdbs(j); |
215 | 214 | ||
215 | j_cdbs->cpu = j; | ||
216 | j_cdbs->cur_policy = policy; | 216 | j_cdbs->cur_policy = policy; |
217 | j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, | 217 | j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, |
218 | &j_cdbs->prev_cpu_wall); | 218 | &j_cdbs->prev_cpu_wall); |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 5ae84ffeafb3..75efd5ee00f8 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -219,7 +219,7 @@ static void od_check_cpu(int cpu, unsigned int load_freq) | |||
219 | static void od_timer_update(struct od_cpu_dbs_info_s *dbs_info, bool sample, | 219 | static void od_timer_update(struct od_cpu_dbs_info_s *dbs_info, bool sample, |
220 | struct delayed_work *dw) | 220 | struct delayed_work *dw) |
221 | { | 221 | { |
222 | unsigned int cpu = dbs_info->cdbs.cpu; | 222 | unsigned int cpu = dbs_info->cdbs.cur_policy->cpu; |
223 | int delay, sample_type = dbs_info->sample_type; | 223 | int delay, sample_type = dbs_info->sample_type; |
224 | 224 | ||
225 | /* Common NORMAL_SAMPLE setup */ | 225 | /* Common NORMAL_SAMPLE setup */ |
@@ -255,7 +255,8 @@ static void od_timer_coordinated(struct od_cpu_dbs_info_s *dbs_info_local, | |||
255 | bool sample = true; | 255 | bool sample = true; |
256 | 256 | ||
257 | /* use leader CPU's dbs_info */ | 257 | /* use leader CPU's dbs_info */ |
258 | dbs_info = &per_cpu(od_cpu_dbs_info, dbs_info_local->cdbs.cpu); | 258 | dbs_info = &per_cpu(od_cpu_dbs_info, |
259 | dbs_info_local->cdbs.cur_policy->cpu); | ||
259 | mutex_lock(&dbs_info->cdbs.timer_mutex); | 260 | mutex_lock(&dbs_info->cdbs.timer_mutex); |
260 | 261 | ||
261 | time_now = ktime_get(); | 262 | time_now = ktime_get(); |