From: Christian Loehle <christian.loehle@arm.com>
To: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>,
rafael@kernel.org, viresh.kumar@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
zhongqiu.han@oss.qualcomm.com, ananthu.cv@oss.qualcomm.com,
pierre.gondois@arm.com, zhangpengjie2@huawei.com,
zhenglifeng1@huawei.com, zhanjie9@hisilicon.com
Subject: Re: [PATCH 2/2] cpufreq: Keep global boost enabled after partial enable
Date: Wed, 2 Dec 2026 16:35:10 +0000 [thread overview]
Message-ID: <ed98be50-38fd-4673-ac44-88acd8c61a19@arm.com> (raw)
In-Reply-To: <20261201023001.1131130-3-jiangtianfeng@linux.alibaba.com>
On 12/1/26 02:30, Jiangtian Feng wrote:
> When global boost is enabled from the disabled state, a failure after
> one or more policies have been updated successfully currently restores
> the global flag to 0 without rolling back those policies. This leaves
> them locally enabled, with their boost-related driver/QoS updates
> retained, while the global flag rejects per-policy sysfs writes.
>
> Keep the global flag enabled if at least one policy_set_boost() call
> succeeded, while preserving the existing error return path. Global
> boost = 1 grants permission to boost; it does not require every policy
> to have boost enabled. The mixed per-policy state is therefore valid
> and individual policies remain accessible through per-policy sysfs.
>
> Restore the previous global state on disable and when no policy was
> enabled successfully. After a partial enable, keep global boost enabled
> so users can repair individual policies through sysfs. Do not roll back
> earlier policy updates.
>
> Qoder, an AI coding assistant, helped analyze the issue, develop the fix
> and state matrix, and draft this description.
>
> Fixes: 218a06a79d9a ("cpufreq: Support per-policy performance boost")
> Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
> Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
> Signed-off-by: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
> ---
> drivers/cpufreq/cpufreq.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index e97838e40a54..d998ea0ed43c 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2887,6 +2887,7 @@ static int cpufreq_boost_trigger_state(int state)
> struct cpufreq_policy *policy;
> unsigned long flags;
> bool boost_enabled;
> + bool policy_success = false;
> int ret = 0;
>
> guard(mutex)(&cpufreq_boost_mutex);
> @@ -2911,6 +2912,8 @@ static int cpufreq_boost_trigger_state(int state)
> ret = policy_set_boost(policy, state);
> if (unlikely(ret))
> break;
> +
> + policy_success = true;
> }
>
> cpus_read_unlock();
> @@ -2918,9 +2921,12 @@ static int cpufreq_boost_trigger_state(int state)
> if (likely(!ret))
> return 0;
>
> - write_lock_irqsave(&cpufreq_driver_lock, flags);
> - cpufreq_driver->boost_enabled = boost_enabled;
> - write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> + /* On failure, restore old state unless partial enable needs local repair. */
> + if (!state || !policy_success) {
> + write_lock_irqsave(&cpufreq_driver_lock, flags);
> + cpufreq_driver->boost_enabled = boost_enabled;
> + write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> + }
>
> pr_err("%s: Cannot %s BOOST\n",
> __func__, str_enable_disable(state));
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
next prev parent reply other threads:[~2026-12-02 16:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 2:29 [PATCH v6 0/2] " Jiangtian Feng
2026-12-01 2:30 ` [PATCH 1/2] cpufreq: Allow global boost updates without active capable policies Jiangtian Feng
2026-12-02 16:34 ` Christian Loehle
2026-12-01 2:30 ` [PATCH 2/2] cpufreq: Keep global boost enabled after partial enable Jiangtian Feng
2026-12-02 16:35 ` Christian Loehle [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-30 11:13 [PATCH v5 0/2] " Jiangtian Feng
2026-11-30 11:13 ` [PATCH 2/2] " Jiangtian Feng
2026-11-30 13:51 ` Pengjie Zhang
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=ed98be50-38fd-4673-ac44-88acd8c61a19@arm.com \
--to=christian.loehle@arm.com \
--cc=ananthu.cv@oss.qualcomm.com \
--cc=jiangtianfeng@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pierre.gondois@arm.com \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=zhangpengjie2@huawei.com \
--cc=zhanjie9@hisilicon.com \
--cc=zhenglifeng1@huawei.com \
--cc=zhongqiu.han@oss.qualcomm.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®