Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Proxmox Power Saving

Concepts

Apps

Install on ubuntu:

sudo apt install powertop linux-tools-`uname -r`

Install on debian:

sudo apt install powertop linux-cpupower

Info:

Just in case you have AMD CPUs: thread3.

Monitoring

CPU frequency

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq

better yet:

watch grep \"cpu MHz\" /proc/cpuinfo

Use cpupower

root@fuji:~# cpupower frequency-info
analyzing CPU 0:
  driver: intel_pstate
  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: 800 MHz - 3.90 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 800 MHz and 3.90 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 3.90 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

CPU Governor

About governors:

Show Scaling Driver

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver

Change Governor

To change governor until reboot:

root@suprox:~# cpupower frequency-set -g powersave
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3

To change governor permanently:

cat << 'EOF' > /etc/default/cpufrequtils
GOVERNOR="powersave"
EOF

intel-pstate vs acpi-cpufreq

Is this still true? acpi-cpufreq is better. Switch the governor to acpi-cpufreq.

Enable Power Saving Governor

To enable PowerSave (instead of Performance) governor:

echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Switch back to intel_pstate Governor

Ensure intel_pstate=enable is there for GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub. Then sudo update-grub and reboot.

To check:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver

Enable CPU Turbo Boost

Just make sure that:

root@duo:~# cat /sys/devices/system/cpu/intel_pstate/no_turbo
0

To change it:

echo 0 | tee /sys/devices/system/cpu/intel_pstate/no_turbo

If you get tee: /sys/devices/system/cpu/intel_pstate/no_turbo: Operation not permitted this means turbo is disabled in BIOS.

Addressing powertop Recommendations

Create recommendation file:

sudo powertop --html

Add to /etc/sysctl.conf:

# recommended by powertop
kernel.nmi_watchdog=0
vm.dirty_writeback_centisecs=1500

Create /etc/udev/rules.d/10-runtime-pm.rules:

SUBSYSTEM!="pci", GOTO="power_runtime_rules_end"
ACTION!="add", GOTO="power_runtime_rules_end"

KERNEL=="????:??:??.?"
PROGRAM="/bin/sleep 0.1"

ATTR{power/control}=="*", ATTR{power/control}="auto"

LABEL="power_runtime_rules_end"

More

Switch governor: https://github.com/tteck/Proxmox/blob/main/misc/scaling-governor.sh

Undervolting CPU

https://wiki.archlinux.org/title/Undervolting_CPU