Re: [PATCH 1/1] cpufreq: Set policy->min and max as real QoS constraints
From: Pierre Gondois
Date: Thu Apr 30 2026 - 09:46:40 EST
Hello Sumit,
On 4/28/26 18:37, Sumit Gupta wrote:
Thanks!
On 23/04/26 14:17, Pierre Gondois wrote:
External email: Use caution opening links or attachments
cpufreq_set_policy() will ultimately override the policy min/max
values written in the .init() callback through:
cpufreq_policy_online()
\-cpufreq_init_policy()
\-cpufreq_set_policy()
\-/* Set policy->min/max */
Thus the policy min/max values provided are only temporary.
There is an exception if CPUFREQ_NEED_INITIAL_FREQ_CHECK is set and:
cpufreq_policy_online()
\-cpufreq_init_policy()
\-__cpufreq_driver_target()
\-cpufreq_driver->target()
is called. To avoid any regression, set policy->min/max in cpufreq.c
if the values were not initialized.
In this patch:
- Setting policy->min or max value in driver .init() cb is
interpreted as setting a QoS constraint.
- Remove policy->min/max initialization in drivers if the values
are similar to policy->cpuinfo.min_freq/max_freq.
The only drivers where these values are different are:
- gx-suspmod.c
- cppc-cpufreq.c
- longrun.c
- For the cppc-cpufreq driver, the lowest non-linear freq. is
used as a min QoS constraint as suggested at:
https://lore.kernel.org/lkml/20260213100633.15413-1-zhangpengjie2@xxxxxxxxxx/
Signed-off-by: Pierre Gondois <pierre.gondois@xxxxxxx>
Tested-by: Sumit Gupta <sumitg@xxxxxxxxxx>
Reviewed-by: Sumit Gupta <sumitg@xxxxxxxxxx>
There might be a v2 with some small modifications.