Commit 599457ba authored by Vincent Guittot's avatar Vincent Guittot Committed by Ingo Molnar

cpufreq: Use the fixed and coherent frequency for scaling capacity

cpuinfo.max_freq can change at runtime because of boost as an example. This
implies that the value could be different from the frequency that has been
used to compute the capacity of a CPU.

The new arch_scale_freq_ref() returns a fixed and coherent frequency
that can be used to compute the capacity for a given frequency.

[ Also fix a arch_set_freq_scale()  newline style wart in <linux/cpufreq.h>. ]
Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Tested-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Acked-by: default avatarRafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20231211104855.558096-3-vincent.guittot@linaro.org
parent 9942cb22
...@@ -454,7 +454,7 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, ...@@ -454,7 +454,7 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
arch_set_freq_scale(policy->related_cpus, arch_set_freq_scale(policy->related_cpus,
policy->cur, policy->cur,
policy->cpuinfo.max_freq); arch_scale_freq_ref(policy->cpu));
spin_lock(&policy->transition_lock); spin_lock(&policy->transition_lock);
policy->transition_ongoing = false; policy->transition_ongoing = false;
...@@ -2174,7 +2174,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, ...@@ -2174,7 +2174,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
policy->cur = freq; policy->cur = freq;
arch_set_freq_scale(policy->related_cpus, freq, arch_set_freq_scale(policy->related_cpus, freq,
policy->cpuinfo.max_freq); arch_scale_freq_ref(policy->cpu));
cpufreq_stats_record_transition(policy, freq); cpufreq_stats_record_transition(policy, freq);
if (trace_cpu_frequency_enabled()) { if (trace_cpu_frequency_enabled()) {
......
...@@ -1203,6 +1203,7 @@ void arch_set_freq_scale(const struct cpumask *cpus, ...@@ -1203,6 +1203,7 @@ void arch_set_freq_scale(const struct cpumask *cpus,
{ {
} }
#endif #endif
/* the following are really really optional */ /* the following are really really optional */
extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs; extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment