diff options
| author | venkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com> | 2008-08-04 14:59:07 -0400 |
|---|---|---|
| committer | Dave Jones <davej@redhat.com> | 2008-10-09 13:52:43 -0400 |
| commit | bf0b90e357c883e8efd72954432efe652de74c76 (patch) | |
| tree | a10758a069cdea10b36856b458a509b144bae3bb | |
| parent | 8217e4f4c93e5fb59bb3cd1e6135213889349f86 (diff) | |
[CPUFREQ][1/6] cpufreq: Add cpu number parameter to __cpufreq_driver_getavg()
Add a cpu parameter to __cpufreq_driver_getavg(). This is needed for software
cpufreq coordination where policy->cpu may not be same as the CPU on which we
want to getavg frequency.
A follow-on patch will use this parameter to getavg freq from all cpus
in policy->cpus.
Change since last patch. Fix the offline/online and suspend/resume
oops reported by Youquan Song <youquan.song@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
| -rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 5 | ||||
| -rw-r--r-- | drivers/cpufreq/cpufreq.c | 6 | ||||
| -rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 2 | ||||
| -rw-r--r-- | include/linux/cpufreq.h | 7 |
4 files changed, 12 insertions, 8 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 1def5b06fa4a..c24c4a487b7c 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
| @@ -256,7 +256,8 @@ static u32 get_cur_val(const cpumask_t *mask) | |||
| 256 | * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and | 256 | * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and |
| 257 | * no meaning should be associated with absolute values of these MSRs. | 257 | * no meaning should be associated with absolute values of these MSRs. |
| 258 | */ | 258 | */ |
| 259 | static unsigned int get_measured_perf(unsigned int cpu) | 259 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, |
| 260 | unsigned int cpu) | ||
| 260 | { | 261 | { |
| 261 | union { | 262 | union { |
| 262 | struct { | 263 | struct { |
| @@ -326,7 +327,7 @@ static unsigned int get_measured_perf(unsigned int cpu) | |||
| 326 | 327 | ||
| 327 | #endif | 328 | #endif |
| 328 | 329 | ||
| 329 | retval = per_cpu(drv_data, cpu)->max_freq * perf_percent / 100; | 330 | retval = per_cpu(drv_data, policy->cpu)->max_freq * perf_percent / 100; |
| 330 | 331 | ||
| 331 | put_cpu(); | 332 | put_cpu(); |
| 332 | set_cpus_allowed_ptr(current, &saved_mask); | 333 | set_cpus_allowed_ptr(current, &saved_mask); |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9bbdc258624c..31d6f535a79d 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -1487,7 +1487,7 @@ no_policy: | |||
| 1487 | } | 1487 | } |
| 1488 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); | 1488 | EXPORT_SYMBOL_GPL(cpufreq_driver_target); |
| 1489 | 1489 | ||
| 1490 | int __cpufreq_driver_getavg(struct cpufreq_policy *policy) | 1490 | int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) |
| 1491 | { | 1491 | { |
| 1492 | int ret = 0; | 1492 | int ret = 0; |
| 1493 | 1493 | ||
| @@ -1495,8 +1495,8 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy) | |||
| 1495 | if (!policy) | 1495 | if (!policy) |
| 1496 | return -EINVAL; | 1496 | return -EINVAL; |
| 1497 | 1497 | ||
| 1498 | if (cpu_online(policy->cpu) && cpufreq_driver->getavg) | 1498 | if (cpu_online(cpu) && cpufreq_driver->getavg) |
| 1499 | ret = cpufreq_driver->getavg(policy->cpu); | 1499 | ret = cpufreq_driver->getavg(policy, cpu); |
| 1500 | 1500 | ||
| 1501 | cpufreq_cpu_put(policy); | 1501 | cpufreq_cpu_put(policy); |
| 1502 | return ret; | 1502 | return ret; |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 67c9d4f9edc0..f56debd9a8d7 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
| @@ -415,7 +415,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
| 415 | if (load < (dbs_tuners_ins.up_threshold - 10)) { | 415 | if (load < (dbs_tuners_ins.up_threshold - 10)) { |
| 416 | unsigned int freq_next, freq_cur; | 416 | unsigned int freq_next, freq_cur; |
| 417 | 417 | ||
| 418 | freq_cur = __cpufreq_driver_getavg(policy); | 418 | freq_cur = __cpufreq_driver_getavg(policy, policy->cpu); |
| 419 | if (!freq_cur) | 419 | if (!freq_cur) |
| 420 | freq_cur = policy->cur; | 420 | freq_cur = policy->cur; |
| 421 | 421 | ||
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 6fd5668aa572..1ee608fd7b77 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -187,7 +187,8 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
| 187 | unsigned int relation); | 187 | unsigned int relation); |
| 188 | 188 | ||
| 189 | 189 | ||
| 190 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy); | 190 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, |
| 191 | unsigned int cpu); | ||
| 191 | 192 | ||
| 192 | int cpufreq_register_governor(struct cpufreq_governor *governor); | 193 | int cpufreq_register_governor(struct cpufreq_governor *governor); |
| 193 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); | 194 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); |
| @@ -226,7 +227,9 @@ struct cpufreq_driver { | |||
| 226 | unsigned int (*get) (unsigned int cpu); | 227 | unsigned int (*get) (unsigned int cpu); |
| 227 | 228 | ||
| 228 | /* optional */ | 229 | /* optional */ |
| 229 | unsigned int (*getavg) (unsigned int cpu); | 230 | unsigned int (*getavg) (struct cpufreq_policy *policy, |
| 231 | unsigned int cpu); | ||
| 232 | |||
| 230 | int (*exit) (struct cpufreq_policy *policy); | 233 | int (*exit) (struct cpufreq_policy *policy); |
| 231 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); | 234 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); |
| 232 | int (*resume) (struct cpufreq_policy *policy); | 235 | int (*resume) (struct cpufreq_policy *policy); |
