mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sibi Sankar <quic_sibis@quicinc.com>
To: Pierre Gondois <pierre.gondois@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>, <sudeep.holla@arm.com>,
	<linux-pm@vger.kernel.org>, <cristian.marussi@arm.com>,
	<linux-kernel@vger.kernel.org>, <rafael@kernel.org>,
	<viresh.kumar@linaro.org>, <quic_mdtipton@quicinc.com>,
	<lukasz.luba@arm.com>, <linux-arm-msm@vger.kernel.org>,
	<dietmar.eggemann@arm.com>, <morten.rasmussen@arm.com>
Subject: Re: [PATCH V2 4/4] cpufreq: scmi: Register for limit change notifications
Date: Tue, 13 Feb 2024 11:16:03 +0530	[thread overview]
Message-ID: <145277d6-ddb5-6dd6-c534-d92ea2d1ff28@quicinc.com> (raw)
In-Reply-To: <512d7296-2706-4779-b475-fbf2d208e282@arm.com>



On 1/31/24 19:59, Pierre Gondois wrote:
> Hello Sibi,
> 
> On 1/17/24 11:41, 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_freq_xlate to apply HW pressure.
>>

Hey Pierre,

Thanks for taking time to review the series.

>> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
>> ---
>>
>> v2:
>> * Export cpufreq_update_pressure and use it directly [Lukasz]
>>
>>   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..e0aa85764451 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_freq_xlate(ph, priv->domain_id, 
>> limit_notify->range_max, &freq_hz))
>> +        return NOTIFY_OK;
>> +
>> +    policy->max = freq_hz / HZ_PER_KHZ;
> 
> Maybe 'policy->max' should be checked. The limits received by SCMI is 
> blindly
> trusted. This might be ok, but could also lead to some inconsistency.
> 
> The scmi_cpufreq_driver's verify() callback could be used.

ack, will fix this in the next re-spin.

> 
> ---
> 
> I think there might also be corner cases where the SCP might advertise
> the maximum boosted frequency as the max limit, but boosting might not
> be enabled on the kernel side.
> So I think this should be checked when setting 'policy->max',

ack

-Sibi
> 
> Regards,
> Pierre
> 
[...]
>>       if (!handle)

      reply	other threads:[~2024-02-13  5:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 10:41 [PATCH V2 0/4] firmware: arm_scmi: Register and handle limits change notification Sibi Sankar
2024-01-17 10:41 ` [PATCH V2 1/4] firmware: arm_scmi: Add perf_notify_support interface Sibi Sankar
2024-01-29 15:50   ` Cristian Marussi
2024-01-29 17:33     ` Cristian Marussi
2024-01-31 11:28       ` Sudeep Holla
2024-01-31 11:35         ` Cristian Marussi
2024-02-12 12:44         ` Cristian Marussi
2024-02-13  5:40           ` Sibi Sankar
2024-01-17 10:41 ` [PATCH V2 2/4] firmware: arm_scmi: Add perf_freq_xlate interface Sibi Sankar
2024-01-29 15:53   ` Cristian Marussi
2024-01-31 11:45   ` Cristian Marussi
2024-01-17 10:41 ` [PATCH V2 3/4] cpufreq: Export cpufreq_update_pressure Sibi Sankar
2024-01-17 10:41 ` [PATCH V2 4/4] cpufreq: scmi: Register for limit change notifications Sibi Sankar
2024-01-29 15:59   ` Cristian Marussi
2024-02-13  5:42     ` Sibi Sankar
2024-01-31 14:29   ` Pierre Gondois
2024-02-13  5:46     ` Sibi Sankar [this message]

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=145277d6-ddb5-6dd6-c534-d92ea2d1ff28@quicinc.com \
    --to=quic_sibis@quicinc.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=lukasz.luba@arm.com \
    --cc=morten.rasmussen@arm.com \
    --cc=pierre.gondois@arm.com \
    --cc=quic_mdtipton@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

all inboxes | Powered by JetHome®