Google Posts Patches Allowing AMD Zen/Zen2 CPUs To Expose Power Usage On Linux Via RAPL
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.
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.
29 Comments