linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Thomas Renninger <trenn@suse.de>, Borislav Petkov <bp@suse.de>,
	Jacob Shin <jacob.shin@amd.com>,
	stable@vger.kernel.org,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpufreq: amd_freq_sensitivity: Fix sensitivity clamping in amd_powersave_bias_target
Date: Tue, 2 Dec 2025 19:09:04 +0000	[thread overview]
Message-ID: <20251202190904.27c9bc06@pumpkin> (raw)
In-Reply-To: <20251202124427.418165-2-thorsten.blum@linux.dev>

On Tue,  2 Dec 2025 13:44:28 +0100
Thorsten Blum <thorsten.blum@linux.dev> wrote:

> The local variable 'sensitivity' was never clamped to 0 or
> POWERSAVE_BIAS_MAX because the return value of clamp() was not used. Fix
> this by assigning the clamped value back to 'sensitivity'.

This actually makes no difference
(assuming od_tuners->powersave_bias <= POWERSAVE_BIAS_MAX).
The only use of 'sensitivity' is the test at the end of the diff.

So I think you could just delete the line.

	David
 
> 
> Cc: stable@vger.kernel.org
> Fixes: 9c5320c8ea8b ("cpufreq: AMD "frequency sensitivity feedback" powersave bias for ondemand governor")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/cpufreq/amd_freq_sensitivity.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/amd_freq_sensitivity.c b/drivers/cpufreq/amd_freq_sensitivity.c
> index 13fed4b9e02b..713ccf24c97d 100644
> --- a/drivers/cpufreq/amd_freq_sensitivity.c
> +++ b/drivers/cpufreq/amd_freq_sensitivity.c
> @@ -76,7 +76,7 @@ static unsigned int amd_powersave_bias_target(struct cpufreq_policy *policy,
>  	sensitivity = POWERSAVE_BIAS_MAX -
>  		(POWERSAVE_BIAS_MAX * (d_reference - d_actual) / d_reference);
>  
> -	clamp(sensitivity, 0, POWERSAVE_BIAS_MAX);
> +	sensitivity = clamp(sensitivity, 0, POWERSAVE_BIAS_MAX);
>  
>  	/* this workload is not CPU bound, so choose a lower freq */
>  	if (sensitivity < od_tuners->powersave_bias) {


  reply	other threads:[~2025-12-02 19:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 12:44 [PATCH] cpufreq: amd_freq_sensitivity: Fix sensitivity clamping in amd_powersave_bias_target Thorsten Blum
2025-12-02 19:09 ` David Laight [this message]
2025-12-19 15:55   ` Thorsten Blum
2025-12-23 13:23     ` Thorsten Blum

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=20251202190904.27c9bc06@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=bp@suse.de \
    --cc=jacob.shin@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thorsten.blum@linux.dev \
    --cc=trenn@suse.de \
    --cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).