diff mbox series

[Regression] 6.11.0-rc1: AMD CPU boot with error when CPPC feature disabled by BIOS

Message ID 20240730140111.4491-1-00107082@163.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [Regression] 6.11.0-rc1: AMD CPU boot with error when CPPC feature disabled by BIOS | expand

Commit Message

David Wang July 30, 2024, 2:01 p.m. UTC
Hi,

I notice some kernel warning and errors when I update to 6.11.0-rc1:

 kernel: [    1.022739] amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
 kernel: [    1.022739] Please enable it if your BIOS has the CPPC option.
 kernel: [    1.098054] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.110058] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.122057] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.134062] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.134641] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.135128] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.135693] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.136371] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
 kernel: [    1.136390] amd_pstate: failed to register with return -19
 kernel: [    1.138410] ledtrig-cpu: registered to indicate activity on CPUs


Those warning message was introduced by commit:
 bff7d13c190ad98cf4f877189b022c75df4cb383 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS)
, which make sense.

Those error message was introduced by commit:
 8f8b42c1fcc939a73b547b172a9ffcb65ef4bf47 ("cpufreq: amd-pstate: optimize the initial frequency values verification")
, when CPPC is disabled by BIOS, this error message does not make sense, and the error return-code would abort the driver registeration,
but this behavior could be handled earlier when detecting CPPC feature.

I feel following changes would make a clean fix: do not register amd_pstate driver when CPPC disabled by BIOS.



Thanks
David

Comments

Xiaojian Du July 30, 2024, 5:43 p.m. UTC | #1
Hi  David,

CPPC feature is enabled by default in BIOS for new ZENX arch CPU, and 
amd-pstate driver is enabled in new linux kernel.

For your system ,why CPPC is disabled, is it for debug or some special case?

If you want to use legacy acpi cpu driver, you can disable amd-pstate 
driver module in your linux kernel config file and compile a new kernel.

> Those warning message was introduced by commit:
>   bff7d13c190ad98cf4f877189b022c75df4cb383 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS)
> , which make sense.
>
> Those error message was introduced by commit:
>   8f8b42c1fcc939a73b547b172a9ffcb65ef4bf47 ("cpufreq: amd-pstate: optimize the initial frequency values verification")
> , when CPPC is disabled by BIOS, this error message does not make sense, and the error return-code would abort the driver registeration,
> but this behavior could be handled earlier when detecting CPPC feature.
>
> I feel following changes would make a clean fix: do not register amd_pstate driver when CPPC disabled by BIOS.
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 68c616b572f2..b06faea58fd4 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -1837,8 +1837,6 @@ static bool amd_cppc_supported(void)
>           * If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC,
>           * the AMD Pstate driver may not function correctly.
>           * Check the CPPC flag and display a warning message if the platform supports CPPC.
> -        * Note: below checking code will not abort the driver registeration process because of
> -        * the code is added for debugging purposes.

As you see, it is for debug purpose, in some corner case, if CPPC 
feature is disabled, this debug info will help to guide user to 
*re-enable* it.

Target system, including CPU+baseboard+BIOS, is supposed to enable and 
use CPPC feature for better Performance per Watt.

>           */
>          if (!cpu_feature_enabled(X86_FEATURE_CPPC)) {
>                  if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) {
> @@ -1856,6 +1854,7 @@ static bool amd_cppc_supported(void)
>          if (warn)
>                  pr_warn_once("The CPPC feature is supported but currently disabled by the BIOS.\n"
>                                          "Please enable it if your BIOS has the CPPC option.\n");
> +               return false;
Maybe need a pair of curly brace after this "if(warn)" for your change.
>          return true;
>   }
>
>
>
> Thanks
> David
>
David Wang July 31, 2024, 12:25 a.m. UTC | #2
Hi Du, 

Thanks for the quick response

At 2024-07-31 01:43:47, "Xiaojian Du" <xiaojidu@amd.com> wrote:
>Hi  David,
>
>CPPC feature is enabled by default in BIOS for new ZENX arch CPU, and 
>amd-pstate driver is enabled in new linux kernel.
>
>For your system ,why CPPC is disabled, is it for debug or some special case?

 I do not have any special purpose, it is just the default BIOS setup for my old system.

>
>If you want to use legacy acpi cpu driver, you can disable amd-pstate 
>driver module in your linux kernel config file and compile a new kernel.
>
>> Those warning message was introduced by commit:
>>   bff7d13c190ad98cf4f877189b022c75df4cb383 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS)
>> , which make sense.
>>
>> Those error message was introduced by commit:
>>   8f8b42c1fcc939a73b547b172a9ffcb65ef4bf47 ("cpufreq: amd-pstate: optimize the initial frequency values verification")
>> , when CPPC is disabled by BIOS, this error message does not make sense, and the error return-code would abort the driver registeration,
>> but this behavior could be handled earlier when detecting CPPC feature.
>>
>> I feel following changes would make a clean fix: do not register amd_pstate driver when CPPC disabled by BIOS.
>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>> index 68c616b572f2..b06faea58fd4 100644
>> --- a/drivers/cpufreq/amd-pstate.c
>> +++ b/drivers/cpufreq/amd-pstate.c
>> @@ -1837,8 +1837,6 @@ static bool amd_cppc_supported(void)
>>           * If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC,
>>           * the AMD Pstate driver may not function correctly.
>>           * Check the CPPC flag and display a warning message if the platform supports CPPC.
>> -        * Note: below checking code will not abort the driver registeration process because of
>> -        * the code is added for debugging purposes.
>
>As you see, it is for debug purpose, in some corner case, if CPPC 
>feature is disabled, this debug info will help to guide user to 
>*re-enable* it.
>
>Target system, including CPU+baseboard+BIOS, is supposed to enable and 
>use CPPC feature for better Performance per Watt.

I agree that the warning guide makes total sense,  but  the  *errors* does not, why bother trying and report error when the feature is disabled by BIOS.


>
>>           */
>>          if (!cpu_feature_enabled(X86_FEATURE_CPPC)) {
>>                  if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) {
>> @@ -1856,6 +1854,7 @@ static bool amd_cppc_supported(void)
>>          if (warn)
>>                  pr_warn_once("The CPPC feature is supported but currently disabled by the BIOS.\n"
>>                                          "Please enable it if your BIOS has the CPPC option.\n");
>> +               return false;
>Maybe need a pair of curly brace after this "if(warn)" for your change.
>>          return true;
>>   }
>>
>>
>>
>> Thanks
>> David
>>
Xiaojian Du July 31, 2024, 3:16 a.m. UTC | #3
On 2024/7/31 8:25, David Wang wrote:
> Hi Du,
>
> Thanks for the quick response
>
> At 2024-07-31 01:43:47, "Xiaojian Du" <xiaojidu@amd.com> wrote:
>> Hi  David,
>>
>> CPPC feature is enabled by default in BIOS for new ZENX arch CPU, and
>> amd-pstate driver is enabled in new linux kernel.
>>
>> For your system ,why CPPC is disabled, is it for debug or some special case?
>   I do not have any special purpose, it is just the default BIOS setup for my old system.
>
>> If you want to use legacy acpi cpu driver, you can disable amd-pstate
>> driver module in your linux kernel config file and compile a new kernel.
>>
>>> Those warning message was introduced by commit:
>>>    bff7d13c190ad98cf4f877189b022c75df4cb383 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS)
>>> , which make sense.
>>>
>>> Those error message was introduced by commit:
>>>    8f8b42c1fcc939a73b547b172a9ffcb65ef4bf47 ("cpufreq: amd-pstate: optimize the initial frequency values verification")
>>> , when CPPC is disabled by BIOS, this error message does not make sense, and the error return-code would abort the driver registeration,
>>> but this behavior could be handled earlier when detecting CPPC feature.
>>>
>>> I feel following changes would make a clean fix: do not register amd_pstate driver when CPPC disabled by BIOS.
>>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>>> index 68c616b572f2..b06faea58fd4 100644
>>> --- a/drivers/cpufreq/amd-pstate.c
>>> +++ b/drivers/cpufreq/amd-pstate.c
>>> @@ -1837,8 +1837,6 @@ static bool amd_cppc_supported(void)
>>>            * If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC,
>>>            * the AMD Pstate driver may not function correctly.
>>>            * Check the CPPC flag and display a warning message if the platform supports CPPC.
>>> -        * Note: below checking code will not abort the driver registeration process because of
>>> -        * the code is added for debugging purposes.
>> As you see, it is for debug purpose, in some corner case, if CPPC
>> feature is disabled, this debug info will help to guide user to
>> *re-enable* it.
>>
>> Target system, including CPU+baseboard+BIOS, is supposed to enable and
>> use CPPC feature for better Performance per Watt.
> I agree that the warning guide makes total sense,  but  the  *errors* does not, why bother trying and report error when the feature is disabled by BIOS.
>
It has to do that.
AMD strongly recommends users to enable this feature, but each OEM will 
have customized BIOS, some support CPPC but disable by default,
some support CPPC and enable by default, and some disable CPPC directly 
without providing switch option.

Since newer Linux kernel enables the amd-pstate driver by default, and 
newer AMD Zen X CPU supports this feature,
but user find that CPPC is not effective under their software and 
hardware combination,
if this driver does not try to load module and print no information, it 
will mislead users that the problem is caused by the amd-pstate driver.

Thanks,
Xiaojian

>>>            */
>>>           if (!cpu_feature_enabled(X86_FEATURE_CPPC)) {
>>>                   if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) {
>>> @@ -1856,6 +1854,7 @@ static bool amd_cppc_supported(void)
>>>           if (warn)
>>>                   pr_warn_once("The CPPC feature is supported but currently disabled by the BIOS.\n"
>>>                                           "Please enable it if your BIOS has the CPPC option.\n");
>>> +               return false;
>> Maybe need a pair of curly brace after this "if(warn)" for your change.
>>>           return true;
>>>    }
>>>
>>>
>>>
>>> Thanks
>>> David
>>>
David Wang July 31, 2024, 3:39 a.m. UTC | #4
At 2024-07-31 11:16:14, "Xiaojian Du" <xiaojidu@amd.com> wrote:
>
>On 2024/7/31 8:25, David Wang wrote:
>> Hi Du,
>>
>> Thanks for the quick response
>>
...
>>>
>>> Target system, including CPU+baseboard+BIOS, is supposed to enable and
>>> use CPPC feature for better Performance per Watt.
>> I agree that the warning guide makes total sense,  but  the  *errors* does not, why bother trying and report error when the feature is disabled by BIOS.
>>
>It has to do that.
>AMD strongly recommends users to enable this feature, but each OEM will 
>have customized BIOS, some support CPPC but disable by default,
>some support CPPC and enable by default, and some disable CPPC directly 
>without providing switch option.
>
>Since newer Linux kernel enables the amd-pstate driver by default, and 
>newer AMD Zen X CPU supports this feature,
>but user find that CPPC is not effective under their software and 
>hardware combination,
>if this driver does not try to load module and print no information, it 
>will mislead users that the problem is caused by the amd-pstate driver.
>
>Thanks,
>Xiaojian
>

I feel that you are arguing for the warning and the errors separately.
Separately,   I agree warning or error message make sense as you explained,  but together I feel confused:
Receiving a warning that CPPC feature is disable by BIOS already notify users that amd-pstate would not work, right?
Is it possible, that those two condition coexists: CPPC is disabled by BIOS, and  amd-pstate could function properly?


Thanks
David
Xiaojian Du July 31, 2024, 4:21 a.m. UTC | #5
On 2024/7/31 11:39, David Wang wrote:
> At 2024-07-31 11:16:14, "Xiaojian Du" <xiaojidu@amd.com> wrote:
>> On 2024/7/31 8:25, David Wang wrote:
>>> Hi Du,
>>>
>>> Thanks for the quick response
>>>
>>> ...
>>> I feel that you are arguing for the warning and the errors separately.
>>> Separately,   I agree warning or error message make sense as you explained,  but together I feel confused:
>>> Receiving a warning that CPPC feature is disable by BIOS already notify users that amd-pstate would not work, right?
Warning is not enough, error will guide user to switch to acpi cpu 
driver or seek more support from OEM.
>>> Is it possible, that those two condition coexists: CPPC is disabled by BIOS, and  amd-pstate could function properly?
>>>
>>>   

No possible, the current amd-pstate driver is based on CPPC feature.

Thanks.
Xiaojian

>>> Thanks
>>> David
>>>
David Wang July 31, 2024, 4:33 a.m. UTC | #6
At 2024-07-31 12:21:05, "Xiaojian Du" <xiaojidu@amd.com> wrote:
>
>On 2024/7/31 11:39, David Wang wrote:
>> At 2024-07-31 11:16:14, "Xiaojian Du" <xiaojidu@amd.com> wrote:
>>> On 2024/7/31 8:25, David Wang wrote:
>>>> Hi Du,
>>>>
>>>> Thanks for the quick response
>>>>
>>>> ...
>>>> I feel that you are arguing for the warning and the errors separately.
>>>> Separately,   I agree warning or error message make sense as you explained,  but together I feel confused:
>>>> Receiving a warning that CPPC feature is disable by BIOS already notify users that amd-pstate would not work, right?
>Warning is not enough, error will guide user to switch to acpi cpu 
>driver or seek more support from OEM.
>>>> Is it possible, that those two condition coexists: CPPC is disabled by BIOS, and  amd-pstate could function properly?
>>>>
>>>>   
>
>No possible, the current amd-pstate driver is based on CPPC feature.
>
>Thanks.
>Xiaojian
>

So, what about the patch I mentioned:  when CPPC is disabled by  BIOS, print warning message and abort amd-pstate driver registration?
(I made a code block mistake in the patch I posted before)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 68c616b572f2..b06faea58fd4 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1837,8 +1837,6 @@ static bool amd_cppc_supported(void)
         * If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC,
         * the AMD Pstate driver may not function correctly.
         * Check the CPPC flag and display a warning message if the platform supports CPPC.
-        * Note: below checking code will not abort the driver registeration process because of
-        * the code is added for debugging purposes.
         */
        if (!cpu_feature_enabled(X86_FEATURE_CPPC)) {
                if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) {
@@ -1856,6 +1854,7 @@ static bool amd_cppc_supported(void)
-        if (warn)
+        if (warn) {
                pr_warn_once("The CPPC feature is supported but currently disabled by the BIOS.\n"
                                        "Please enable it if your BIOS has the CPPC option.\n");
+               return false;
+         }
        return true;
 } 



Thanks
David
Gautham R. Shenoy July 31, 2024, 10:12 a.m. UTC | #7
Hello David,

David Wang <00107082@163.com> writes:

> Hi,
>
> I notice some kernel warning and errors when I update to 6.11.0-rc1:
>
>  kernel: [    1.022739] amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
>  kernel: [    1.022739] Please enable it if your BIOS has the CPPC option.
>  kernel: [    1.098054] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.110058] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.122057] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.134062] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.134641] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.135128] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.135693] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.136371] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>  kernel: [    1.136390] amd_pstate: failed to register with return -19
>  kernel: [    1.138410] ledtrig-cpu: registered to indicate activity on CPUs
>
>
> Those warning message was introduced by commit:
>  bff7d13c190ad98cf4f877189b022c75df4cb383 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS)
> , which make sense.


If CPPC is disabed in the BIOS, then the _CPC objects shouldn't have
been created. And the error message that you should have seen is
"the _CPC object is not present in SBIOS or ACPI disabled".


Could you please share the family and model number of the platform where
you are observing this ?

--
Thanks and Regards
gautham.
David Wang July 31, 2024, 12:58 p.m. UTC | #8
Hi,

At 2024-07-31 18:12:12, "Gautham R.Shenoy" <gautham.shenoy@amd.com> wrote:
>Hello David,
>
>David Wang <00107082@163.com> writes:
>
>> Hi,
>>
>> I notice some kernel warning and errors when I update to 6.11.0-rc1:
>>
>>  kernel: [    1.022739] amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
>>  kernel: [    1.022739] Please enable it if your BIOS has the CPPC option.
>>  kernel: [    1.098054] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.110058] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.122057] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.134062] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.134641] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.135128] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.135693] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.136371] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>  kernel: [    1.136390] amd_pstate: failed to register with return -19
>>  kernel: [    1.138410] ledtrig-cpu: registered to indicate activity on CPUs
>>
>>
>> Those warning message was introduced by commit:
>>  bff7d13c190ad98cf4f877189b022c75df4cb383 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS)
>> , which make sense.
>
>
>If CPPC is disabed in the BIOS, then the _CPC objects shouldn't have
>been created. And the error message that you should have seen is
>"the _CPC object is not present in SBIOS or ACPI disabled".
>
>
>Could you please share the family and model number of the platform where
>you are observing this ?

My `cat /proc/cpuinfo` shows something as following:
processor	: 0
vendor_id	: AuthenticAMD
cpu family	: 23
model		: 113
model name	: AMD Ryzen 3 3100 4-Core Processor
stepping	: 0
microcode	: 0x8701021
cpu MHz		: 3600.000
cache size	: 512 KB
physical id	: 0
siblings	: 8
core id		: 0
cpu cores	: 4
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 16
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es
bugs		: sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass retbleed smt_rsb srso
bogomips	: 7199.95
TLB size	: 3072 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 43 bits physical, 48 bits virtual
power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14]




>
>--
>Thanks and Regards
>gautham.
Gautham R. Shenoy Aug. 2, 2024, 5:02 a.m. UTC | #9
Hello David,

"David Wang" <00107082@163.com> writes:

> Hi,
>
> At 2024-07-31 18:12:12, "Gautham R.Shenoy" <gautham.shenoy@amd.com> wrote:
>>Hello David,
>>
>>David Wang <00107082@163.com> writes:
>>
>>> Hi,
>>>
>>> I notice some kernel warning and errors when I update to 6.11.0-rc1:
>>>
>>>  kernel: [    1.022739] amd_pstate: The CPPC feature is supported but currently disabled by the BIOS.
>>>  kernel: [    1.022739] Please enable it if your BIOS has the CPPC option.
>>>  kernel: [    1.098054] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.110058] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.122057] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.134062] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.134641] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.135128] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.135693] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.136371] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.136390] amd_pstate: failed to register with return -19
>>>  kernel: [    1.138410] ledtrig-cpu: registered to indicate activity on CPUs
>>>
>>>
>>> Those warning message was introduced by commit:
>>>  bff7d13c190ad98cf4f877189b022c75df4cb383 ("cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS)
>>> , which make sense.
>>
>>
>>If CPPC is disabed in the BIOS, then the _CPC objects shouldn't have
>>been created. And the error message that you should have seen is
>>"the _CPC object is not present in SBIOS or ACPI disabled".
>>
>>
>>Could you please share the family and model number of the platform where
>>you are observing this ?
>
> My `cat /proc/cpuinfo` shows something as following:
> processor	: 0
> vendor_id	: AuthenticAMD
> cpu family	: 23
> model		: 113


This is Family 0x17 (Zen2), Model 0x71. AFAIK, this processor supports
CPPC but does not have the support for the CPPC MSRs. Hence the CPPC
communication occurs via shared-memory.

Hence the warning introduced by the commit bff7d13c190a ("cpufreq:
amd-pstate: add debug message while CPPC is supported and disabled by
SBIOS") is not applicable on your platform. I will send a patch to
rectify this which avoids the warning for Zen2 Models 0x70-0x7F.

Regarding the following errors that you are observing 

>>>  kernel: [    1.098054] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.110058] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.122057] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.134062] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.134641] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.135128] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.135693] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.136371] amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
>>>  kernel: [    1.136390] amd_pstate: failed to register with return -19


it appears that the CPPC version on your platform is v2 which does not
advertise the nominal_freq and the lowest_freq. In the absence of these,
it is not possible for the amd-pstate driver to infer the
min/max_freq. Which is why the driver bails at this later stage.

The way around it is to add a quirk for your BIOS as done in this commit
from Perry:
eb8b6c368202 ("cpufreq: amd-pstate: Add quirk for the pstate CPPC capabilities missing")


--
Thanks and Regards
gautham.
Luna Nova Sept. 26, 2024, 8:56 p.m. UTC | #10
Hi Gautham,

I'm seeing the same message on a server board with an EPYC Rome 7K62 CPU.
CPPC is set to enabled in the UEFI firmware settings.

Kernel: 6.11.0 (6.11.0 #1-NixOS SMP PREEMPT_DYNAMIC Sun Sep 15 14:57:56 UTC 2024 x86_64 GNU/Linux)
Board: Gigabyte MZ22-G20-00 Rev 1.0 (in a G292-Z20 Rev 100)
UEFI Firwmare: R23_F01 (2021-09-06, latest available version at time of this message)
AGESA PI Version 1.0.0.C.

CONFIG_ACPI_CPPC_LIB=y
CONFIG_X86_AMD_PSTATE=y
CONFIG_X86_AMD_PSTATE_DEFAULT_MODE=3
CONFIG_X86_AMD_PSTATE_UT=m

$ cat /proc/cmdline
initrd=\EFI\nixos\z16gakzlwypxbjzm5y93x10cjmxjvial-initrd-linux-6.11-initrd.efi init=/nix/store/cqhw9x7w7dc3avwri4i2lk0mgc31arll-nixos-system-tsukiakari-nixos-24.11/init sysrq_always_enabled fsck.mode=force loglevel=4 audit=0 amd_pstate=guided amd_pstate.shared_mem=1 amdgpu.lockup_timeout=10000,10000,10000,10000
$ sudo dmesg | grep pstate
amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect
(Repeats for each core)
amd_pstate: failed to register with return -19
stage-1-init: [Thu Sep 26 20:04:53 UTC 2024] loading module amd_pstate_ut...
amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid  success!
amd_pstate_ut: 2    amd_pstate_ut_check_enabled   success!
amd_pstate_ut: 3    amd_pstate_ut_check_perf      success!
amd_pstate_ut: 4    amd_pstate_ut_check_freq      success!

It seems odd that amd_pstate fails to load but amd_pstate_ut reports success for all checks.

> it appears that the CPPC version on your platform is v2 which does not
> advertise the nominal_freq and the lowest_freq. In the absence of these,
> it is not possible for the amd-pstate driver to infer the
> min/max_freq. Which is why the driver bails at this later stage.

> The way around it is to add a quirk for your BIOS as done in this commit
> from Perry:
> eb8b6c368202 ("cpufreq: amd-pstate: Add quirk for the pstate CPPC capabilities missing")

Perry's patch you referenced as an example above targets the same 7K62 CPU but requires one specific BIOS version.
Should I submit a patch adding the version on this system to that quirk?

I'm confused by the quirk code: it's called "AMD EPYC 7K62" but it matches by BIOS revision and doesn't check the CPU model.
An earlier version of the quirk included `boot_cpu_data.x86 == 0x17 && boot_cpu_data.x86_model == 0x31` to check the model; it now uses the nominal frequencies for a 7K62 regardless of the CPU model if the BIOS revision matches.

Best,
Luna
Gautham R. Shenoy Sept. 30, 2024, 2:47 p.m. UTC | #11
Hello,


On Thu, Sep 26, 2024 at 01:56:21PM -0700, Luna Nova wrote:
> Hi Gautham,
> 
> I'm seeing the same message on a server board with an EPYC Rome 7K62 CPU.
> CPPC is set to enabled in the UEFI firmware settings.
> 
> Kernel: 6.11.0 (6.11.0 #1-NixOS SMP PREEMPT_DYNAMIC Sun Sep 15 14:57:56 UTC 2024 x86_64 GNU/Linux)
> Board: Gigabyte MZ22-G20-00 Rev 1.0 (in a G292-Z20 Rev 100)
> UEFI Firwmare: R23_F01 (2021-09-06, latest available version at time of this message)
> AGESA PI Version 1.0.0.C.

This is old! Can you check with your motherboard manufacturer if they
have a latest version available?





> 
> CONFIG_ACPI_CPPC_LIB=y
> CONFIG_X86_AMD_PSTATE=y
> CONFIG_X86_AMD_PSTATE_DEFAULT_MODE=3
> CONFIG_X86_AMD_PSTATE_UT=m
> 
> $ cat /proc/cmdline
> initrd=\EFI\nixos\z16gakzlwypxbjzm5y93x10cjmxjvial-initrd-linux-6.11-initrd.efi init=/nix/store/cqhw9x7w7dc3avwri4i2lk0mgc31arll-nixos-system-tsukiakari-nixos-24.11/init sysrq_always_enabled fsck.mode=force loglevel=4 audit=0 amd_pstate=guided amd_pstate.shared_mem=1 amdgpu.lockup_timeout=10000,10000,10000,10000
> $ sudo dmesg | grep pstate
> amd_pstate: min_freq(0) or max_freq(0) or nominal_freq(0) value is incorrect

This happens on your platform because the ACPI CPPC version on your
platform is v2 doesn't advertise the nominal_freq and lowest_freq.


> (Repeats for each core)
> amd_pstate: failed to register with return -19

Working as expected!


> stage-1-init: [Thu Sep 26 20:04:53 UTC 2024] loading module amd_pstate_ut...
> amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid  success!
> amd_pstate_ut: 2    amd_pstate_ut_check_enabled   success!
> amd_pstate_ut: 3    amd_pstate_ut_check_perf      success!
> amd_pstate_ut: 4    amd_pstate_ut_check_freq      success!
> 
> It seems odd that amd_pstate fails to load but amd_pstate_ut reports success for all checks.

Hmm.. This is strange. I need to check why this is happening. 

> 
> > it appears that the CPPC version on your platform is v2 which does not
> > advertise the nominal_freq and the lowest_freq. In the absence of these,
> > it is not possible for the amd-pstate driver to infer the
> > min/max_freq. Which is why the driver bails at this later stage.
> 
> > The way around it is to add a quirk for your BIOS as done in this commit
> > from Perry:
> > eb8b6c368202 ("cpufreq: amd-pstate: Add quirk for the pstate CPPC capabilities missing")
> 
> Perry's patch you referenced as an example above targets the same 7K62 CPU but requires one specific BIOS version.

Yes, Perry's solution targets a BIOS version as a more recent version
of the BIOS may advertise CPPC v3 which is what the amd-pstate driver
expects.

> Should I submit a patch adding the version on this system to that quirk?

Yes. If your board manufacturer does not have a latest version of the
firmware that advertises CPPC v3 that is..

> 
> I'm confused by the quirk code: it's called "AMD EPYC 7K62" but it matches by BIOS revision and doesn't check the CPU model.


> An earlier version of the quirk included `boot_cpu_data.x86 == 0x17 && boot_cpu_data.x86_model == 0x31` to check the model; it now uses the nominal frequencies for a 7K62 regardless of the CPU model if the BIOS revision matches.

When you boot your system with acpi_cpufreq, what is the P0 Pstate
frequency ? Is it same as the one used in the quirk ?

> 
> Best,
> Luna

--
Thanks and Regards
gautham.
diff mbox series

Patch

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 68c616b572f2..b06faea58fd4 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1837,8 +1837,6 @@  static bool amd_cppc_supported(void)
         * If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC,
         * the AMD Pstate driver may not function correctly.
         * Check the CPPC flag and display a warning message if the platform supports CPPC.
-        * Note: below checking code will not abort the driver registeration process because of
-        * the code is added for debugging purposes.
         */
        if (!cpu_feature_enabled(X86_FEATURE_CPPC)) {
                if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) {
@@ -1856,6 +1854,7 @@  static bool amd_cppc_supported(void)
        if (warn)
                pr_warn_once("The CPPC feature is supported but currently disabled by the BIOS.\n"
                                        "Please enable it if your BIOS has the CPPC option.\n");
+               return false;
        return true;
 }