LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Cristian Marussi <cristian.marussi@arm.com>,
	linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Quentin Perret <qperret@google.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 9/9] cpufreq: scmi: Use .register_em() callback
Date: Wed, 11 Aug 2021 17:32:09 +0100	[thread overview]
Message-ID: <143a03df-d858-b2de-a2cc-983c35d71e53@arm.com> (raw)
In-Reply-To: <6094d891b4cb0cba3357e2894c8a4431c4c65e67.1628682874.git.viresh.kumar@linaro.org>



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.

> +}
> +
>   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).

  parent reply	other threads:[~2021-08-11 16:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 11:58 [PATCH V2 0/9] cpufreq: Auto-register with energy model Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 1/9] cpufreq: Auto-register with energy model if asked Viresh Kumar
2021-08-11 13:02   ` Quentin Perret
2021-08-11 14:30   ` Lukasz Luba
2021-08-11 11:58 ` [PATCH V2 2/9] cpufreq: dt: Use auto-registration for energy model Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 3/9] cpufreq: imx6q: " Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 4/9] cpufreq: mediatek: " Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 5/9] cpufreq: omap: " Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 6/9] cpufreq: qcom-cpufreq-hw: " Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 7/9] cpufreq: scpi: " Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 8/9] cpufreq: vexpress: " Viresh Kumar
2021-08-11 11:58 ` [PATCH V2 9/9] cpufreq: scmi: Use .register_em() callback Viresh Kumar
2021-08-11 13:17   ` Quentin Perret
2021-08-11 14:09     ` Lukasz Luba
2021-08-11 14:39       ` Quentin Perret
2021-08-11 15:52         ` Lukasz Luba
2021-08-12  3:53     ` Viresh Kumar
2021-08-11 16:32   ` Lukasz Luba [this message]
2021-08-12  4:22     ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=143a03df-d858-b2de-a2cc-983c35d71e53@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=qperret@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --subject='Re: [PATCH V2 9/9] cpufreq: scmi: Use .register_em() callback' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).