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: <Z1KZOeFtzqTeSZny@BLRRASHENOY1.amd.com>
Date: Fri, 6 Dec 2024 11:57:05 +0530
From: "Gautham R. Shenoy" <gautham.shenoy@....com>
To: Mario Limonciello <mario.limonciello@....com>
Cc: Perry Yuan <perry.yuan@....com>, linux-kernel@...r.kernel.org,
	linux-pm@...r.kernel.org,
	Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>
Subject: Re: [PATCH 06/15] cpufreq/amd-pstate: Use boost numerator for upper
 bound of frequencies

On Thu, Dec 05, 2024 at 04:28:38PM -0600, Mario Limonciello wrote:
> commit 18d9b5227121 ("cpufreq/amd-pstate: Use nominal perf for limits
> when boost is disabled") introduced different semantics for min/max limits
> based upon whether the user turned off boost from sysfs.
> 
> This however is not necessary when the highest perf value is the boost
> numerator.
> 
> Suggested-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>
> Fixes: 18d9b5227121 ("cpufreq/amd-pstate: Use nominal perf for limits when boost is disabled")
> Signed-off-by: Mario Limonciello <mario.limonciello@....com>
> ---
>  drivers/cpufreq/amd-pstate.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 738f63d70546f..14bd6faa3d730 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -601,16 +601,13 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
>  
>  static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)
>  {
> -	u32 max_limit_perf, min_limit_perf, lowest_perf, max_perf;
> +	u32 max_limit_perf, min_limit_perf, lowest_perf, max_perf, max_freq;
>  	struct amd_cpudata *cpudata = policy->driver_data;
>  
> -	if (cpudata->boost_supported && !policy->boost_enabled)
> -		max_perf = READ_ONCE(cpudata->nominal_perf);
> -	else
> -		max_perf = READ_ONCE(cpudata->highest_perf);
> -
> -	max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq);
> -	min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
> +	max_perf = READ_ONCE(cpudata->highest_perf);
> +	max_freq = READ_ONCE(cpudata->max_freq);
> +	max_limit_perf = div_u64(policy->max * max_perf, max_freq);
> +	min_limit_perf = div_u64(policy->min * max_perf, max_freq);

Looks good to me.

At some point in the future, we should consider using nominal_perf and
nominal_freq as the baseline for the freq-->perf and perf-->freq
conversions. That is invariant to boost being enabled or not.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@....com>

--
Thanks and Regards
gautham.




>  
>  	lowest_perf = READ_ONCE(cpudata->lowest_perf);
>  	if (min_limit_perf < lowest_perf)
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ