lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZWAlXl6MP20khEwB@BLR-5CG13462PL.amd.com>
Date:   Fri, 24 Nov 2023 09:53:58 +0530
From:   Wyes Karny <wyes.karny@....com>
To:     "Gautham R. Shenoy" <gautham.shenoy@....com>
Cc:     Huang Rui <ray.huang@....com>,
        Mario Limonciello <mario.limonciello@....com>,
        Perry Yuan <Perry.Yuan@....com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq/amd-pstate: Fix the return value of
 amd_pstate_fast_switch()

On 23 Nov 13:57, Gautham R. Shenoy wrote:
> cpufreq_driver->fast_switch() callback expects a frequency as a return
> value. amd_pstate_fast_switch() was returning the return value of
> amd_pstate_update_freq(), which only indicates a success or failure.
> 
> Fix this by making amd_pstate_fast_switch() return the target_freq
> when the call to amd_pstate_update_freq() is successful, and return
> the current frequency from policy->cur when the call to
> amd_pstate_update_freq() is unsuccessful.
> 
> Fixes: 4badf2eb1e98 ("cpufreq: amd-pstate: Add ->fast_switch() callback")

Reviewed-by: Wyes Karny <wyes.karny@....com>

> Signed-off-by: Gautham R. Shenoy <gautham.shenoy@....com>
> ---
>  drivers/cpufreq/amd-pstate.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 9a1e194d5cf8..300f81d36291 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -518,7 +518,9 @@ static int amd_pstate_target(struct cpufreq_policy *policy,
>  static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy,
>  				  unsigned int target_freq)
>  {
> -	return amd_pstate_update_freq(policy, target_freq, true);
> +	if (!amd_pstate_update_freq(policy, target_freq, true))
> +		return target_freq;
> +	return policy->cur;
>  }
>  
>  static void amd_pstate_adjust_perf(unsigned int cpu,
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ