mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
To: Ananthu C V <ananthu.cv@oss.qualcomm.com>
Cc: 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>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Jie Zhan <zhanjie9@hisilicon.com>,
	Pierre Gondois <pierre.gondois@arm.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>,
	Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Subject: Re: [PATCH v3 2/2] cpufreq: fix policy max not returning to non-boost freq on boost disable
Date: Wed, 11 Nov 2026 21:47:01 +0800	[thread overview]
Message-ID: <18db783d-afef-4cd7-8192-00f1970da7ae@oss.qualcomm.com> (raw)
In-Reply-To: <avRd3YVDXs26hrow@hu-anancv-blr.qualcomm.com>

On 11/11/2026 8:21 PM, Ananthu C V wrote:
> Hi Zhongqiu,
> 
> On Sun, Oct 11, 2026 at 10:17:14PM +0800, Zhongqiu Han wrote:
>> Patch 2/2 currently depends on a helper introduced by patch 1/2, which
>> prevents it from being backported independently. Since 2/2 is an
>> independent fix that should be backported to stable on its own, I think
>> it should be placed before patch 1/2 in the series and kept self
>> contained.
> 
> The idea was that currently patch 2/2 would serve no actual value without the
> fix in patch 1/2, and that is why it was the second one. But yes, we cannot
> fix 1/2 and leave 2/2 as is, which would turn the current benign issue to an
> actual problem, so the order should be probably reversed. I'll work on that.
> 

As I mentioned before, patch 2/2 addresses a separate issue that should
be fixed in its own right and backported to stable kernels, because with
policy->max stuck at the boost ceiling, scaling_max_freq keeps reporting
the boost frequency after boost is disabled (as shown in the cover
letter), and governors such as performance can still select boost
frequencies. Anyway, please go ahead.


>> To avoid introducing a new member that is only used by frequency-table
>> drivers, please consider the following implementation instead:
>>
>> If there are boost entries in the frequency table, the table is the only
>> source of cpuinfo.max_freq, so let cpufreq_frequency_table_cpuinfo() set
>> it unconditionally in that case.
>>
>>
>> diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
>> index ea99464..8c8bad2 100644
>> --- a/drivers/cpufreq/freq_table.c
>> +++ b/drivers/cpufreq/freq_table.c
>> @@ -33,14 +33,17 @@ int cpufreq_frequency_table_cpuinfo(struct
>> cpufreq_policy *policy)
>>   	struct cpufreq_frequency_table *pos, *table = policy->freq_table;
>>   	unsigned int min_freq = ~0;
>>   	unsigned int max_freq = 0;
>> +	bool has_boost = false;
>>   	unsigned int freq, i;
>>
>>   	cpufreq_for_each_valid_entry_idx(pos, table, i) {
>>   		freq = pos->frequency;
>>
>> -		if ((!cpufreq_boost_enabled() || !policy->boost_enabled)
>> -		    && (pos->flags & CPUFREQ_BOOST_FREQ))
>> -			continue;
>> +		if (pos->flags & CPUFREQ_BOOST_FREQ) {
>> +			has_boost = true;
>> +			if (!cpufreq_boost_enabled() || !policy->boost_enabled)
>> +				continue;
>> +		}
>>
>>   		pr_debug("table entry %u: %u kHz\n", i, freq);
>>   		if (freq < min_freq)
>> @@ -50,17 +53,20 @@ int cpufreq_frequency_table_cpuinfo(struct
>> cpufreq_policy *policy)
>>   	}
>>
>>   	policy->cpuinfo.min_freq = min_freq;
>> +
>> +	if (min_freq == ~0)
>> +		return -EINVAL;
>> +
>>   	/*
>>   	 * If the driver has set its own cpuinfo.max_freq above max_freq, leave
>> -	 * it as is.
>> +	 * it as is.  This does not apply to tables with boost entries, because
>> +	 * the table is the only source of cpuinfo.max_freq then and it needs
>> +	 * to go down again when boost is disabled.
>>   	 */
>> -	if (policy->cpuinfo.max_freq < max_freq)
>> +	if (has_boost || policy->cpuinfo.max_freq < max_freq)
>>   		policy->cpuinfo.max_freq = max_freq;
>>
>> -	if (min_freq == ~0)
>> -		return -EINVAL;
>> -	else
>> -		return 0;
>> +	return 0;
>>   }
>>
>>   int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy)
>>
>>
>>>    	/* in 10^(-9) s = nanoseconds */
>>>    	unsigned int		transition_latency;
>>> @@ -791,6 +792,8 @@ struct cpufreq_frequency_table {
>>>    int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy);
>>> +bool policy_has_boost_freq(struct cpufreq_policy *policy);
>>> +
>>>    int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy);
>>>    int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy);
> 
> I wanted more discussion on this part regarding finer implementation details
> and hence went with a working version, and I think I asked in the last revision
> thread regarding what are people's thoughts on this added field. I am also not
> keen on adding more fields, so this is useful suggestion. If we are to continue
> this implementation route, I'll keep this in mind, thanks.
> 
>> Thx and BRs,
>> Zhongqiu Han
> 
> Best,
> Ananthu


-- 
Thx and BRs,
Zhongqiu Han

  reply	other threads:[~2026-11-11 13:47 UTC|newest]

Thread overview: 16+ 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 [this message]
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-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=18db783d-afef-4cd7-8192-00f1970da7ae@oss.qualcomm.com \
    --to=zhongqiu.han@oss.qualcomm.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=pierre.gondois@arm.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

all inboxes | Powered by JetHome®