]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.drivers/cpufreq_add_cpu_number_paramater_1.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / cpufreq_add_cpu_number_paramater_1.patch
1 From: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
2 Subject: cpufreq: Add a cpu parameter to __cpufreq_driver_getavg().
3
4 Add a cpu parameter to __cpufreq_driver_getavg(). This is needed for software
5 cpufreq coordination where policy->cpu may not be same as the CPU on which we
6 want to getavg frequency.
7
8 A follow-on patch will use this parameter to getavg freq from all cpus
9 in policy->cpus.
10
11 Change since last patch. Fix the offline/online and suspend/resume
12 oops reported by Youquan Song <youquan.song@intel.com>
13
14 Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
15 Signed-off-by: Thomas Renninger <trenn@suse.de>
16
17 ---
18 arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 5 +++--
19 drivers/cpufreq/cpufreq.c | 6 +++---
20 drivers/cpufreq/cpufreq_ondemand.c | 2 +-
21 include/linux/cpufreq.h | 7 +++++--
22 4 files changed, 12 insertions(+), 8 deletions(-)
23
24 Index: cpufreq.git/drivers/cpufreq/cpufreq.c
25 ===================================================================
26 --- cpufreq.git.orig/drivers/cpufreq/cpufreq.c 2008-08-04 10:28:26.000000000 -0700
27 +++ cpufreq.git/drivers/cpufreq/cpufreq.c 2008-08-04 10:31:27.000000000 -0700
28 @@ -1485,7 +1485,7 @@ int cpufreq_driver_target(struct cpufreq
29 }
30 EXPORT_SYMBOL_GPL(cpufreq_driver_target);
31
32 -int __cpufreq_driver_getavg(struct cpufreq_policy *policy)
33 +int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu)
34 {
35 int ret = 0;
36
37 @@ -1493,8 +1493,8 @@ int __cpufreq_driver_getavg(struct cpufr
38 if (!policy)
39 return -EINVAL;
40
41 - if (cpu_online(policy->cpu) && cpufreq_driver->getavg)
42 - ret = cpufreq_driver->getavg(policy->cpu);
43 + if (cpu_online(cpu) && cpufreq_driver->getavg)
44 + ret = cpufreq_driver->getavg(policy, cpu);
45
46 cpufreq_cpu_put(policy);
47 return ret;
48 Index: cpufreq.git/drivers/cpufreq/cpufreq_ondemand.c
49 ===================================================================
50 --- cpufreq.git.orig/drivers/cpufreq/cpufreq_ondemand.c 2008-08-04 10:28:26.000000000 -0700
51 +++ cpufreq.git/drivers/cpufreq/cpufreq_ondemand.c 2008-08-04 10:31:27.000000000 -0700
52 @@ -415,7 +415,7 @@ static void dbs_check_cpu(struct cpu_dbs
53 if (load < (dbs_tuners_ins.up_threshold - 10)) {
54 unsigned int freq_next, freq_cur;
55
56 - freq_cur = __cpufreq_driver_getavg(policy);
57 + freq_cur = __cpufreq_driver_getavg(policy, policy->cpu);
58 if (!freq_cur)
59 freq_cur = policy->cur;
60
61 Index: cpufreq.git/include/linux/cpufreq.h
62 ===================================================================
63 --- cpufreq.git.orig/include/linux/cpufreq.h 2008-08-04 10:28:26.000000000 -0700
64 +++ cpufreq.git/include/linux/cpufreq.h 2008-08-04 10:31:27.000000000 -0700
65 @@ -187,7 +187,8 @@ extern int __cpufreq_driver_target(struc
66 unsigned int relation);
67
68
69 -extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy);
70 +extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
71 + unsigned int cpu);
72
73 int cpufreq_register_governor(struct cpufreq_governor *governor);
74 void cpufreq_unregister_governor(struct cpufreq_governor *governor);
75 @@ -226,7 +227,9 @@ struct cpufreq_driver {
76 unsigned int (*get) (unsigned int cpu);
77
78 /* optional */
79 - unsigned int (*getavg) (unsigned int cpu);
80 + unsigned int (*getavg) (struct cpufreq_policy *policy,
81 + unsigned int cpu);
82 +
83 int (*exit) (struct cpufreq_policy *policy);
84 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
85 int (*resume) (struct cpufreq_policy *policy);
86 Index: cpufreq.git/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
87 ===================================================================
88 --- cpufreq.git.orig/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c 2008-08-04 10:28:26.000000000 -0700
89 +++ cpufreq.git/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c 2008-08-04 10:31:27.000000000 -0700
90 @@ -256,7 +256,8 @@ static u32 get_cur_val(const cpumask_t *
91 * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and
92 * no meaning should be associated with absolute values of these MSRs.
93 */
94 -static unsigned int get_measured_perf(unsigned int cpu)
95 +static unsigned int get_measured_perf(struct cpufreq_policy *policy,
96 + unsigned int cpu)
97 {
98 union {
99 struct {
100 @@ -326,7 +327,7 @@ static unsigned int get_measured_perf(un
101
102 #endif
103
104 - retval = per_cpu(drv_data, cpu)->max_freq * perf_percent / 100;
105 + retval = per_cpu(drv_data, policy->cpu)->max_freq * perf_percent / 100;
106
107 put_cpu();
108 set_cpus_allowed_ptr(current, &saved_mask);
109
110 --
111