forked from luck/tmp_suning_uos_patched
Merge branch 'pm-cpufreq-ondemand' into pm-cpufreq
* pm-cpufreq: cpufreq: Remove unused function __cpufreq_driver_getavg() cpufreq: Remove unused APERF/MPERF support cpufreq: ondemand: Change the calculation of target frequency
This commit is contained in:
commit
1133bfa6dc
|
@ -942,35 +942,6 @@ extern int set_tsc_mode(unsigned int val);
|
|||
|
||||
extern u16 amd_get_nb_id(int cpu);
|
||||
|
||||
struct aperfmperf {
|
||||
u64 aperf, mperf;
|
||||
};
|
||||
|
||||
static inline void get_aperfmperf(struct aperfmperf *am)
|
||||
{
|
||||
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_APERFMPERF));
|
||||
|
||||
rdmsrl(MSR_IA32_APERF, am->aperf);
|
||||
rdmsrl(MSR_IA32_MPERF, am->mperf);
|
||||
}
|
||||
|
||||
#define APERFMPERF_SHIFT 10
|
||||
|
||||
static inline
|
||||
unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
|
||||
struct aperfmperf *new)
|
||||
{
|
||||
u64 aperf = new->aperf - old->aperf;
|
||||
u64 mperf = new->mperf - old->mperf;
|
||||
unsigned long ratio = aperf;
|
||||
|
||||
mperf >>= APERFMPERF_SHIFT;
|
||||
if (mperf)
|
||||
ratio = div64_u64(aperf, mperf);
|
||||
|
||||
return ratio;
|
||||
}
|
||||
|
||||
extern unsigned long arch_align_stack(unsigned long sp);
|
||||
extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ obj-$(CONFIG_GENERIC_CPUFREQ_CPU0) += cpufreq-cpu0.o
|
|||
# powernow-k8 can load then. ACPI is preferred to all other hardware-specific drivers.
|
||||
# speedstep-* is preferred over p4-clockmod.
|
||||
|
||||
obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o mperf.o
|
||||
obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o
|
||||
obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o
|
||||
obj-$(CONFIG_X86_PCC_CPUFREQ) += pcc-cpufreq.o
|
||||
obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <asm/msr.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/cpufeature.h>
|
||||
#include "mperf.h"
|
||||
|
||||
MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
|
||||
MODULE_DESCRIPTION("ACPI Processor P-States Driver");
|
||||
|
@ -861,10 +860,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||
/* notify BIOS that we exist */
|
||||
acpi_processor_notify_smm(THIS_MODULE);
|
||||
|
||||
/* Check for APERF/MPERF support in hardware */
|
||||
if (boot_cpu_has(X86_FEATURE_APERFMPERF))
|
||||
acpi_cpufreq_driver.getavg = cpufreq_get_measured_perf;
|
||||
|
||||
pr_debug("CPU%u - ACPI performance management activated.\n", cpu);
|
||||
for (i = 0; i < perf->state_count; i++)
|
||||
pr_debug(" %cP%d: %d MHz, %d mW, %d uS\n",
|
||||
|
|
|
@ -1670,18 +1670,6 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(cpufreq_driver_target);
|
||||
|
||||
int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu)
|
||||
{
|
||||
if (cpufreq_disabled())
|
||||
return 0;
|
||||
|
||||
if (!cpufreq_driver->getavg)
|
||||
return 0;
|
||||
|
||||
return cpufreq_driver->getavg(policy, cpu);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__cpufreq_driver_getavg);
|
||||
|
||||
/*
|
||||
* when "event" is CPUFREQ_GOV_LIMITS
|
||||
*/
|
||||
|
|
|
@ -53,7 +53,7 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
|
|||
|
||||
policy = cdbs->cur_policy;
|
||||
|
||||
/* Get Absolute Load (in terms of freq for ondemand gov) */
|
||||
/* Get Absolute Load */
|
||||
for_each_cpu(j, policy->cpus) {
|
||||
struct cpu_dbs_common_info *j_cdbs;
|
||||
u64 cur_wall_time, cur_idle_time;
|
||||
|
@ -104,14 +104,6 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
|
|||
|
||||
load = 100 * (wall_time - idle_time) / wall_time;
|
||||
|
||||
if (dbs_data->cdata->governor == GOV_ONDEMAND) {
|
||||
int freq_avg = __cpufreq_driver_getavg(policy, j);
|
||||
if (freq_avg <= 0)
|
||||
freq_avg = policy->cur;
|
||||
|
||||
load *= freq_avg;
|
||||
}
|
||||
|
||||
if (load > max_load)
|
||||
max_load = load;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,6 @@ struct od_dbs_tuners {
|
|||
unsigned int sampling_rate;
|
||||
unsigned int sampling_down_factor;
|
||||
unsigned int up_threshold;
|
||||
unsigned int adj_up_threshold;
|
||||
unsigned int powersave_bias;
|
||||
unsigned int io_is_busy;
|
||||
};
|
||||
|
|
|
@ -29,11 +29,9 @@
|
|||
#include "cpufreq_governor.h"
|
||||
|
||||
/* On-demand governor macros */
|
||||
#define DEF_FREQUENCY_DOWN_DIFFERENTIAL (10)
|
||||
#define DEF_FREQUENCY_UP_THRESHOLD (80)
|
||||
#define DEF_SAMPLING_DOWN_FACTOR (1)
|
||||
#define MAX_SAMPLING_DOWN_FACTOR (100000)
|
||||
#define MICRO_FREQUENCY_DOWN_DIFFERENTIAL (3)
|
||||
#define MICRO_FREQUENCY_UP_THRESHOLD (95)
|
||||
#define MICRO_FREQUENCY_MIN_SAMPLE_RATE (10000)
|
||||
#define MIN_FREQUENCY_UP_THRESHOLD (11)
|
||||
|
@ -161,14 +159,10 @@ static void dbs_freq_increase(struct cpufreq_policy *p, unsigned int freq)
|
|||
|
||||
/*
|
||||
* Every sampling_rate, we check, if current idle time is less than 20%
|
||||
* (default), then we try to increase frequency. Every sampling_rate, we look
|
||||
* for the lowest frequency which can sustain the load while keeping idle time
|
||||
* over 30%. If such a frequency exist, we try to decrease to this frequency.
|
||||
*
|
||||
* Any frequency increase takes it to the maximum frequency. Frequency reduction
|
||||
* happens at minimum steps of 5% (default) of current frequency
|
||||
* (default), then we try to increase frequency. Else, we adjust the frequency
|
||||
* proportional to load.
|
||||
*/
|
||||
static void od_check_cpu(int cpu, unsigned int load_freq)
|
||||
static void od_check_cpu(int cpu, unsigned int load)
|
||||
{
|
||||
struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
|
||||
struct cpufreq_policy *policy = dbs_info->cdbs.cur_policy;
|
||||
|
@ -178,29 +172,17 @@ static void od_check_cpu(int cpu, unsigned int load_freq)
|
|||
dbs_info->freq_lo = 0;
|
||||
|
||||
/* Check for frequency increase */
|
||||
if (load_freq > od_tuners->up_threshold * policy->cur) {
|
||||
if (load > od_tuners->up_threshold) {
|
||||
/* If switching to max speed, apply sampling_down_factor */
|
||||
if (policy->cur < policy->max)
|
||||
dbs_info->rate_mult =
|
||||
od_tuners->sampling_down_factor;
|
||||
dbs_freq_increase(policy, policy->max);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check for frequency decrease */
|
||||
/* if we cannot reduce the frequency anymore, break out early */
|
||||
if (policy->cur == policy->min)
|
||||
return;
|
||||
|
||||
/*
|
||||
* The optimal frequency is the frequency that is the lowest that can
|
||||
* support the current CPU usage without triggering the up policy. To be
|
||||
* safe, we focus 10 points under the threshold.
|
||||
*/
|
||||
if (load_freq < od_tuners->adj_up_threshold
|
||||
* policy->cur) {
|
||||
} else {
|
||||
/* Calculate the next frequency proportional to load */
|
||||
unsigned int freq_next;
|
||||
freq_next = load_freq / od_tuners->adj_up_threshold;
|
||||
freq_next = load * policy->cpuinfo.max_freq / 100;
|
||||
|
||||
/* No longer fully busy, reset rate_mult */
|
||||
dbs_info->rate_mult = 1;
|
||||
|
@ -374,9 +356,6 @@ static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf,
|
|||
input < MIN_FREQUENCY_UP_THRESHOLD) {
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Calculate the new adj_up_threshold */
|
||||
od_tuners->adj_up_threshold += input;
|
||||
od_tuners->adj_up_threshold -= od_tuners->up_threshold;
|
||||
|
||||
od_tuners->up_threshold = input;
|
||||
return count;
|
||||
|
@ -525,8 +504,6 @@ static int od_init(struct dbs_data *dbs_data)
|
|||
if (idle_time != -1ULL) {
|
||||
/* Idle micro accounting is supported. Use finer thresholds */
|
||||
tuners->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
|
||||
tuners->adj_up_threshold = MICRO_FREQUENCY_UP_THRESHOLD -
|
||||
MICRO_FREQUENCY_DOWN_DIFFERENTIAL;
|
||||
/*
|
||||
* In nohz/micro accounting case we set the minimum frequency
|
||||
* not depending on HZ, but fixed (very low). The deferred
|
||||
|
@ -535,8 +512,6 @@ static int od_init(struct dbs_data *dbs_data)
|
|||
dbs_data->min_sampling_rate = MICRO_FREQUENCY_MIN_SAMPLE_RATE;
|
||||
} else {
|
||||
tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD;
|
||||
tuners->adj_up_threshold = DEF_FREQUENCY_UP_THRESHOLD -
|
||||
DEF_FREQUENCY_DOWN_DIFFERENTIAL;
|
||||
|
||||
/* For correct statistics, we need 10 ticks for each measure */
|
||||
dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO *
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "mperf.h"
|
||||
|
||||
static DEFINE_PER_CPU(struct aperfmperf, acfreq_old_perf);
|
||||
|
||||
/* Called via smp_call_function_single(), on the target CPU */
|
||||
static void read_measured_perf_ctrs(void *_cur)
|
||||
{
|
||||
struct aperfmperf *am = _cur;
|
||||
|
||||
get_aperfmperf(am);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the measured active (C0) frequency on this CPU since last call
|
||||
* to this function.
|
||||
* Input: cpu number
|
||||
* Return: Average CPU frequency in terms of max frequency (zero on error)
|
||||
*
|
||||
* We use IA32_MPERF and IA32_APERF MSRs to get the measured performance
|
||||
* over a period of time, while CPU is in C0 state.
|
||||
* IA32_MPERF counts at the rate of max advertised frequency
|
||||
* IA32_APERF counts at the rate of actual CPU frequency
|
||||
* Only IA32_APERF/IA32_MPERF ratio is architecturally defined and
|
||||
* no meaning should be associated with absolute values of these MSRs.
|
||||
*/
|
||||
unsigned int cpufreq_get_measured_perf(struct cpufreq_policy *policy,
|
||||
unsigned int cpu)
|
||||
{
|
||||
struct aperfmperf perf;
|
||||
unsigned long ratio;
|
||||
unsigned int retval;
|
||||
|
||||
if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1))
|
||||
return 0;
|
||||
|
||||
ratio = calc_aperfmperf_ratio(&per_cpu(acfreq_old_perf, cpu), &perf);
|
||||
per_cpu(acfreq_old_perf, cpu) = perf;
|
||||
|
||||
retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT;
|
||||
|
||||
return retval;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpufreq_get_measured_perf);
|
||||
MODULE_LICENSE("GPL");
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* (c) 2010 Advanced Micro Devices, Inc.
|
||||
* Your use of this code is subject to the terms and conditions of the
|
||||
* GNU general public license version 2. See "COPYING" or
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
unsigned int cpufreq_get_measured_perf(struct cpufreq_policy *policy,
|
||||
unsigned int cpu);
|
|
@ -216,10 +216,6 @@ extern int cpufreq_driver_target(struct cpufreq_policy *policy,
|
|||
extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq,
|
||||
unsigned int relation);
|
||||
|
||||
extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
|
||||
unsigned int cpu);
|
||||
|
||||
int cpufreq_register_governor(struct cpufreq_governor *governor);
|
||||
void cpufreq_unregister_governor(struct cpufreq_governor *governor);
|
||||
|
||||
|
@ -258,8 +254,6 @@ struct cpufreq_driver {
|
|||
unsigned int (*get) (unsigned int cpu);
|
||||
|
||||
/* optional */
|
||||
unsigned int (*getavg) (struct cpufreq_policy *policy,
|
||||
unsigned int cpu);
|
||||
int (*bios_limit) (int cpu, unsigned int *limit);
|
||||
|
||||
int (*exit) (struct cpufreq_policy *policy);
|
||||
|
|
Loading…
Reference in New Issue
Block a user