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]
Date: Tue, 20 Feb 2024 07:23:09 +0000
From: "Meng, Li (Jassmine)" <Li.Meng@....com>
To: Lucas Lee Jing Yi <lucasleeeeeeeee@...il.com>, "rafael@...nel.org"
	<rafael@...nel.org>
CC: "Yuan, Perry" <Perry.Yuan@....com>, "Du, Xiaojian" <Xiaojian.Du@....com>,
	"Deucher, Alexander" <Alexander.Deucher@....com>, "bp@...en8.de"
	<bp@...en8.de>, "Sharma, Deepak" <Deepak.Sharma@....com>,
	"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>, "Limonciello, Mario"
	<Mario.Limonciello@....com>, "Fontenot, Nathan" <Nathan.Fontenot@....com>,
	"oleksandr@...alenko.name" <oleksandr@...alenko.name>,
	"rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>, "Huang, Ray"
	<Ray.Huang@....com>, "Huang, Shimmer" <Shimmer.Huang@....com>,
	"skhan@...uxfoundation.org" <skhan@...uxfoundation.org>,
	"viresh.kumar@...aro.org" <viresh.kumar@...aro.org>, "x86@...nel.org"
	<x86@...nel.org>
Subject: RE: [PATCH] [PATCH] amd_pstate: fix erroneous highest_perf value on
 some CPUs

[AMD Official Use Only - General]

Hi Lucas:

> -----Original Message-----
> From: Lucas Lee Jing Yi <lucasleeeeeeeee@...il.com>
> Sent: Monday, February 19, 2024 12:11 AM
> To: rafael@...nel.org
> Cc: Yuan, Perry <Perry.Yuan@....com>; Du, Xiaojian
> <Xiaojian.Du@....com>; Deucher, Alexander
> <Alexander.Deucher@....com>; bp@...en8.de; Sharma, Deepak
> <Deepak.Sharma@....com>; Meng, Li (Jassmine) <Li.Meng@....com>;
> linux-acpi@...r.kernel.org; linux-kernel@...r.kernel.org; linux-
> kselftest@...r.kernel.org; linux-pm@...r.kernel.org; Limonciello, Mario
> <Mario.Limonciello@....com>; Fontenot, Nathan
> <Nathan.Fontenot@....com>; oleksandr@...alenko.name;
> rafael.j.wysocki@...el.com; Huang, Ray <Ray.Huang@....com>; Huang,
> Shimmer <Shimmer.Huang@....com>; skhan@...uxfoundation.org;
> viresh.kumar@...aro.org; x86@...nel.org; Lucas Lee Jing Yi
> <lucasleeeeeeeee@...il.com>
> Subject: [PATCH] [PATCH] amd_pstate: fix erroneous highest_perf value on
> some CPUs
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> On a Ryzen 7840HS the highest_perf value is 196, not 166 as AMD assumed.
> This leads to the advertised max clock speed to only be 4.35ghz instead of
> 5.14ghz , leading to a large degradation in performance.
>
> Fix the broken assumption and revert back to the old logic for getting
> highest_perf.
>
> TEST:
> Geekbench 6 Before Patch:
> Single Core:    2325 (-22%)!
> Multi Core:     11335 (-10%)
>
> Geekbench 6 AFTER Patch:
> Single Core:    2635
> Multi Core:     12487
>
> Signed-off-by: Lucas Lee Jing Yi <lucasleeeeeeeee@...il.com>
> ---
>  drivers/cpufreq/amd-pstate.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 08e112444c27..54df68773620 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -50,7 +50,6 @@
>
>  #define AMD_PSTATE_TRANSITION_LATENCY  20000
>  #define AMD_PSTATE_TRANSITION_DELAY    1000
> -#define AMD_PSTATE_PREFCORE_THRESHOLD  166
>
>  /*
>   * TODO: We need more time to fine tune processors with shared memory
> solution @@ -299,15 +298,12 @@ static int pstate_init_perf(struct
> amd_cpudata *cpudata)
>                                      &cap1);
>         if (ret)
>                 return ret;
> -
> -       /* For platforms that do not support the preferred core feature, the
> -        * highest_pef may be configured with 166 or 255, to avoid max
> frequency
> -        * calculated wrongly. we take the AMD_CPPC_HIGHEST_PERF(cap1)
> value as
> -        * the default max perf.
> +
> +       /* Some CPUs have different highest_perf from others, it is safer
> +        * to read it than to assume some erroneous value, leading to
> performance issues.
>          */
> -       if (cpudata->hw_prefcore)
> -               highest_perf = AMD_PSTATE_PREFCORE_THRESHOLD;
> -       else
> +       highest_perf = amd_get_highest_perf();
> +       if(highest_perf > AMD_CPPC_HIGHEST_PERF(cap1))
>                 highest_perf = AMD_CPPC_HIGHEST_PERF(cap1);
>
>         WRITE_ONCE(cpudata->highest_perf, highest_perf); @@ -329,9 +325,11
> @@ static int cppc_init_perf(struct amd_cpudata *cpudata)
>         if (ret)
>                 return ret;
>
> -       if (cpudata->hw_prefcore)
> -               highest_perf = AMD_PSTATE_PREFCORE_THRESHOLD;
> -       else
> +       /* Some CPUs have different highest_perf from others, it is safer
> +        * to read it than to assume some erroneous value, leading to
> performance issues.
> +        */
> +       highest_perf = amd_get_highest_perf();
> +       if(highest_perf > cppc_perf.highest_perf)
>                 highest_perf = cppc_perf.highest_perf;
>
>         WRITE_ONCE(cpudata->highest_perf, highest_perf);
> --
> 2.43.2
[Meng, Li (Jassmine)]
Reviewed-by: Li Meng < li.meng@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ