Based on kernel version 4.16.1. Page generated on 2018-04-09 11:53 EST.
1 Kernel driver fam15h_power 2 ========================== 3 4 Supported chips: 5 * AMD Family 15h Processors 6 * AMD Family 16h Processors 7 8 Prefix: 'fam15h_power' 9 Addresses scanned: PCI space 10 Datasheets: 11 BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors 12 BIOS and Kernel Developer's Guide (BKDG) For AMD Family 16h Processors 13 AMD64 Architecture Programmer's Manual Volume 2: System Programming 14 15 Author: Andreas Herrmann <herrmann.der.user@googlemail.com> 16 17 Description 18 ----------- 19 20 1) Processor TDP (Thermal design power) 21 22 Given a fixed frequency and voltage, the power consumption of a 23 processor varies based on the workload being executed. Derated power 24 is the power consumed when running a specific application. Thermal 25 design power (TDP) is an example of derated power. 26 27 This driver permits reading of registers providing power information 28 of AMD Family 15h and 16h processors via TDP algorithm. 29 30 For AMD Family 15h and 16h processors the following power values can 31 be calculated using different processor northbridge function 32 registers: 33 34 * BasePwrWatts: Specifies in watts the maximum amount of power 35 consumed by the processor for NB and logic external to the core. 36 * ProcessorPwrWatts: Specifies in watts the maximum amount of power 37 the processor can support. 38 * CurrPwrWatts: Specifies in watts the current amount of power being 39 consumed by the processor. 40 41 This driver provides ProcessorPwrWatts and CurrPwrWatts: 42 * power1_crit (ProcessorPwrWatts) 43 * power1_input (CurrPwrWatts) 44 45 On multi-node processors the calculated value is for the entire 46 package and not for a single node. Thus the driver creates sysfs 47 attributes only for internal node0 of a multi-node processor. 48 49 2) Accumulated Power Mechanism 50 51 This driver also introduces an algorithm that should be used to 52 calculate the average power consumed by a processor during a 53 measurement interval Tm. The feature of accumulated power mechanism is 54 indicated by CPUID Fn8000_0007_EDX[12]. 55 56 * Tsample: compute unit power accumulator sample period 57 * Tref: the PTSC counter period 58 * PTSC: performance timestamp counter 59 * N: the ratio of compute unit power accumulator sample period to the 60 PTSC period 61 * Jmax: max compute unit accumulated power which is indicated by 62 MaxCpuSwPwrAcc MSR C001007b 63 * Jx/Jy: compute unit accumulated power which is indicated by 64 CpuSwPwrAcc MSR C001007a 65 * Tx/Ty: the value of performance timestamp counter which is indicated 66 by CU_PTSC MSR C0010280 67 * PwrCPUave: CPU average power 68 69 i. Determine the ratio of Tsample to Tref by executing CPUID Fn8000_0007. 70 N = value of CPUID Fn8000_0007_ECX[CpuPwrSampleTimeRatio[15:0]]. 71 72 ii. Read the full range of the cumulative energy value from the new 73 MSR MaxCpuSwPwrAcc. 74 Jmax = value returned. 75 iii. At time x, SW reads CpuSwPwrAcc MSR and samples the PTSC. 76 Jx = value read from CpuSwPwrAcc and Tx = value read from 77 PTSC. 78 79 iv. At time y, SW reads CpuSwPwrAcc MSR and samples the PTSC. 80 Jy = value read from CpuSwPwrAcc and Ty = value read from 81 PTSC. 82 83 v. Calculate the average power consumption for a compute unit over 84 time period (y-x). Unit of result is uWatt. 85 if (Jy < Jx) // Rollover has occurred 86 Jdelta = (Jy + Jmax) - Jx 87 else 88 Jdelta = Jy - Jx 89 PwrCPUave = N * Jdelta * 1000 / (Ty - Tx) 90 91 This driver provides PwrCPUave and interval(default is 10 millisecond 92 and maximum is 1 second): 93 * power1_average (PwrCPUave) 94 * power1_average_interval (Interval) 95 96 The power1_average_interval can be updated at /etc/sensors3.conf file 97 as below: 98 99 chip "fam15h_power-*" 100 set power1_average_interval 0.01 101 102 Then save it with "sensors -s".