diff options
author | Morten Rasmussen <Morten.Rasmussen@arm.com> | 2015-04-15 22:29:24 -0700 |
---|---|---|
committer | Vincent Guittot <vincent.guittot@linaro.org> | 2015-04-22 17:41:31 +0200 |
commit | 0fa682d1ec705997456cd00189e1c8e1876a79ac (patch) | |
tree | cd5e65d818bab4e99ecfa57f2a8433e35a7dfafb | |
parent | c8274fe3f37dd2fcdc09e8597f62d79f1e4481e0 (diff) |
cpufreq: Architecture specific callback for frequency changes
Architectures that don't have any other means for tracking cpu frequency
changes need a callback from cpufreq to implement a scaling factor to
enable scale-invariant per-entity load-tracking in the scheduler.
To compute the scale invariance correction factor the architecture would
need to know both the max frequency and the current frequency. This
patch defines weak functions for setting both from cpufreq.
Related architecture specific functions use weak function definitions.
The same approach is followed here.
These callbacks can be used to implement frequency scaling of cpu
capacity later.
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 28e59a48b35f..3c6398aaa108 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -280,6 +280,10 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) #endif } +void __weak arch_scale_set_curr_freq(int cpu, unsigned long freq) {} + +void __weak arch_scale_set_max_freq(int cpu, unsigned long freq) {} + static void __cpufreq_notify_transition(struct cpufreq_policy *policy, struct cpufreq_freqs *freqs, unsigned int state) { @@ -317,6 +321,7 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, pr_debug("FREQ: %lu - CPU: %lu\n", (unsigned long)freqs->new, (unsigned long)freqs->cpu); trace_cpu_frequency(freqs->new, freqs->cpu); + arch_scale_set_curr_freq(freqs->cpu, freqs->new); srcu_notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs); if (likely(policy) && likely(policy->cpu == freqs->cpu)) @@ -2148,7 +2153,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, struct cpufreq_policy *new_policy) { struct cpufreq_governor *old_gov; - int ret; + int ret, cpu; pr_debug("setting new policy for CPU %u: %u - %u kHz\n", new_policy->cpu, new_policy->min, new_policy->max); @@ -2186,6 +2191,12 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, policy->min = new_policy->min; policy->max = new_policy->max; + for_each_cpu(cpu, policy->cpus) { + arch_scale_set_max_freq(cpu, policy->max); + /* Workaround for corner cases where notifiers don't fire */ + arch_scale_set_curr_freq(cpu, policy->cur); + } + pr_debug("new min and max freqs are %u - %u kHz\n", policy->min, policy->max); |