diff mbox series

[v2] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail

Message ID 20250110091949.3610770-1-zhenglifeng1@huawei.com
State Superseded
Headers show
Series [v2] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail | expand

Commit Message

zhenglifeng (A) Jan. 10, 2025, 9:19 a.m. UTC
Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
boost state") sets per-policy boost flag to false when boost fail.
However, this boost flag will be set to reverse value in
store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
will cause the per-policy boost flag set to true when fail to set boost.
Remove the extra assignment in amd_pstate_set_boost() and keep all
operations on per-policy boost flag outside of set_boost() to fix this
problem.

Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
 drivers/cpufreq/amd-pstate.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Mario Limonciello Jan. 10, 2025, 3:51 p.m. UTC | #1
On 1/10/2025 03:19, Lifeng Zheng wrote:
> Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
> boost state") sets per-policy boost flag to false when boost fail.
> However, this boost flag will be set to reverse value in
> store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
> will cause the per-policy boost flag set to true when fail to set boost.
> Remove the extra assignment in amd_pstate_set_boost() and keep all
> operations on per-policy boost flag outside of set_boost() to fix this
> problem.
> 
> Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>

Thanks, looks good to me.  I've queued this up on my bleeding-edge 
branch for testing.  I'll include this in one of the future 6.14-rc pull 
requests with other fixes.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> ---
>   drivers/cpufreq/amd-pstate.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index d7b1de97727a..a2573393ce30 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -747,7 +747,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
>   	guard(mutex)(&amd_pstate_driver_lock);
>   
>   	ret = amd_pstate_cpu_boost_update(policy, state);
> -	policy->boost_enabled = !ret ? state : false;
>   	refresh_frequency_limits(policy);
>   
>   	return ret;
diff mbox series

Patch

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index d7b1de97727a..a2573393ce30 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -747,7 +747,6 @@  static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
 	guard(mutex)(&amd_pstate_driver_lock);
 
 	ret = amd_pstate_cpu_boost_update(policy, state);
-	policy->boost_enabled = !ret ? state : false;
 	refresh_frequency_limits(policy);
 
 	return ret;