I have updated one of my systems from AMD to Intel 11th gen CPU recently and found out that it is running hot for some reasons. A quick check of sysctl dev.cpu.0.freq confirmed that the CPU is running at full speed all the time. More concerning is that the CPU reports that it only supports one speed: sysctl dev.cpu.0.freq_levels: 3696/-1. CPU frequicies on the machine was managed by powerd. I run powerd in foreground mode and confirm that it is trying to change the CPU clock speed and failing.
After some googling around, I came across a Reddit post that explained what was happening. The reason powerd no longer works is that the new driver for the Intel® Speed Shift™ feature set is now in use instead of the old ACPI driver. It is better explined in The Handbook. If the new driver is in use, sysctl should return something like dev.cpufreq.0.freq_driver: hwpstate_intel0.
Ok, how to use it? According to the Manpage for the hwpstate_intel driver, the only useful tunable the driver exposes is dev.hwpstate_intel.%d.epp (where %d is the core number).
dev.hwpstate_intel.%d.epp
Energy/Performance Preference. Valid values range from 0 to
100. Setting this field conveys a hint to the hardware regarding a preference towards performance (at value 0), energy efficiency (at value 100), or somewhere in between.
The default is 50, which in my case translates to maximum clock speed all the time. I set it to 90 sysctl dev.hwpstate_intel.0.epp=90, and the clocks immediately went below 1 GHz.
From the same Reddit post, I also learned about another useful tunable to reduce power consumption: hw.acpi.cpu.cx_lowest.
It sets the lowest Cx state to use for idling the CPU. A description of C-states can be found on Intel’s website. Allowing the CPU to go down to C3 seems like a reasonable idea, but it depends on your use case as the CPU may lose cache content when switching to C3. The default value for hw.acpi.cpu.cx_lowest is C1. I set it to C3: sysctl hw.acpi.cpu.cx_lowest=C3.These two settings drastically reduce power consumption of the system. To make them apply at startup, just add them to /etc/sysctl.conf. And don’t forget to disable powerd.
As a afterword: Is *powerd8 now obsolete? No, it can still be very useful in some cases as it is more flexible than the new driver. It can ignore nice processes or delay frequency changes for a few seconds to avoid reacting to short-lived processes.