Show Your Support: Have you heard of Phoronix Premium? It's what complements advertisements on this site for our premium ad-free service. For less than $4 USD per month, you can help support our site while the funds generated allow us to keep doing Linux hardware reviews, performance benchmarking, maintain our community forums, and much more.
AMD Energy Monitoring Driver Slated To Be Removed From The 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.