mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>, gautham.shenoy@amd.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpufreq/amd-pstate: Fix min_limit perf and freq updation for performance governor
Date: Mon, 7 Apr 2025 08:25:18 -0500	[thread overview]
Message-ID: <2489c84a-580b-4cc3-acf0-110b5d1309d2@amd.com> (raw)
In-Reply-To: <20250407081925.850473-1-dhananjay.ugwekar@amd.com>

On 4/7/2025 3:19 AM, Dhananjay Ugwekar wrote:
> The min_limit perf and freq values can get disconnected with performance
> governor, as we only modify the perf value in the special case. Fix that
> by modifying the perf and freq values together
> 
> Fixes: 009d1c29a451 ("cpufreq/amd-pstate: Move perf values into a union")
> Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>

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

Thanks!  I'll get this added to bleeding-edge and move it to fixes in a 
few days.

> ---
>   drivers/cpufreq/amd-pstate.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 024d33d5e367..76aa4a3698c3 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -607,13 +607,16 @@ static void amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)
>   	union perf_cached perf = READ_ONCE(cpudata->perf);
>   
>   	perf.max_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->max);
> -	perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min);
> +	WRITE_ONCE(cpudata->max_limit_freq, policy->max);
>   
> -	if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
> +	if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {
>   		perf.min_limit_perf = min(perf.nominal_perf, perf.max_limit_perf);
> +		WRITE_ONCE(cpudata->min_limit_freq, min(cpudata->nominal_freq, cpudata->max_limit_freq));
> +	} else {
> +		perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min);
> +		WRITE_ONCE(cpudata->min_limit_freq, policy->min);
> +	}
>   
> -	WRITE_ONCE(cpudata->max_limit_freq, policy->max);
> -	WRITE_ONCE(cpudata->min_limit_freq, policy->min);
>   	WRITE_ONCE(cpudata->perf, perf);
>   }
>   


      reply	other threads:[~2025-04-07 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07  8:19 Dhananjay Ugwekar
2025-04-07 13:25 ` Mario Limonciello [this message]

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=2489c84a-580b-4cc3-acf0-110b5d1309d2@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=dhananjay.ugwekar@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    /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®