From: "zhenglifeng (A)" <zhenglifeng1@huawei.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Nicholas Chin <nic.c3.14@gmail.com>,
<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
<rafael.j.wysocki@intel.com>, <vincent.guittot@linaro.org>
Subject: Re: [PATCH] cpufreq: acpi: Don't enable boost on policy exit
Date: Tue, 22 Apr 2025 20:05:39 +0800 [thread overview]
Message-ID: <6f0ae81a-78a1-4584-b2dd-2f88aff598ef@huawei.com> (raw)
In-Reply-To: <20250422094128.wlmr7u4qitwxiniz@vireshk-i7>
On 2025/4/22 17:41, Viresh Kumar wrote:
> On 21-04-25, 21:36, zhenglifeng (A) wrote:
>> On 2025/4/21 19:37, Viresh Kumar wrote:
>>> +static int policy_set_boost(struct cpufreq_policy *policy, bool enable, bool forced)
>>> +{
>>> + if (!forced && (policy->boost_enabled == enable))
>>> + return 0;
>>> +
>>> + policy->boost_enabled = enable;
>>> +
>>> + ret = cpufreq_driver->set_boost(policy, enable);
>>> + if (ret)
>>> + policy->boost_enabled = !policy->boost_enabled;
>>
>> This may cause boost_enabled becomes false but actually boosted when forced
>> is true and trying to set boost_enabled from true to true.
>
> Can't do much in case of failure. And this is the current behavior
> anyway. This was just some code cleanup, doesn't change the behavior
> of the code.
If forced is true, this may change the behavior. But I see you gave up this
parameter in new version, so I think it's OK now.
>
>>> static struct freq_attr local_boost = __ATTR(boost, 0644, show_local_boost, store_local_boost);
>>> @@ -1617,16 +1624,17 @@ static int cpufreq_online(unsigned int cpu)
>>> if (new_policy && cpufreq_thermal_control_enabled(cpufreq_driver))
>>> policy->cdev = of_cpufreq_cooling_register(policy);
>>>
>>> - /* Let the per-policy boost flag mirror the cpufreq_driver boost during init */
>>> + /*
>>> + * Let the per-policy boost flag mirror the cpufreq_driver boost during
>>> + * initialization for a new policy. For an existing policy, maintain the
>>> + * previous boost value unless global boost is disabled now.
>>> + */
>>> if (cpufreq_driver->set_boost && policy->boost_supported &&
>>> - policy->boost_enabled != cpufreq_boost_enabled()) {
>>> - policy->boost_enabled = cpufreq_boost_enabled();
>>> - ret = cpufreq_driver->set_boost(policy, policy->boost_enabled);
>>> + (new_policy || !cpufreq_boost_enabled())) {
>>> + ret = policy_set_boost(policy, cpufreq_boost_enabled(), false);
>>
>> I think forced here should be true. If new_policy and
>> !cpufreq_boost_enabled() but the cpu is actually boosted by some other
>> reason (like what we met in acpi-cpufreq), set_boost() should be forcibly
>> executed to make the cpu unboost.
>
> The problem is that setting boost may be time consuming for some
> platforms and we may not want to do that unnecessarily. ACPI cpufreq
> should be fixed separately for that.
Makes sense.
>
> I am sending a series now to fix them all, please review that.
>
next prev parent reply other threads:[~2025-04-22 12:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 5:29 Viresh Kumar
2025-04-16 8:47 ` zhenglifeng (A)
2025-04-16 12:38 ` Rafael J. Wysocki
2025-04-17 1:54 ` Nicholas Chin
2025-04-17 5:02 ` Viresh Kumar
2025-04-17 5:09 ` Viresh Kumar
2025-04-17 12:39 ` Rafael J. Wysocki
2025-04-17 15:53 ` Rafael J. Wysocki
2025-04-18 5:58 ` Viresh Kumar
2025-04-18 17:06 ` Nicholas Chin
2025-04-18 19:28 ` Rafael J. Wysocki
2025-04-19 7:54 ` Viresh Kumar
2025-04-19 9:35 ` zhenglifeng (A)
2025-04-21 6:20 ` Viresh Kumar
2025-04-21 7:45 ` zhenglifeng (A)
2025-04-21 11:37 ` Viresh Kumar
2025-04-21 13:36 ` zhenglifeng (A)
2025-04-22 9:41 ` Viresh Kumar
2025-04-22 12:05 ` zhenglifeng (A) [this message]
2025-04-17 12:36 ` Rafael J. Wysocki
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=6f0ae81a-78a1-4584-b2dd-2f88aff598ef@huawei.com \
--to=zhenglifeng1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nic.c3.14@gmail.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=vincent.guittot@linaro.org \
--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®