diff mbox series

[05/15] cpufreq: amd: Set policy->boost_supported

Message ID e16c06d4b8ffdb20e802ffe648f14dc515e60426.1737707712.git.viresh.kumar@linaro.org (mailing list archive)
State New
Delegated to: viresh kumar
Headers show
Series cpufreq: simplify boost handling | expand

Commit Message

Viresh Kumar Jan. 24, 2025, 8:58 a.m. UTC
With a later commit, the cpufreq core will call the ->set_boost()
callback only if the policy supports boost frequency. The
boost_supported flag is set by the cpufreq core if policy->freq_table is
set and one or more boost frequencies are present.

For other drivers, the flag must be set explicitly.

The policy->boost_enabled flag is set by the cpufreq core once the
policy is initialized, don't set it anymore.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/amd-pstate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dhananjay Ugwekar Jan. 30, 2025, 9:15 a.m. UTC | #1
Hello Viresh,

On 1/24/2025 2:28 PM, Viresh Kumar wrote:
> With a later commit, the cpufreq core will call the ->set_boost()
> callback only if the policy supports boost frequency. The
> boost_supported flag is set by the cpufreq core if policy->freq_table is
> set and one or more boost frequencies are present.
> 
> For other drivers, the flag must be set explicitly.
> 
> The policy->boost_enabled flag is set by the cpufreq core once the
> policy is initialized, don't set it anymore.

This patch uncovers a bug in the amd_pstate mode switch path (e.g when 
we do "echo passive > /sys/devices/system/cpu/amd_pstate/status"). 
I have posted a fix for it at 
https://lore.kernel.org/all/20250130085251.155146-1-dhananjay.ugwekar@amd.com/T/#u

Can we try to merge this fix before your patch?, so we fix the bug 
before it is uncovered. Currently, the fix is based on top of superm1/bleeding-edge 
(amd-pstate maintainer's dev tree). It wont apply cleanly on your tree i.e. 
vireshk/pm/cpufreq/boost. I can rebase it on your tree and repost, if needed.

Thanks,
Dhananjay

> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/cpufreq/amd-pstate.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index d7630bab2516..8d3cc494c92c 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -995,7 +995,7 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
>  	policy->cpuinfo.min_freq = min_freq;
>  	policy->cpuinfo.max_freq = max_freq;
>  
> -	policy->boost_enabled = READ_ONCE(cpudata->boost_supported);
> +	policy->boost_supported = READ_ONCE(cpudata->boost_supported);
>  
>  	/* It will be updated by governor */
>  	policy->cur = policy->cpuinfo.min_freq;
> @@ -1480,7 +1480,7 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
>  	policy->min = policy->cpuinfo.min_freq;
>  	policy->max = policy->cpuinfo.max_freq;
>  
> -	policy->boost_enabled = READ_ONCE(cpudata->boost_supported);
> +	policy->boost_supported = READ_ONCE(cpudata->boost_supported);
>  
>  	/*
>  	 * Set the policy to provide a valid fallback value in case
diff mbox series

Patch

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index d7630bab2516..8d3cc494c92c 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -995,7 +995,7 @@  static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
 	policy->cpuinfo.min_freq = min_freq;
 	policy->cpuinfo.max_freq = max_freq;
 
-	policy->boost_enabled = READ_ONCE(cpudata->boost_supported);
+	policy->boost_supported = READ_ONCE(cpudata->boost_supported);
 
 	/* It will be updated by governor */
 	policy->cur = policy->cpuinfo.min_freq;
@@ -1480,7 +1480,7 @@  static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
 	policy->min = policy->cpuinfo.min_freq;
 	policy->max = policy->cpuinfo.max_freq;
 
-	policy->boost_enabled = READ_ONCE(cpudata->boost_supported);
+	policy->boost_supported = READ_ONCE(cpudata->boost_supported);
 
 	/*
 	 * Set the policy to provide a valid fallback value in case