linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 2/6] cpufreq: acpi: Re-sync CPU boost state on system resume
Date: Tue, 22 Apr 2025 20:57:22 -0600	[thread overview]
Message-ID: <1b914523-5b26-4fc0-b5c5-4b2f90ffaa3d@gmail.com> (raw)
In-Reply-To: <d8651db6d8687a0e37d527267ebfec05f209b1b7.1745315548.git.viresh.kumar@linaro.org>

On 2025-04-22 03:53, Viresh Kumar wrote:
> During suspend/resume cycles, platform firmware may alter the CPU boost
> state.
> 
> If boost is disabled before suspend, it correctly remains off after
> resume. However, if firmware re-enables boost during suspend, the system
> may resume with boost frequencies enabled—even when the boost flag was
> originally disabled. This violates expected behavior.
> 
> Ensure the boost state is re-synchronized with the kernel policy during
> system resume to maintain consistency.
> 
> 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>
> ---
>  drivers/cpufreq/acpi-cpufreq.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 7002e8de8098..0ffabf740ff5 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -893,8 +893,19 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	if (perf->states[0].core_frequency * 1000 != freq_table[0].frequency)
>  		pr_warn(FW_WARN "P-state 0 is not max freq\n");
>  
> -	if (acpi_cpufreq_driver.set_boost)
> -		policy->boost_supported = true;
> +	if (acpi_cpufreq_driver.set_boost) {
> +		if (policy->boost_supported) {
> +			/*
> +			 * The firmware may have altered boost state while the
> +			 * CPU was offline (for example during a suspend-resume
> +			 * cycle).
> +			 */
> +			if (policy->boost_enabled != boost_state(cpu))
> +				set_boost(policy, policy->boost_enabled);
> +		} else {
> +			policy->boost_supported = true;
> +		}
> +	}
>  
>  	return result;
>  

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>


  reply	other threads:[~2025-04-23  2:57 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
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 [this message]
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=1b914523-5b26-4fc0-b5c5-4b2f90ffaa3d@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;
as well as URLs for NNTP newsgroup(s).