diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-03-20 08:48:17 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-03-20 08:48:17 +0000 |
commit | 1d79561c4160abd7de9d754892088351f33e79c5 (patch) | |
tree | 87774e2a9517c4246ef8734627e41a59f8783aa9 /xen/drivers/cpufreq | |
parent | 7cb051784b0b23386aab37c518a1b3428e591fd0 (diff) | |
download | xen-1d79561c4160abd7de9d754892088351f33e79c5.tar.gz xen-1d79561c4160abd7de9d754892088351f33e79c5.tar.bz2 xen-1d79561c4160abd7de9d754892088351f33e79c5.zip |
cpufreq: Update cpufreq aperf and mperf read, so that it can be used
by both ondemand gov and user program
Current __get_measured_perf read aperf and mperf MSR and then clear
them for the sake of ondemand governor. This solution block user
program to get aperf and mperf on their purpose. In this patch, it no
longer clear aperf and mperf MSR, so that it can be used by both
ondemand gov and user program.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Diffstat (limited to 'xen/drivers/cpufreq')
-rw-r--r-- | xen/drivers/cpufreq/cpufreq_ondemand.c | 4 | ||||
-rw-r--r-- | xen/drivers/cpufreq/utility.c | 20 |
2 files changed, 14 insertions, 10 deletions
diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c index 9a0a940649..b01312d9af 100644 --- a/xen/drivers/cpufreq/cpufreq_ondemand.c +++ b/xen/drivers/cpufreq/cpufreq_ondemand.c @@ -161,9 +161,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) if (load < (dbs_tuners_ins.up_threshold - 10)) { unsigned int freq_next, freq_cur; - freq_cur = __cpufreq_driver_getavg(policy); - if (!freq_cur) - freq_cur = policy->cur; + freq_cur = cpufreq_driver_getavg(policy->cpu, GOV_GETAVG); freq_next = (freq_cur * load) / (dbs_tuners_ins.up_threshold - 10); diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c index 91225b9199..5daffedf59 100644 --- a/xen/drivers/cpufreq/utility.c +++ b/xen/drivers/cpufreq/utility.c @@ -357,17 +357,23 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, return retval; } -int __cpufreq_driver_getavg(struct cpufreq_policy *policy) +int cpufreq_driver_getavg(unsigned int cpu, unsigned int flag) { - int ret = 0; + struct cpufreq_policy *policy; + int freq_avg; - if (!policy) - return -EINVAL; + policy = cpufreq_cpu_policy[cpu]; + if (!cpu_online(cpu) || !policy) + return 0; - if (cpu_online(policy->cpu) && cpufreq_driver->getavg) - ret = cpufreq_driver->getavg(policy->cpu); + if (cpufreq_driver->getavg) + { + freq_avg = cpufreq_driver->getavg(cpu, flag); + if (freq_avg > 0) + return freq_avg; + } - return ret; + return policy->cur; } |