AMD Energy Monitoring Driver Slated To Be Removed From The Linux Kernel

Written by Michael Larabel in AMD on 21 April 2021 at 01:39 PM EDT. 43 Comments
AMD
As a surprise and big disappointment, the "amd_energy" driver that exposes AMD EPYC server CPU energy monitoring metrics under Linux for being able to calculate the per-core and package power consumption and more is now set to be removed from the mainline Linux kernel.

The removal of this driver sadly isn't for a case like it's being replaced by some superior solution but rather a disagreement in the exposing of the energy data.

Last year as a result of the PLATYPUS power attack Linux restricted access to such data to root/privileged users.

Linux hardware monitoring "HWMON" subsystem maintainer Guenter Roeck recently came up with an approach to allow for non-root monitoring by slightly limiting and randomizing the amd_energy access so it still should be useful for monitoring but not accurate enough for carry out a PLATYPUS style attack on AMD processors.

That amd_energy change was queued up in hwmon-next and then slated for appearing in the upcoming Linux 5.13 cycle. But now it turns out that AMD is against this change and as a result this driver is slated for removal from the mainline tree.

Roeck decided to "remove amd_energy driver." He reasoned in the commit:
Commit 60268b0e8258 ("hwmon: (amd_energy) modify the visibility of the counters") restricted visibility of AMD energy counters to work around a side-channel attack using energy data to determine which instructions are executed. The attack is described in 'PLATYPUS: Software-based Power Side-Channel Attacks on x86'. It relies on quick and accurate energy readings.

This change made the counters provided by the amd_energy driver effectively unusable for non-provileged users. However, unprivileged read access is the whole point of hardware monitoring attributes.

An attempt to remedy the situation by limiting and randomizing access to chip registers was rejected by AMD. Since the driver is for all practical purposes unusable, remove it.

As a heavy user of amd_energy myself when testing AMD EPYC processors, it's sad to see this happen and the driver outright now set to be removed with the next kernel cycle as opposed to just keeping the current (unfortunate) behavior of root-only access. Or, alternatively, allowing the unrestricted but limited/slightly-randomized access behavior via a module option. It's also a shame that at first the amd_energy driver did work on AMD Ryzen processors only to be limited after the fact to EPYC processors.

So assuming no last minute change of course, Linux 5.13 is set to remove this driver and we're back to the situation of not being able to make use of the AMD energy counters on Linux with a mainline kernel -- short of using out-of-tree solutions like Zenpower where your mileage may vary, etc.
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