From: Nicholas Chin <nic.c3.14@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Lifeng Zheng <zhenglifeng1@huawei.com>
Cc: linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] cpufreq: acpi: Don't enable boost on policy exit
Date: Tue, 22 Apr 2025 20:56:52 -0600 [thread overview]
Message-ID: <57625894-6c7e-4bb9-9518-96a62b25f29b@gmail.com> (raw)
In-Reply-To: <7ce4ffb166beef83cf1bd703a41bf91622011585.1745315548.git.viresh.kumar@linaro.org>
On 2025-04-22 03:53, Viresh Kumar wrote:
> The boost-related code in cpufreq has undergone several changes over the
> years, but this particular piece remained unchanged and is now outdated.
>
> The cpufreq core currently manages boost settings during initialization,
> and only when necessary. As such, there's no longer a need to enable
> boost explicitly when entering system suspend.
>
> Previously, this wasn’t causing issues because boost settings were
> force-updated during policy initialization. However, commit 2b16c631832d
> ("cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_init()") changed
> that behavior—correctly—by avoiding unnecessary updates.
>
> As a result of this change, if boost was disabled prior to suspend, it
> remains disabled on resume as expected. But due to the current code
> forcibly enabling boost at suspend time, the system ends up with boost
> frequencies enabled after resume, even if the global boost flag was
> disabled. This contradicts the intended behavior.
>
> Don't enable boost on policy exit.
>
> Fixes: 2b16c631832d ("cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_init()")
> Reported-by: Nicholas Chin <nic.c3.14@gmail.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220013
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> This was sent separately earlier. No changes from that.
>
> drivers/cpufreq/acpi-cpufreq.c | 23 +++--------------------
> 1 file changed, 3 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 924314cdeebc..7002e8de8098 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -89,8 +89,9 @@ static bool boost_state(unsigned int cpu)
> return false;
> }
>
> -static int boost_set_msr(bool enable)
> +static void boost_set_msr_each(void *p_en)
> {
> + bool enable = (bool)p_en;
> u32 msr_addr;
> u64 msr_mask, val;
>
> @@ -107,7 +108,7 @@ static int boost_set_msr(bool enable)
> msr_mask = MSR_K7_HWCR_CPB_DIS;
> break;
> default:
> - return -EINVAL;
> + return;
> }
>
> rdmsrl(msr_addr, val);
> @@ -118,14 +119,6 @@ static int boost_set_msr(bool enable)
> val |= msr_mask;
>
> wrmsrl(msr_addr, val);
> - return 0;
> -}
> -
> -static void boost_set_msr_each(void *p_en)
> -{
> - bool enable = (bool) p_en;
> -
> - boost_set_msr(enable);
> }
>
> static int set_boost(struct cpufreq_policy *policy, int val)
> @@ -532,15 +525,6 @@ static void free_acpi_perf_data(void)
> free_percpu(acpi_perf_data);
> }
>
> -static int cpufreq_boost_down_prep(unsigned int cpu)
> -{
> - /*
> - * Clear the boost-disable bit on the CPU_DOWN path so that
> - * this cpu cannot block the remaining ones from boosting.
> - */
> - return boost_set_msr(1);
> -}
> -
> /*
> * acpi_cpufreq_early_init - initialize ACPI P-States library
> *
> @@ -931,7 +915,6 @@ static void acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
>
> pr_debug("%s\n", __func__);
>
> - cpufreq_boost_down_prep(policy->cpu);
> policy->fast_switch_possible = false;
> policy->driver_data = NULL;
> acpi_processor_unregister_performance(data->acpi_perf_cpu);
The first two patches in this series appear to work as intended. The boost state (both enabled and disabled) persists across a resume from S3 suspend.
Tested-by: Nicholas Chin <nic.c3.14@gmail.com>
next prev parent reply other threads:[~2025-04-23 2:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 9:53 [PATCH 0/6] cpufreq: Boost related cleanups / fixes Viresh Kumar
2025-04-22 9:53 ` [PATCH 1/6] cpufreq: acpi: Don't enable boost on policy exit Viresh Kumar
2025-04-23 2:56 ` Nicholas Chin [this message]
2025-04-23 14:14 ` Rafael J. Wysocki
2025-04-24 7:15 ` Viresh Kumar
2025-04-24 11:26 ` Rafael J. Wysocki
2025-04-24 13:15 ` zhenglifeng (A)
2025-04-24 15:50 ` Viresh Kumar
2025-04-22 9:53 ` [PATCH 2/6] cpufreq: acpi: Re-sync CPU boost state on system resume Viresh Kumar
2025-04-23 2:57 ` Nicholas Chin
2025-04-23 14:26 ` Rafael J. Wysocki
2025-04-23 14:40 ` Rafael J. Wysocki
2025-04-23 14:59 ` Rafael J. Wysocki
2025-04-24 7:27 ` Viresh Kumar
2025-04-24 11:27 ` Rafael J. Wysocki
2025-04-22 9:53 ` [PATCH 3/6] cpufreq: Don't unnecessarily call set_boost() Viresh Kumar
2025-04-22 9:53 ` [PATCH 4/6] cpufreq: Introduce policy_set_boost() Viresh Kumar
2025-04-22 9:53 ` [PATCH 5/6] cpufreq: Preserve policy's boost state after resume Viresh Kumar
2025-04-22 9:53 ` [PATCH 6/6] cpufreq: Force sync policy boost with global boost on sysfs update Viresh Kumar
2025-04-22 12:33 ` [PATCH 0/6] cpufreq: Boost related cleanups / fixes zhenglifeng (A)
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=57625894-6c7e-4bb9-9518-96a62b25f29b@gmail.com \
--to=nic.c3.14@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=zhenglifeng1@huawei.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®