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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <DM4PR12MB5136B5BA5DEE9BE7A27F44B9F18F2@DM4PR12MB5136.namprd12.prod.outlook.com>
Date: Thu, 22 Aug 2024 04:25:49 +0000
From: "Du, Xiaojian" <Xiaojian.Du@....com>
To: David Wang <00107082@....com>
CC: "rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>, "Limonciello,
 Mario" <Mario.Limonciello@....com>, "viresh.kumar@...aro.org"
	<viresh.kumar@...aro.org>, "Huang, Ray" <Ray.Huang@....com>, "Shenoy, Gautham
 Ranjal" <gautham.shenoy@....com>, "Petkov, Borislav"
	<Borislav.Petkov@....com>, "Huang, Shimmer" <Shimmer.Huang@....com>, "Meng,
 Li (Jassmine)" <Li.Meng@....com>, "linux-pm@...r.kernel.org"
	<linux-pm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "Yuan, Perry" <Perry.Yuan@....com>
Subject:
 回复: [PATCH RESENT] cpufreq: amd-pstate: add quirk for Ryzen 3000 series processor

[AMD Official Use Only - AMD Internal Distribution Only]

Hi David,

I built one test combination: B550 motherboard+ R9-3900X CPU+ 6.10-rc4 kernel.
On my test machine, amd-pstate driver passive/active mode works after enabling CPPC in BIOS, no code change in amd-pstate.
My BIOS is updated on 2023 Aug. But no matter CPPC is enabled or not in BIOS, "lscpu" won't show CPPC flag on R9-3900X CPU.
Any chance to update your BIOS first?
Noticed your motherboard is "MSI B450M MORTAR MAX", the latest three versions of BIOS are released in 2024 Aug. 21st/2024 Aug. 9th/2023 Oct. 26th.
https://www.msi.cn/Motherboard/B450M-MORTAR-MAX/support

If this issue is fixed in BIOS, no need to modify the upstream kernel code, right?

Thanks,
Xiaojian

-----邮件原件-----
发件人: Du, Xiaojian
发送时间: 2024年8月16日 16:00
收件人: David Wang <00107082@....com>; Yuan, Perry <Perry.Yuan@....com>
抄送: rafael.j.wysocki@...el.com; Limonciello, Mario <Mario.Limonciello@....com>; viresh.kumar@...aro.org; Huang, Ray <Ray.Huang@....com>; Shenoy, Gautham Ranjal <gautham.shenoy@....com>; Petkov, Borislav <Borislav.Petkov@....com>; Huang, Shimmer <Shimmer.Huang@....com>; Du, Xiaojian <Xiaojian.Du@....com>; Meng, Li (Jassmine) <Li.Meng@....com>
主题: Re: [PATCH RESENT] cpufreq: amd-pstate: add quirk for Ryzen 3000 series processor


On 2024/8/9 21:06, David Wang wrote:
> Hi,
>
> At 2024-08-09 14:09:05, "Perry Yuan" <perry.yuan@....com> wrote:
>> The Ryzen 3000 series processors have been observed lacking the
>> nominal_freq and lowest_freq parameters in their ACPI tables. This
>> absence causes issues with loading the amd-pstate driver on these
>> systems. Introduces a fix to resolve the dependency issue
>> by adding a quirk specifically for the Ryzen 3000 series.
>>
>> Reported-by: David Wang <00107082@....com>
>> Signed-off-by: Perry Yuan <perry.yuan@....com>
>> ---
>> drivers/cpufreq/amd-pstate.c | 30 ++++++++++++++++++++++++++++++
>> 1 file changed, 30 insertions(+)
>>
>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>> index 68c616b572f2..b39365b980b9 100644
>> --- a/drivers/cpufreq/amd-pstate.c
>> +++ b/drivers/cpufreq/amd-pstate.c
>> @@ -142,6 +142,11 @@ static struct quirk_entry quirk_amd_7k62 = {
>>      .lowest_freq = 550,
>> };
>>
>> +static struct quirk_entry quirk_amd_mts = {
>> +    .nominal_freq = 3600,
>> +    .lowest_freq = 550,
>> +};
>> +
>> static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi)
>> {
>>      /**
>> @@ -158,6 +163,21 @@ static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi)
>>      return 0;
>> }
>>
>> +static int __init dmi_matched_mts_bios_bug(const struct dmi_system_id *dmi)
>> +{
>> +    /**
>> +     * match the broken bios for ryzen 3000 series processor support CPPC V2
>> +     * broken BIOS lack of nominal_freq and lowest_freq capabilities
>> +     * definition in ACPI tables
>> +     */
>> +    if (cpu_feature_enabled(X86_FEATURE_ZEN2)) {
>> +            quirks = dmi->driver_data;
>> +            pr_info("Overriding nominal and lowest frequencies for %s\n", dmi->ident);
>> +            return 1;
>> +    }
>> +
>> +    return 0;
>> +}
>> static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = {
>>      {
>>              .callback = dmi_matched_7k62_bios_bug,
>> @@ -168,6 +188,16 @@ static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = {
>>              },
>>              .driver_data = &quirk_amd_7k62,
>>      },
>> +    {
>> +            .callback = dmi_matched_mts_bios_bug,
>> +            .ident = "AMD Ryzen 3000",
>> +            .matches = {
>> +                    DMI_MATCH(DMI_PRODUCT_NAME, "B450M MORTAR MAX (MS-7B89)"),
>> +                    DMI_MATCH(DMI_BIOS_RELEASE, "06/10/2020"),
>> +                    DMI_MATCH(DMI_BIOS_VERSION, "5.14"),
>> +            },
>> +            .driver_data = &quirk_amd_mts,
>> +    },
>>      {}
>> };
>> MODULE_DEVICE_TABLE(dmi, amd_pstate_quirks_table);
>> --
>> 2.34.1
>
> I tried this patch on 6.11.0-rc2, sadly this config does not match my system (BIOS).
> After some correction, I confirm following configuration matches my BIOS:
>
>   static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = {
>          {
>                  .callback = dmi_matched_7k62_bios_bug,
> @@ -168,6 +190,16 @@ static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = {
>                  },
>                  .driver_data = &quirk_amd_7k62,
>          },
> +       {
> +               .callback = dmi_matched_mts_bios_bug,
> +               .ident = "AMD Ryzen 3000",
> +               .matches = {
> +                       DMI_MATCH(DMI_PRODUCT_NAME, "MS-7B89"),
> +                       DMI_MATCH(DMI_BIOS_RELEASE, "5.14"),
> +                       DMI_MATCH(DMI_BIOS_VERSION, "2.80"),
> +               },
> +               .driver_data = &quirk_amd_mts,
> +       },
>          {}
>   };
>   MODULE_DEVICE_TABLE(dmi, amd_pstate_quirks_table);
>
> And with this change, my system boots with no amd_pstate error.
> The old warning and a new info show up though, I guess that is acceptable?
>
> [Fri Aug  9 19:35:29 2024] amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
>                             Please enable it if your BIOS has the CPPC option.
> [Fri Aug  9 19:35:29 2024] amd_pstate: Overriding nominal and lowest frequencies for AMD Ryzen 3000
>
>
> This patch confuses me a little,
> I do not see any bound between CPU identity "AMD Ryzen 3000" and my BIOS DMIs,
>   it make no sense to me to infer the CPU identity just by some BIOS DMIs.
> What if another AMD CPU with different cpu frequency range installed on the same BIOS as mine?
> (I guess current assumption is that my BIOS is way too old and weird, the possibility of "what if" mentioned above is very low?)
>
Double checked the internal docs about the CPPC feature on Matisse CPU,
which is named Ryzen 3xxxx CPU, it uses the same solution with Vermeer
CPU, named Ryzen 5xxx CPU.
This means, if one motherboard supports the CPPC feature with Ryzen 5xxx
CPU, it also supports the same feature on Ryzen3xxx CPU.
So it is recommended to update the latest BIOS for motherboard to enable
CPPC feature from hardware aspect.

The motherboard I am using is Gigabyte AX370-Gaming 5 released in 2017,
it is using the BIOS updated in 04/28/2022, it has the native option for
CPPC feature.

Thanks,
Xiaojian

> Anyway, after patching my system with a proper quirk,
> I dose not notice any significant CPU performance changes,  yet. (My kernel build time dose not change much, at least)
> And it seems to me that the amd_pstate module is active:
>
> $ ls /sys/devices/system/cpu/cpufreq/policy0/*amd* -l
> -r--r--r-- 1 root root 4096 Aug  9 20:46 /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf
> -r--r--r-- 1 root root 4096 Aug  9 20:46 /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_hw_prefcore
> -r--r--r-- 1 root root 4096 Aug  9 20:46 /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq
> -r--r--r-- 1 root root 4096 Aug  9 20:46 /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq
> -r--r--r-- 1 root root 4096 Aug  9 20:46 /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_prefcore_ranking
>
>   $ cpupower frequency-info  # when my system is idle
> analyzing CPU 0:
>    driver: amd-pstate-epp
>    CPUs which run at the same hardware frequency: 0
>    CPUs which need to have their frequency coordinated by software: 0
>    maximum transition latency:  Cannot determine or is not supported.
>    hardware limits: 550 MHz - 3.91 GHz
>    available cpufreq governors: performance powersave
>    current policy: frequency should be within 550 MHz and 3.91 GHz.
>                    The governor "powersave" may decide which speed to use
>                    within this range.
>    current CPU frequency: Unable to call hardware
>    current CPU frequency: 550 MHz (asserted by call to kernel)
>    boost state support:
>      Supported: yes
>      Active: no
>
> $ cpupower frequency-info  # when my sytem is busy building kernel
> analyzing CPU 0:
>    driver: amd-pstate-epp
>    CPUs which run at the same hardware frequency: 0
>    CPUs which need to have their frequency coordinated by software: 0
>    maximum transition latency:  Cannot determine or is not supported.
>    hardware limits: 550 MHz - 3.91 GHz
>    available cpufreq governors: performance powersave
>    current policy: frequency should be within 550 MHz and 3.91 GHz.
>                    The governor "powersave" may decide which speed to use
>                    within this range.
>    current CPU frequency: Unable to call hardware
>    current CPU frequency: 3.89 GHz (asserted by call to kernel)
>    boost state support:
>      Supported: yes
>      Active: no
>
>
> FYI
> And thanks for your support tailoring for my system~!
> David
>
>
>
>

Download attachment "Screenshot 2024-08-22 121644.png" of type "image/png" (64155 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ