hwmon: Remove amd_energy driver
Subsystems (2)
Guenter Roeck
maintainerPATCH 1/1 hwmon: Remove amd_energy driver
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.
---
Note:
This submission supersedes the set of patches which was limiting and randomizing RAPL register access.
Documentation/hwmon/amd_energy.rst | 119 --------- Documentation/hwmon/index.rst | 1 - MAINTAINERS | 7 - drivers/hwmon/Kconfig | 10 - drivers/hwmon/amd_energy.c | 379 ----------------------------- 5 files changed, 516 deletions(-) delete mode 100644 Documentation/hwmon/amd_energy.rst delete mode 100644 drivers/hwmon/amd_energy.c
Documentation/hwmon/amd_energy.rst deleted +0 -119
@@ -1,119 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 - -Kernel driver amd_energy -========================== - -Supported chips: - -* AMD Family 17h Processors: Model 30h - -* AMD Family 19h Processors: Model 01h - - Prefix: 'amd_energy' - - Addresses used: RAPL MSRs - - Datasheets: - - - Processor Programming Reference (PPR) for AMD Family 17h Model 01h, Revision B1 Processors - - https://developer.amd.com/wp-content/resources/55570-B1_PUB.zip - - - Preliminary Processor Programming Reference (PPR) for AMD Family 17h Model 31h, Revision B0 Processors - - https://developer.amd.com/wp-content/resources/56176_ppr_Family_17h_Model_71h_B0_pub_Rev_3.06.zip - -Author: Naveen Krishna Chatradhi <[email protected]> - -Description ------------ - -The Energy driver exposes the energy counters that are -reported via the Running Average Power Limit (RAPL) -Model-specific Registers (MSRs) via the hardware monitor -(HWMON) sysfs interface. - -1. Power, Energy and Time Units - MSR_RAPL_POWER_UNIT/ C001_0299: - shared with all cores in the socket - -2. Energy consumed by each Core - MSR_CORE_ENERGY_STATUS/ C001_029A: - 32-bitRO, Accumulator, core-level power reporting - -3. Energy consumed by Socket - MSR_PACKAGE_ENERGY_STATUS/ C001_029B: - 32-bitRO, Accumulator, socket-level power reporting, - shared with all cores in socket - -These registers are updated every 1ms and cleared on -reset of the system. - -Note: If SMT is enabled, Linux enumerates all threads as cpus. -Since, the energy status registers are accessed at core level, -reading those registers from the sibling threads would result -in duplicate values. Hence, energy counter entries are not -populated for the siblings. - -Energy Caluclation ------------------- - -Energy information (in Joules) is based on the multiplier, -1/2^ESU; where ESU is an unsigned integer read from -MSR_RAPL_POWER_UNIT register. Default value is 10000b, -indicating energy status unit is 15.3 micro-Joules increment. - -Reported values are scaled as per the formula - -scaled value = ((1/2^ESU) * (Raw value) * 1000000UL) in uJoules - -Users calculate power for a given domain by calculating - dEnergy/dTime for that domain. - -Energy accumulation --------------------------- - -Current, Socket energy status register is 32bit, assuming a 240W -2P system, the register would wrap around in - - 2^32*15.3 e-6/240 * 2 = 547.60833024 secs to wrap(~9 mins) - -The Core energy register may wrap around after several days. - -To improve the wrap around time, a kernel thread is implemented -to accumulate the socket energy counters and one core energy counter -per run to a respective 64-bit counter. The kernel thread starts -running during probe, wakes up every 100secs and stops running -when driver is removed. - -Frequency of the accumulator thread is set during the probe -based on the chosen energy unit resolution. For example -A. fine grain (1.625 micro J) -B. course grain (0.125 milli J) - -A socket and core energy read would return the current register -value added to the respective energy accumulator. - -Sysfs attributes ----------------- - -=============== ======== ===================================== -Attribute Label Description -=============== ======== ===================================== - -* For index N between [1] and [nr_cpus] - -=============== ======== ====================================== -energy[N]_input EcoreX Core Energy X = [0] to [nr_cpus - 1] - Measured input core energy -=============== ======== ====================================== - -* For N between [nr_cpus] and [nr_cpus + nr_socks] - -=============== ======== ====================================== -energy[N]_input EsocketX Socket Energy X = [0] to [nr_socks -1] - Measured input socket energy -=============== ======== ====================================== - -Note: To address CVE-2020-12912, the visibility of the energy[N]_input -attributes is restricted to owner and groups only.
Documentation/hwmon/index.rst +0 -1
@@ -39,7 +39,6 @@ Hardware Monitoring Kernel Drivers adt7475 aht10 amc6821 - amd_energy asb100 asc7621 aspeed-pwm-tacho
MAINTAINERS +0 -7
@@ -870,13 +870,6 @@ S: Supported T: git git://people.freedesktop.org/~agd5f/linux F: drivers/gpu/drm/amd/display/ -AMD ENERGY DRIVER -M: Naveen Krishna Chatradhi <[email protected]> -L: [email protected] -S: Maintained -F: Documentation/hwmon/amd_energy.rst -F: drivers/hwmon/amd_energy.c - AMD FAM15H PROCESSOR POWER MONITORING DRIVER M: Huang Rui <[email protected]> L: [email protected]
drivers/hwmon/Kconfig +0 -10
@@ -321,16 +321,6 @@ config SENSORS_FAM15H_POWER This driver can also be built as a module. If so, the module will be called fam15h_power. -config SENSORS_AMD_ENERGY - tristate "AMD RAPL MSR based Energy driver" - depends on X86 - help - If you say yes here you get support for core and package energy - sensors, based on RAPL MSR for AMD family 17h and above CPUs. - - This driver can also be built as a module. If so, the module - will be called as amd_energy. - config SENSORS_APPLESMC tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" depends on INPUT && X86
drivers/hwmon/amd_energy.c deleted +0 -379
379 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 15 lines · Guenter Roeck
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_energydriver 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.
Quoted 7 lines
Cc Naveen Krishna Chatradhi <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
Note:
This submission supersedes the set of patches which was limiting and randomizing RAPL register access.
Sad, maybe AMD will fix their hardware someday :(