如何添加电源调节器?

如何添加电源调节器?

我的 CPU 是 Intel n3710,在 Ubuntu 20.04 上,我安装了 cpu freq utils,但它显示可用的 cpufreq 调节器只有 powersave 和 performance。我们可以添加其他调节器,如 ondemand、conservative 和 userspace 吗?如果可以,如何添加?谢谢。

答案1

Intel_pstate CPU 频率调节驱动程序目前已包含被动模式。在该模式下,调节驱动程序称为 intel_cpufreq,它具有与 acpi-cpufreq 相同的所有调节器。

要查看您现在拥有的内容,请执行以下操作:

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:acpi-cpufreq
/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver:acpi-cpufreq
/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver:acpi-cpufreq
/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver:acpi-cpufreq
/sys/devices/system/cpu/cpu4/cpufreq/scaling_driver:acpi-cpufreq
/sys/devices/system/cpu/cpu5/cpufreq/scaling_driver:acpi-cpufreq

哎呀,示例不太好(故意的,为了显示 acpi-cpufreq)。
再试一次:

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:intel_pstate
/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver:intel_pstate
/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver:intel_pstate
/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver:intel_pstate
/sys/devices/system/cpu/cpu4/cpufreq/scaling_driver:intel_pstate
/sys/devices/system/cpu/cpu5/cpufreq/scaling_driver:intel_pstate
/sys/devices/system/cpu/cpu6/cpufreq/scaling_driver:intel_pstate
/sys/devices/system/cpu/cpu7/cpufreq/scaling_driver:intel_pstate

确实只有性能和节能调节器可用:

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors:performance powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors:performance powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors:performance powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors:performance powersave
/sys/devices/system/cpu/cpu4/cpufreq/scaling_available_governors:performance powersave
/sys/devices/system/cpu/cpu5/cpufreq/scaling_available_governors:performance powersave
/sys/devices/system/cpu/cpu6/cpufreq/scaling_available_governors:performance powersave
/sys/devices/system/cpu/cpu7/cpufreq/scaling_available_governors:performance powersave

现在,让我们看看 intel_pstate 驱动程序设置:

$ cat /sys/devices/system/cpu/intel_pstate/status
active

并将其更改为被动模式:

$ echo passive | sudo tee /sys/devices/system/cpu/intel_pstate/status
passive
doug@s15:~/temp$ cat /sys/devices/system/cpu/intel_pstate/status
passive

现在检查 cpufreq 与以前相同的内容:

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu4/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu5/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu6/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
/sys/devices/system/cpu/cpu7/cpufreq/scaling_available_governors:conservative ondemand userspace powersave performance schedutil
$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu4/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu5/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu6/cpufreq/scaling_driver:intel_cpufreq
/sys/devices/system/cpu/cpu7/cpufreq/scaling_driver:intel_cpufreq

注意:对于具有 HWP(硬件 Pstate 控制)功能处理器的用户:目前,只有在系统启动时禁用 HWP 和/或强制启动被动模式时,才可以使用被动模式。未来可能会启用 HWP 的被动模式。以下是针对各种 intel_pstate 启动方法的几个示例 grub 命令行:

#GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 consoleblank=450 cpuidle_sysfs_switch cpuidle.governor=teo"
#GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 consoleblank=450 intel_pstate=no_hwp cpuidle_sysfs_switch cpuidle.governor=teo"
#GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 consoleblank=300 intel_pstate=disable cpuidle_sysfs_switch cpuidle.governor=teo"
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 consoleblank=450 intel_pstate=passive cpuidle_sysfs_switch cpuidle.governor=teo"
#GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 consoleblank=450 intel_pstate=passive intel_pstate=no_hwp cpuidle_sysfs_switch cpuidle.governor=teo"
#GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 consoleblank=450 intel_pstate=passive intel_pstate=no_hwp cpuidle_sysfs_switch cpuidle.governor=teo intel_idle.max_cstate=1"
#GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 consoleblank=450 intel_pstate=passive cpuidle_sysfs_switch cpuidle.governor=teo cgroup_no_v1=all"

相关内容