Linux support for Power Measurement Interfaces

This document describes Linux support for various power measurement interfaces, although it is primarily looking at ones that can be accessed via the "perf" tool, i.e. primarily Intel RAPL and AMD APM.

On-CPU power and energy measurements are available on many modern systems. In some cases these are just estimates (provided by embedded power models), other times there is actual power measurement happening. Linux is not always very consistent about how to export these interfaces, so for example there are at least three differed ways to get RAPL readings on recent kernels.

The "perf_event" column tells which upstream Linux kernel first supported the chip using the perf_event subsystem. The "hwmon" column says whether the results are available via the hwmon/lmsensors interface. The "powercap" column says whether there's a file under sysfs that exports the readings. The "PAPI" column says whether the current version of PAPI supports the readings.

I have a tool, rapl_read, and some more info on how to actually read these counters here.

There's a related list to this that lists when traditional perf counter support was added for CPUs here.


x86 AMD

AMD Fam17h support an MSR interface that is semi-compatible with RAPL (same register contents, but the MSR numbers are different).

Older AMD supports the "Application Power Management" (APM) interface. On older Family15h chips this is a value exported via the sensors interface that's the estimated TDP (thermal design power). See drivers/hwmon/fam15h_power.c, Documentation/hwmon/fam15h_power, arch/x86/events/amd/power.c and the BKDG.

Newer machines (starting with fam15h Excavator) also support a more RAPL-like interface that can give cumulative energy readings using perf.

Note that on my piledriver server system, by default the TDP values seem to read wrong (excessively high).

Also note that even if a processor model supports the feature, it is not necessarily implemented and you have to check the proper cpuid field to see if it *really* is supported. (i.e. my piledriver A10 system does not support this).

The accumulated power interface has some issues on my fam16h/mod30h system. The Power TSC seems to truncate at 24 bits (rather than 40) so the results are often wrong.

Name Family Model TDP Energy hwmon perf_event PAPI
Family 15h Bulldozer 21 1 Yes No 3.0 (512d1027a) no hwmon
Family 15h Piledriver 21 2 Yes No 3.0 ( 512d1027a) no hwmon
Family 15h Piledriver/Trinity 21 10, 13 Yes No no no hwmon
Family 15h Steamroller "Kaveri" 21 30h CRIT only No 3.17 (0a0039ad541) no hwmon
Family 15h Excavator "Carrizo" 21 60h-6fh Yes Yes 4.3 (5dc087254acf) 4.6 (c7ab62bfbe0) hwmon
Family 15h ???? 21 70h-7fh Yes Yes 4.5 (eff2a94598) no hwmon
Family 16h Jaguar 22 0 ? ? 3.10 (22e32f4f5) no hwmon
Family 16h Jaguar "Mullins" 22 30h Yes Maybe 3.18 (0bd52941586b3b) no hwmon
Family 17h Zen 23 * ? Yes no no rapl-msr

x86 Intel

Intel chips have RAPL (Running Average Power Limit). On most chips this is estimated power, although some server Haswell models apparently have actual power measurement due to onboard voltage regulation (which was discontinued on later models).

Linux support is via powercap/sysfs (as provided by drivers/powercap/intel_rapl.c) and perf_event (as provided by arch/x86/events/intel/rapl.c). Also users often access the relevant MSR registers directly via the /dev/msr or safe-msr interfaces.

Various values are provided, not all chips support all values. The "package" value is for one processor package (which may contain many cores; a system might have multiple packages). The PP0/"cores" value is power usage by all of the cores in the package (you cannot break down to individual cores). The PP1 value is the uncore, in non-server chips this often provides info for the integrated GPU. The "DRAM" value is for the DRAM in the system. The "Psys" value is the entire SoC (system on chip).

There's a lot of conflicting (or absent) info in the Intel documents so there are no guarantees that this info is complete.

Name Family Model package PP0 (usually cores) PP1 (usually GPU) DRAM PSys powercap perf_event PAPI
Sandybridge 6 42 Y Y Y N N 3.13 (2d281d8196) 3.14 (4788e5b4b23) yes
Sandy Bridge EP 6 45 Y Y N Y N 3.13 (2d281d8196) 3.14 (4788e5b4b23) yes
Ivy Bridge 6 58 Y Y Y N N 3.13 (2d281d8196) 3.14 (4788e5b4b23) yes
Ivy Bridge EP ("Ivy Town") 6 62 Y Y N Y N no 3.14 (4788e5b4b23) yes
Haswell 6 60 Y Y Y Y N 3.16 (a97ac35b5d9) 3.14 (4788e5b4b23) yes
Haswell ULT 6 69 Y Y Y Y N 3.13 (2d281d8196) 3.14 (7fd565e27547) yes
Haswell GT3E 6 70 Y Y Y Y N 4.6 (462d8083f) 4.6 (e1089602a3bf) yes
Haswell EP 6 63 Y ? N Y N 3.17 (64c7569c065) 4.1 (64552396010) yes
Broadwell 6 61 Y Y Y Y N 3.16 (a97ac35b5d9) 4.1 (44b11fee517) yes
Broadwell-H GT3E 6 71 Y Y Y Y N 4.3 (4e0bec9e83) 4.6 (7b0fd569303) yes
Broadwell-DE 6 86 Y Y Y Y N 3.19 (d72be771c5d) 4.7 (31b84310c79) yes
Broadwell EP 6 79 Y ? N Y N 4.1 (34dfa36c04c) 4.6 (7b0fd569303) yes
Skylake Mobile 6 78 Y Y Y Y Y 4.1 (5fa0fa4b01) 4.7 (dcee75b3b7f02) yes
Skylake Desktop H/S 6 94 Y Y Y Y Y 4.3 (2cac1f70) 4.7 (dcee75b3b7f02) yes
Skylake Server 6 85 Y Y N Y N 4.8??? 4.8 (348c5ac6c7dc11) yes
Kabylake 6 142,158 Y Y Y Y Y 4.7 (6c51cc0203) 4.11 (f2029b1e47) yes
Cannonlake 6 102 Y Y Y Y Y 4.17 (?) 4.17 (490d03e83da2) ?
Knights Landing 6 87 Y N N Y N 4.2 (6f066d4d2) 4.6 (4d120c535d6) yes
Knights Mill 6 133 Y N N Y N () 4.9 (36c4b6c14d20) yes
Atom Goldmont 6 92 Y Y Y Y N 4.4 (89e7b2553a) 4.9 (2668c6195685) yes
Atom Denverton 6 95 Y Y Y Y N () 4.14 (450a97893559354) yes
Atom Gemini Lake 6 122 Y Y Y Y N () 4.14 (450a97893559354) yes
Atom Airmont / Braswell 6 76 ? ? ? ? N 3.19 (74af752e4895) no no
Atom Tangier / Merrifield 6 74 ? ? ? ? N 3.19 (74af752e4895) no no
Atom Moorefield / Annidale 6 90 ? ? ? ? N 3.19 (74af752e4895) no no
Atom Silvermont / Valleyview 6 55 ? ? ? ? N 3.13 (ed93b71492d) no no

Back to the Linux/RAPL page