The New AMD Energy Driver Is Working Out Well On Linux For Per-Socket/Core Reporting
CPU energy/power reporting is something that I and many other Linux users have long wanted to see under Linux for Zen CPUs, since it's exposed after all on Windows with Ryzen Master and other software. In the past AMD also maintained the "fam15h_power" driver for power reporting back on Bulldozer CPUs. But until Google sent out RAPL Zen patches recently and this "amd_energy" driver was then sent out by AMD engineers, there wasn't much public activity on getting this capability for existing Zen processors. There has also been the out-of-tree "Zenpower" driver for offering this based on public MSR data for Zen, albeit that driver isn't mainline, not maintained by AMD, and conflicts with k10temp when loading.
Now this amd_energy driver is queued in hwmon-next ahead of the Linux 5.8 merge window, I've been tested out this driver and it has worked out fairly well. For those wanting to give it a whirl but not feeling like spinning your own kernel from source using the patches, here is an Ubuntu x86_64 kernel build as of the latest hwmon-next branch that I built for the amd_energy testing.
This amd_energy driver has been working out well so far for the per-core and per-socket energy reporting, finally! While Intel CPUs expose their energy usage under /sys/class/powercap/intel-rapl, the amd_energy metrics are exposed as a conventional hwmon driver.
A test run with the Threadripper 3970X above... The latest Phoronix Test Suite Git code also has support for reading the amd_energy data now as well for calculating and exposing total CPU power consumption reporting. That addition is in Git for next quarter's Phoronix Test Suite 9.8 release.
So far so good on trying the Linux amd_energy driver with different CPUs. This driver will debut official with Linux 5.8, which should be out as stable in August, but if you are comfortable doing so feel free to try hwmon-next to help ensure this driver is in great shape for finally exposing AMD Zen CPU energy data on the mainline kernel. This new driver plus the recent k10temp thermal reporting improvements (Linux 5.6+) have the recent AMD processors now in good shape on the sensor front under Linux.