public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Sibi Sankar <quic_sibis@quicinc.com>
Cc: linux-arm-kernel@lists.infradead.org, viresh.kumar@linaro.org,
	rafael@kernel.org, cristian.marussi@arm.com,
	sudeep.holla@arm.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, quic_mdtipton@quicinc.com,
	linux-arm-msm@vger.kernel.org,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>
Subject: Re: [PATCH 3/3] cpufreq: scmi: Register for limit change notifications
Date: Wed, 10 Jan 2024 08:26:25 +0000	[thread overview]
Message-ID: <94aad654-4f20-4b82-b978-77f1f9376dab@arm.com> (raw)
In-Reply-To: <20240108140118.1596-4-quic_sibis@quicinc.com>

Hi Sibi,

+ Morten and Dietmar on CC

On 1/8/24 14:01, Sibi Sankar wrote:
> Register for limit change notifications if supported with the help of
> perf_notify_support interface and determine the throttled frequency
> using the perf_opp_xlate to apply HW pressure.
> 
> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
> ---
>   drivers/cpufreq/scmi-cpufreq.c | 42 +++++++++++++++++++++++++++++++++-
>   1 file changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
> index 4ee23f4ebf4a..53bc8868455d 100644
> --- a/drivers/cpufreq/scmi-cpufreq.c
> +++ b/drivers/cpufreq/scmi-cpufreq.c
> @@ -25,9 +25,13 @@ struct scmi_data {
>   	int domain_id;
>   	int nr_opp;
>   	struct device *cpu_dev;
> +	struct cpufreq_policy *policy;
>   	cpumask_var_t opp_shared_cpus;
> +	struct notifier_block limit_notify_nb;
>   };
>   
> +const struct scmi_handle *handle;
> +static struct scmi_device *scmi_dev;
>   static struct scmi_protocol_handle *ph;
>   static const struct scmi_perf_proto_ops *perf_ops;
>   
> @@ -144,6 +148,22 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power,
>   	return 0;
>   }
>   
> +static int scmi_limit_notify_cb(struct notifier_block *nb, unsigned long event, void *data)
> +{
> +	unsigned long freq_hz;
> +	struct scmi_perf_limits_report *limit_notify = data;
> +	struct scmi_data *priv = container_of(nb, struct scmi_data, limit_notify_nb);
> +	struct cpufreq_policy *policy = priv->policy;
> +
> +	if (perf_ops->perf_opp_xlate(ph, priv->domain_id, limit_notify->range_max, &freq_hz))
> +		return NOTIFY_OK;
> +
> +	/* Update HW pressure (the boost frequencies are accepted) */
> +	arch_update_hw_pressure(policy->related_cpus, (freq_hz / HZ_PER_KHZ));

This is wrong. The whole idea of the new HW pressure was that I wanted
to get rid of the 'signal smoothing' mechanism in order to get
instantaneous value from FW to task scheduler. Vincent created
2 interfaces in that new HW pressure:
1. cpufreq_update_pressure(policy) - raw variable
2. arch_update_hw_pressure(policy->related_cpus, (freq_hz / HZ_PER_KHZ))
    - smoothing PELT mechanism, good for raw IRQ in drivers

In our SCMI cpufreq driver we need the 1st one:
cpufreq_update_pressure(policy)

The FW will do the 'signal smoothing or filtering' and won't
flood the kernel with hundreds of notifications.

So, please change that bit and add me, Morten and Dietmar on CC.
I would like to review it.

Regards,
Lukasz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-01-10  8:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-08 14:01 [PATCH 0/3] firmware: arm_scmi: Register and handle limits change notification Sibi Sankar
2024-01-08 14:01 ` [PATCH 1/3] firmware: arm_scmi: Add perf_notify_support interface Sibi Sankar
2024-01-08 14:01 ` [PATCH 2/3] firmware: arm_scmi: Add perf_opp_xlate interface Sibi Sankar
2024-01-10  7:29   ` Viresh Kumar
2024-01-17  2:59     ` Sibi Sankar
2024-01-08 14:01 ` [PATCH 3/3] cpufreq: scmi: Register for limit change notifications Sibi Sankar
2024-01-10  8:26   ` Lukasz Luba [this message]
2024-01-17  2:58     ` Sibi Sankar
2024-01-17  8:03       ` Lukasz Luba
2024-01-17  9:41 ` [PATCH 0/3] firmware: arm_scmi: Register and handle limits change notification Cristian Marussi
2024-01-17 12:06   ` Sibi Sankar

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=94aad654-4f20-4b82-b978-77f1f9376dab@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=cristian.marussi@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=morten.rasmussen@arm.com \
    --cc=quic_mdtipton@quicinc.com \
    --cc=quic_sibis@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=viresh.kumar@linaro.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox