Thread (52 messages) 52 messages, 4 authors, 2021-06-29

Re: [PATCH V3 4/4] cpufreq: CPPC: Add support for frequency invariance

flat view

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: 2021-06-25 16:54:25
Also in: linux-acpi, lkml

On 25-06-21, 09:54, Ionela Voinescu wrote:
Hey,

On Thursday 24 Jun 2021 at 18:34:18 (+0530), Viresh Kumar wrote:
quoted
On 24-06-21, 10:48, Ionela Voinescu wrote:
quoted
On Monday 21 Jun 2021 at 14:49:37 (+0530), Viresh Kumar wrote:
quoted
The Frequency Invariance Engine (FIE) is providing a frequency scaling
correction factor that helps achieve more accurate load-tracking.
[..]
quoted
+static void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy)
+{
+	struct cppc_freq_invariance *cppc_fi;
+	int cpu;
+
+	if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate)
+		return;
+
+	/* policy->cpus will be empty here, use related_cpus instead */
+	topology_clear_scale_freq_source(SCALE_FREQ_SOURCE_CPPC, policy->related_cpus);
+
+	for_each_cpu(cpu, policy->related_cpus) {
+		cppc_fi = &per_cpu(cppc_freq_inv, cpu);
Do you think it might be worth having here something like:

		if (!cppc_fi->cpu_data)
			continue;

This would be to protect against cases where the platform does not boot
with all CPUs or the module is loaded after some have already been
offlined. Unlikely, but..
Even in that case policy->cpus will contain all offline+online CPUs (at ->init()
time), isn't it ?
Right, my bad. I missed cpumask_and(policy->cpus, policy->cpus,
cpu_online_mask) being done after init(). It logically seems a bit
wrong, but drivers are in control of setting policy->cpus and acting on
it, and in this case the driver does the right thing.
Do you want me to re-add your Reviewed-by here ?

-- 
viresh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help