Linux

linux:不能用cpupower設置cpu頻率調節器

  • January 29, 2021

我有一個帶有 AMD Epyc CPU、BIOS A43 v1.20、Linux 核心 4.19.71 的伺服器 HPE ProLiant 系統(我也在 5.4.0 上嘗試過)。現在,我正在嘗試設置 CPU 性能調控器:

# cpupower frequency-set -g performance
   Setting cpu: 0
   Error setting new values. Common errors:
   - Do you have proper administration rights? (super-user?)
   - Is the governor you requested available and modprobed?
   - Trying to set an invalid policy?
   - Trying to set a specific frequency, but userspace governor is not available,
      for example because of hardware which cannot be set to a specific frequency
      or because the userspace governor isn't loaded?
#

所以我開始排除故障:

# cpupower frequency-info
analyzing CPU 0:
 no or unknown cpufreq driver is active on this CPU
 CPUs which run at the same hardware frequency: Not Available
 CPUs which need to have their frequency coordinated by software: Not Available
 maximum transition latency:  Cannot determine or is not supported.
Not Available
 available cpufreq governors: Not Available
 Unable to determine current policy
 current CPU frequency: Unable to call hardware
 current CPU frequency:  Unable to call to kernel
 boost state support:
   Supported: yes
   Active: yes
   Boost States: 0
   Total States: 3
   Pstate-P0:  2000MHz
   Pstate-P1:  1800MHz
   Pstate-P2:  1500MHz
#
# ls /sys/devices/system/cpu/cpufreq/
<Empty>
#
#

因此,無論出於何種原因,它都認為cpufreq缺少驅動程序。但是,核心.config啟用了以下功能:

CONFIG_CPU_FREQ=y
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_X86_ACPI_CPUFREQ_CPB=y
CONFIG_X86_INTEL_PSTATE=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y

我確實嘗試禁用CONFIG_X86_INTEL_PSTATE和添加CONFIG_X86_POWERNOW_K8(目前核心中唯一特定於 AMD 的),但它似乎沒有幫助。

我很樂意提供任何建議。

如果您使用的是第二代 EPYC(羅馬)CPU,很有可能並非所有功能都在您的核心上實現。我不知道您使用的是哪個發行版(它可能被反向移植),但根據 Ubuntu https://ubuntu.com/blog/amd-epyc-rome-support-in-ubuntu-server上的這篇博文,您的核心可能不完全支持你的 CPU。

從 Ubuntu 網站:

從 5.4 系列開始,對 AMD EPYC Rome 的支持已合併到 Linux 核心中。因此,所有安裝了 5.4 核心的 Ubuntu 版本都支持此 CPU 及其所有新功能。但是,Canonical 還將對 AMD EPYC Rome 的基本支持向後移植到較舊的 LTS 版本,以確保它們能夠在這個新 CPU 上正常工作。

引用自:https://unix.stackexchange.com/questions/628831