intel_pstate CPU 型号不受支持

intel_pstate CPU 型号不受支持

我最近更新到了 Ubuntu 22.04 LTS,发现有电源选项。但是,性能模式不可用。

我无法获得与 Windows 双启动相同的性能和基准测试分数。我认为这就是原因。

所以我检查了电源调节器,它说acpi-cpufreq。我检查了我的 grub cfg,它说intel_pstate=enable。我在 Ubuntu 20.04 上遇到了同样的问题,以为可能是内核的问题,但即使有了新内核,它仍然无法正常工作。

[    0.062414] Kernel command line: BOOT_IMAGE=/vmlinuz-5.15.0-47-generic root=UUID=9103868b-6caf-4c46-95b9-05f6bb5b8e94 ro intel_pstate=enable quiet splash vt.handoff=7
[    0.453038] intel_pstate: CPU model not supported

$ cat  /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
acpi-cpufreq

$ uname -r
5.15.0-47-generic

$ grep -i pstate /boot/config-$(uname -r)
CONFIG_X86_INTEL_PSTATE=y

$ grep intel_pstate /boot/grub/grub.cfg 
    linux   /vmlinuz-5.15.0-47-generic root=UUID=xxxxx ro  intel_pstate=enable quiet splash $vt_handoff


$ cat /sys/devices/system/cpu/cpufreq/boost 
1

$ ls /sys/devices/system/cpu/intel_pstate/
no such file or directory

$ cpufreq-info
..snip..
analyzing CPU 15:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 15
  CPUs which need to have their frequency coordinated by software: 15
  maximum transition latency: 10.0 us.
  hardware limits: 800 MHz - 2.30 GHz
  available frequency steps: 2.30 GHz, 2.30 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz, 1.10 GHz, 1000 MHz, 900 MHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 800 MHz and 2.30 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 997 MHz.
  cpufreq stats: 2.30 GHz:1,62%, 2.30 GHz:0,13%, 2.20 GHz:0,25%, 2.10 GHz:0,17%, 2.00 GHz:0,27%, 1.90 GHz:0,31%, 1.80 GHz:0,29%, 1.70 GHz:0,54%, 1.50 GHz:0,73%, 1.40 GHz:0,72%, 1.30 GHz:0,96%, 1.20 GHz:1,33%, 1.10 GHz:3,17%, 1000 MHz:6,38%, 900 MHz:18,62%, 800 MHz:64,50%  (30660)

$ lscpu
..snip..
  Model name:            11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    CPU family:          6
    Model:               141
..snip..
    Frequency boost:     enabled
    CPU max MHz:         2301,0000
    CPU min MHz:         800,0000
    BogoMIPS:            4608.00
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mc
                         a cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss 
                         ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art
                          arch_perfmon pebs bts rep_good nopl xtopology nonstop_
                         tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes6
                         4 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr p
                         dcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline
                         _timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefe
                         tch cpuid_fault epb cat_l2 invpcid_single cdp_l2 ssbd i
                         brs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriori
                         ty ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep b
                         mi2 erms invpcid rdt_a avx512f avx512dq rdseed adx smap
                          avx512ifma clflushopt clwb intel_pt avx512cd sha_ni av
                         x512bw avx512vl xsaveopt xsavec xgetbv1 xsaves split_lo
                         ck_detect dtherm ida arat pln pts avx512vbmi umip pku o
                         spke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx5
                         12_bitalg avx512_vpopcntdq rdpid movdiri movdir64b fsrm
                          avx512_vp2intersect md_clear flush_l1d arch_capabiliti
                         es

另外,当我在 Google 上搜索 CPU 型号和 intel_pstate 时,我可以看到一些论坛帖子具有与 intel_pstate 相同的 CPU 和驱动程序/调速器(?),因此它可能受到支持。

我想知道我可以采取什么步骤来进一步排除故障或修复此问题?谢谢!

附言:我的设备是笔记本电脑

答案1

在启动过程中您会收到内核消息:

[    0.453038] intel_pstate: CPU model not supported

因为:

  1. HWP(硬件 Pstate)控制,又称英特尔 Speed Shift 技术(不要与英特尔 Speed Step 混淆),在 BIOS 中被禁用。
  2. intel_pstate CPU 频率调整驱动程序的源代码中似乎存在一个错误,该错误不允许在 Tiger Lake 系列英特尔处理器(可能还有其他系列)上禁用 HWP 的情况下使用该驱动程序。

为了在我的 20.04.4 测试服务器上使用 或 Comet Lake 处理器进行验证测试Intel(R) Core(TM) i5-10600K CPU @ 4.10GHz,我注释掉了无 HWP 代码路径中包含该系列的行:

doug@s19:~/kernel/linux$ git diff
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 57cdb3679885..3cbc1abb9911 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2414,7 +2414,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
        X86_MATCH(ATOM_GOLDMONT,        core_funcs),
        X86_MATCH(ATOM_GOLDMONT_PLUS,   core_funcs),
        X86_MATCH(SKYLAKE_X,            core_funcs),
-       X86_MATCH(COMETLAKE,            core_funcs),
+/*     X86_MATCH(COMETLAKE,            core_funcs), */
        X86_MATCH(ICELAKE_X,            core_funcs),
        {}
 };

对于未修改的内核我得到:

  • 在 BIOS 中将HWP 设置为autoenabled导致intel_pstateCPU 频率缩放驱动程序。
  • disabled在 BIOS 中将HWP 设置为会导致intel_cpufreqCPU 频率调整驱动程序。(请注意,该intel_cpufreq驱动程序只是intel_pstate被动模式下的驱动程序,这是 HWP 不可用时的默认模式。另请参阅这里

对于修改后的内核我得到:

  • 在 BIOS 中将HWP 设置为autoenabled导致intel_pstateCPU 频率缩放驱动程序。
  • disabled在 BIOS 中将HWP 设置为 导致acpi_cpufreqCPU 频率缩放驱动程序。

无 HWP 代码分支的处理器系列列表似乎相当不完整。就这个问题而言,型号是 141 或 0X8D 或 TIGERLAKE:

./arch/x86/include/asm/intel-family.h:#define INTEL_FAM6_TIGERLAKE              0x8D    /* Willow Cove */

因此建议的代码补丁是:

doug@s19:~/kernel/linux$ doug@s19:~/kernel/linux$ git diff
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 57cdb3679885..fc3ebeb0bbe5 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2416,6 +2416,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
        X86_MATCH(SKYLAKE_X,            core_funcs),
        X86_MATCH(COMETLAKE,            core_funcs),
        X86_MATCH(ICELAKE_X,            core_funcs),
+       X86_MATCH(TIGERLAKE,            core_funcs),
        {}
 };
 MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);

顺便说一句,性能 CPU 频率调节调节器可用于 acpi-cpufreq CPU 频率调节调节器。只需执行以下操作:

echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

然后检查一下:

doug@s19:~/kernel/linux$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu10/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu11/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu5/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu6/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu8/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu9/cpufreq/scaling_governor:performance

相关内容