[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251202190904.27c9bc06@pumpkin>
Date: Tue, 2 Dec 2025 19:09:04 +0000
From: David Laight <david.laight.linux@...il.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Viresh Kumar
<viresh.kumar@...aro.org>, Thomas Renninger <trenn@...e.de>, Borislav
Petkov <bp@...e.de>, Jacob Shin <jacob.shin@....com>,
stable@...r.kernel.org, "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: amd_freq_sensitivity: Fix sensitivity clamping
in amd_powersave_bias_target
On Tue, 2 Dec 2025 13:44:28 +0100
Thorsten Blum <thorsten.blum@...ux.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@...r.kernel.org
> Fixes: 9c5320c8ea8b ("cpufreq: AMD "frequency sensitivity feedback" powersave bias for ondemand governor")
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.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) {
Powered by blists - more mailing lists