From: Pierre Gondois <pierre.gondois@arm.com>
To: Ananthu C V <ananthu.cv@oss.qualcomm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Sudeep Holla <sudeep.holla@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Jie Zhan <zhanjie9@hisilicon.com>,
linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
linux-pm@vger.kernel.org,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Oleg Keri <okerixx@gmail.com>
Subject: Re: [PATCH v3 2/2] cpufreq: fix policy max not returning to non-boost freq on boost disable
Date: Mon, 23 Nov 2026 17:31:56 +0100 [thread overview]
Message-ID: <e78bdcde-9a06-47b9-afd7-e03ee10b395a@arm.com> (raw)
In-Reply-To: <awQT59OrWPyMzxtc@hu-anancv-blr.qualcomm.com>
On 11/23/26 11:22, Ananthu C V wrote:
> Hi Pierre,
>
> On Fri, Nov 20, 2026 at 01:08:01PM +0100, Pierre Gondois wrote:
>> Hello Viresh, Ananthu:
> [snip]
>
>> Sorry for the wall of text:
>>
>> cpuinfo.max_freq is used for various purposes. This patchset corrects
>> some bugs, but ideally the usage of cpuinfo.max_freq should be clearer.
>> cpuinfo.max_freq is used as:
>>
>> The max hardware freq.:
>> - cpufreq_schedutil.c::get_capacity_ref_freq()
>> - arch_topology.c::init_cpu_capacity_callback()
>> - cpufreq.c::cpufreq_get_hw_max_freq()
>> - intel_llc::cpu_max_MHz()
>> - windfarm_cpufreq_clamp.c()::wf_cpufreq_clamp_init
>>
>> The max boost/non-boost freq. (i.e. without the user-set constraint):
>> - processor_thermal.c::cpufreq_update_thermal_limit()
>> - cpufreq_ondemand.c::od_update()
>> - cpufreq.c::policy_set_boost()
>> - cpufreq.c::cpufreq_update_pressure()
>>
>> cpuinfo.max_freq value depends on the presence/absence of boost. It is
>> thus hard to know what the field actually contains, and:
>> - PATCH 1 adds cpufreq_frequency_table_max() to get the actual boosted
>> max freq.
>> - PATCH 2 allows to retrieve the actual non-boosted max freq.
>> are trying to rationalize that.
> Thanks, cpuinfo.max_freq not actually being very clear about what value it
> contains is precisely one of the reasons why this approach was taken.
>
>> ------------
>> The following frequencies:
>> - max hardware (boosted) freq.
>> - max non-boosted freq. (i.e. nominal freq.)
>> are CPU/platform specific values that can be computed at init() and
>> which will not change merely because boost is enabled or disabled
>>
>> The existing. set_boost() callback implementations are mostly
>> retrieving these values to update cpuinfo.max_freq, but this could be
>> done from the main framework if we stored these values (in cpuinfo for
>> instance). Similar remark for cpufreq_frequency_table_cpuinfo().
>>
>> It seems there is a lot of code to re-compute/update these values even
>> though they should not change. Computing them and storing them once
>> should be possible I think.
> Right, that makes more sense. My original idea was to not go trough separate
> iterations when freq_table.c already does that, but it makes sense to just
> keep it entirely seperate and avoid further calculations of the same. As you
> said, the values should be constant anyway, and once calculated they should
> stay the same.
>
>> ------------
>> A. acpi-cpufreq driver
>> 3c55e94c0ade "cpufreq: ACPI: Extend frequency tables to cover boost
>> frequencies" added a synthetic entry in the freq. table to represent
>> the max boosted freq. as read from CPPC. Entries in the freq. table are
>> otherwise fetched from _PSS entries.
>> 538b0188da46 "cpufreq: ACPI: Set cpuinfo.max_freq directly if max boost"
>> is known removed the synthetic freq. which was added in the freq. table
>> as it reported the synthetic freq. to userspace which was apparently
>> confusing.
>>
>> PATCH 2 "cpufreq: fix policy max not returning to non-boost freq on
>> boost disable" modifies cpufreq_frequency_table_cpuinfo() to handle
>> this case, but maybe it would be easier to tag/flag the case where
>> the max boosted freq. is not in the freq. table and handle this case
>> separately. Doing the following for all drivers makes things
>> complicated IMO.
>> ```
>> /*
>> * If the driver has set its own cpuinfo.max_freq above max_freq, leave
>> * it as is.
>> */
>> if (policy->cpuinfo.max_freq < max_freq)
>> policy->cpuinfo.max_freq = max_freq;
> I take it that (correct me if I am wrong) this generally means we don't
> want to go implementing solutions for this in every driver and instead
> should let the core itself handle this (which is what the current series
> is trying to do)? A maintainer call on which route to go will definitely
> help in focusing the attention there. ACK on simplifying the interaction
> with cpufreq_frequency_table_cpuinfo().
IMO yes, the condition above which seems to be only here for the
acpi-cpufreq driver could be handled in the generic code in
policy_set_boost(). The max available freq. could then be obtained
with:
unsigned long get_max_freq(struct cpufreq_policy *policy)
{
return policy->boost_enabled ?
policy->cpuinfo.max_boost_freq :
policy->cpuinfo.max_base_freq;
}
instead of storing different values in policy->cpuinfo.max_freq,
which seems to be made to describe a CPU capabilities.
This would also allow to remove the responsibility to set
cpuinfo.max_freq in the .set_boost() callbacks and factorize it.
>> B. The new CPPC spec [1]
>> The nominal freq. will be writeable in the future, so some additional
>> synchronization will be required.
>>
>> ------------
>> This patchset adds a cpuinfomax_base_freq field. Maybe we should also
>> add a cpuinfo.max_boost_freq field to make it clearer when someone
>> wants to get the max hardware freq. If we find a way to know when
>> cpuinfo.max_boost_freq is a synthetic value, this would allow to
>> solve [A].
> The idea was exactly this when I went this route of calculating these
> values separately. The previous revision was doing precisely this,
> by adding a cpuinfo.max_table_freq field (fun fact, the initial name I
> has was max_boost_freq itself, which I later changed to max_table_freq
> because not everything is always boost capable :p). But the general
> consensus was that, including the reviews from Rafael, we don't need a
> new field added to track this value. And even for the max_base_freq
> field the current revision is using, the general opinion seems to be
> that we don't necessarily need such a field. Now, I am personally of the
> opinion that adding these two fields (and calculating and storing them
> once as you already mentioned) will make the calculations infinitely
> simpler. What route should we really go?
I also agree, but also Rafael pointed out that this could work without
new fields [1]. Maybe there will be new elements in this thread
and the direction will change (or not).
[1]
https://lore.kernel.org/all/CAJZ5v0i_QYa-LcrK1U1VZjZZiJ3d-9hPbMdBbaGoqMds0BAU6w@mail.gmail.com/
>
>> The new CPPC nominal freq. should always be lower than the initial
>> ospm_nominal_freq field [1]. So an additional (struct freq_qos_request)
>> for the nominal (i.e. max_base_freq) frequency might be nice to have
>> aswell.
> That sounds like a good enhancement, but I'd prefer to work on that later
> once the current issues are solved, these are bugs causing some decent
> damage afterall. But LMK if having that also is quite important at this
> point.
>
>> ------------
>> Short summary:
>> The patchset should fix the bugs, but IMO it is still not really clear
>> which max freq. is stored cpuinfo.max_freq.
>> I think we would benefit from also:
>> - adding a cpuinfo.max_boost_freq
>> - adding a (struct freq_qos_request) for the nominal freq.
>> - use cpuinfo.max_[base|boost]_freq wherever needed, to simplify
>> the .set_boost() callbacks for instance.
>>
>> but this might be out of scope if the goal is just to fix the bugs.
> Thanks a lot for being detailed, Pierre. The direction I have taken for
> this series is exactly this, sans the additional qos request for the max
> base freq. As you have pointed out, the current goal is to get at least
> the bugs fixed. So having the maintainers make a call on what is the
> direction we want to take in general will be a lot of help. What do you
> all think, Viresh, Rafael, and Pierre?
>
> Best,
> Ananthu
next prev parent reply other threads:[~2026-11-23 16:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 11:38 [PATCH v3 0/2] sched/cpufreq: fix schedutil's boost frequency handling Ananthu C V
2026-09-29 11:38 ` [PATCH v3 1/2] arch_topology: seed capacity_freq_ref with highest available frequency Ananthu C V
2026-10-11 14:16 ` Zhongqiu Han
2026-10-12 18:45 ` Dietmar Eggemann
2026-10-13 11:28 ` Zhongqiu Han
2026-11-11 12:10 ` Ananthu C V
2026-11-11 12:12 ` Ananthu C V
2026-09-29 11:38 ` [PATCH v3 2/2] cpufreq: fix policy max not returning to non-boost freq on boost disable Ananthu C V
2026-10-11 14:17 ` Zhongqiu Han
2026-11-11 12:21 ` Ananthu C V
2026-11-11 13:47 ` Zhongqiu Han
2026-10-11 23:42 ` Dietmar Eggemann
2026-11-11 12:27 ` Ananthu C V
2026-11-02 8:38 ` Viresh Kumar
2026-11-11 12:40 ` Ananthu C V
2026-11-17 10:34 ` Viresh Kumar
2026-11-18 12:29 ` Ananthu C V
2026-11-19 4:49 ` Viresh Kumar
2026-11-20 12:08 ` Pierre Gondois
2026-11-23 10:22 ` Ananthu C V
2026-11-23 16:31 ` Pierre Gondois [this message]
2026-09-30 9:10 ` [PATCH v3 0/2] sched/cpufreq: fix schedutil's boost frequency handling Oleg Keri
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=e78bdcde-9a06-47b9-afd7-e03ee10b395a@arm.com \
--to=pierre.gondois@arm.com \
--cc=ananthu.cv@oss.qualcomm.com \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=okerixx@gmail.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=zhanjie9@hisilicon.com \
/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