aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>2009-04-06 14:26:08 -0400
committerLen Brown <len.brown@intel.com>2009-04-07 18:15:05 -0400
commit18b2646fe3babeb40b34a0c1751e0bf5adfdc64c (patch)
tree544fd1676479f609a9b307365374e44c697a44f5 /arch/x86/kernel
parente4f6937222dbb61b8b8e62caca3d32e648b3b14b (diff)
ACPI x86: Make aperf/mperf MSR access in acpi_cpufreq read_only
Do not write zeroes to APERF and MPERF by ondemand governor. With this change, other users can share these MSRs for reads. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 340bdbebba07..9d3af380c6bd 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -68,6 +68,7 @@ struct acpi_cpufreq_data {
68 unsigned int max_freq; 68 unsigned int max_freq;
69 unsigned int resume; 69 unsigned int resume;
70 unsigned int cpu_feature; 70 unsigned int cpu_feature;
71 u64 saved_aperf, saved_mperf;
71}; 72};
72 73
73static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); 74static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data);
@@ -259,9 +260,6 @@ static long read_measured_perf_ctrs(void *_cur)
259 rdmsr(MSR_IA32_APERF, cur->aperf.split.lo, cur->aperf.split.hi); 260 rdmsr(MSR_IA32_APERF, cur->aperf.split.lo, cur->aperf.split.hi);
260 rdmsr(MSR_IA32_MPERF, cur->mperf.split.lo, cur->mperf.split.hi); 261 rdmsr(MSR_IA32_MPERF, cur->mperf.split.lo, cur->mperf.split.hi);
261 262
262 wrmsr(MSR_IA32_APERF, 0, 0);
263 wrmsr(MSR_IA32_MPERF, 0, 0);
264
265 return 0; 263 return 0;
266} 264}
267 265
@@ -281,13 +279,20 @@ static long read_measured_perf_ctrs(void *_cur)
281static unsigned int get_measured_perf(struct cpufreq_policy *policy, 279static unsigned int get_measured_perf(struct cpufreq_policy *policy,
282 unsigned int cpu) 280 unsigned int cpu)
283{ 281{
284 struct perf_pair cur; 282 struct perf_pair readin, cur;
285 unsigned int perf_percent; 283 unsigned int perf_percent;
286 unsigned int retval; 284 unsigned int retval;
287 285
288 if (!work_on_cpu(cpu, read_measured_perf_ctrs, &cur)) 286 if (!work_on_cpu(cpu, read_measured_perf_ctrs, &readin))
289 return 0; 287 return 0;
290 288
289 cur.aperf.whole = readin.aperf.whole -
290 per_cpu(drv_data, cpu)->saved_aperf;
291 cur.mperf.whole = readin.mperf.whole -
292 per_cpu(drv_data, cpu)->saved_mperf;
293 per_cpu(drv_data, cpu)->saved_aperf = readin.aperf.whole;
294 per_cpu(drv_data, cpu)->saved_mperf = readin.mperf.whole;
295
291#ifdef __i386__ 296#ifdef __i386__
292 /* 297 /*
293 * We dont want to do 64 bit divide with 32 bit kernel 298 * We dont want to do 64 bit divide with 32 bit kernel