Thread (13 messages) 13 messages, 3 authors, 2021-08-12

Re: [PATCH V2 9/9] cpufreq: scmi: Use .register_em() callback

From: Lukasz Luba <lukasz.luba@arm.com>
Date: 2021-08-11 16:33:44
Also in: linux-pm, lkml


On 8/11/21 12:58 PM, Viresh Kumar wrote:
Set the newly added .register_em() callback to register with the EM
after the cpufreq policy is properly initialized.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
  drivers/cpufreq/scmi-cpufreq.c | 55 ++++++++++++++++++++--------------
  1 file changed, 32 insertions(+), 23 deletions(-)
  
+static void scmi_cpufreq_register_em(struct cpufreq_policy *policy)
+{
+	struct em_data_callback em_cb = EM_DATA_CB(scmi_get_cpu_power);
+	bool power_scale_mw = perf_ops->power_scale_mw_get(ph);
+	struct scmi_data *priv = policy->driver_data;
+
+	em_dev_register_perf_domain(get_cpu_device(policy->cpu), priv->nr_opp,
+				    &em_cb, priv->opp_shared_cpus,
+				    power_scale_mw);
I would free the priv->opp_shared_cpus mask here, since we don't
need it anymore and memory can be reclaimed. Don't forget this
setup would be called N CPUs times, on this per-CPU policy platform.

If freed here, then also there wouldn't be a need to free it in
scmi_cpufreq_exit() so you can remove it from there.
quoted hunk ↗ jump to hunk
+}
+
  static struct cpufreq_driver scmi_cpufreq_driver = {
  	.name	= "scmi",
  	.flags	= CPUFREQ_HAVE_GOVERNOR_PER_POLICY |
@@ -261,6 +269,7 @@ static struct cpufreq_driver scmi_cpufreq_driver = {
  	.get	= scmi_cpufreq_get_rate,
  	.init	= scmi_cpufreq_init,
  	.exit	= scmi_cpufreq_exit,
+	.register_em	= scmi_cpufreq_register_em,
  };
  
  static int scmi_cpufreq_probe(struct scmi_device *sdev)
I will test&review this patch on Monday when I re-flash custom FW to my
Juno (just to be sure that this per-CPU cpufreq + shared EM/EAS works).

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help