Google Posts Patches Allowing AMD Zen/Zen2 CPUs To Expose Power Usage On Linux Via RAPL

Written by Michael Larabel in AMD on 16 May 2020 at 12:00 AM EDT. 29 Comments
AMD
One of the long sought after features for AMD Zen (and Zen 2) processors on Linux has been the ability to monitor the CPU package power consumption on Linux, similar to what's long been available for Intel CPUs on Linux and similarly for older AMD Bulldozer era CPUs with a power monitoring driver. Now on Friday evening a patch series was posted by a Google engineer to provide this long sought after functionality.

Google engineer Stephane Eranian posted a patch series to expose the necessary hardware counters for reading the power usage on Linux and tie into the kernel's RAPL framework. The Running Average Power Limit "RAPL" interface was devised by Intel years ago and supported by their hardware for being able to read (and, in some cases, limit) the power consumption. The power usage is exposed via a PowerCap sysfs interface and via a perf interface.


With the patches posted by Google that come in at less than 60 lines of code, it allows finally being able to read the CPU power consumption based upon the data exposed via its counters. With the current patches, the energy package level consumption is exposed. Both Zen 1 and Zen 2 CPUs are supported.

It's great to see these patches finally materialize but long overdue especially with the AMD Windows software (Ryzen Master, et al) long exposing the power metrics. It's been a topic I've long brought up with AMD as an area to improve, similar to the AMD Zen thermal monitoring Linux driver support being another item left up to the community to tackle.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week