hwmon: (fam15h_power) Add documentation for TDP and accumulated power algorithm
This patch adds the description to explain the TDP reporting mechanism and accumulated power algorithm. Signed-off-by: Huang Rui <ray.huang@amd.com> Cc: Borislav Petkov <bp@alien8.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>steinar/wifi_calib_4_9_kernel
parent
11bf0d78cc
commit
a6e232f786
|
@ -10,14 +10,22 @@ Supported chips:
|
||||||
Datasheets:
|
Datasheets:
|
||||||
BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors
|
BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors
|
||||||
BIOS and Kernel Developer's Guide (BKDG) For AMD Family 16h Processors
|
BIOS and Kernel Developer's Guide (BKDG) For AMD Family 16h Processors
|
||||||
|
AMD64 Architecture Programmer's Manual Volume 2: System Programming
|
||||||
|
|
||||||
Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
|
Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
|
||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
1) Processor TDP (Thermal design power)
|
||||||
|
|
||||||
|
Given a fixed frequency and voltage, the power consumption of a
|
||||||
|
processor varies based on the workload being executed. Derated power
|
||||||
|
is the power consumed when running a specific application. Thermal
|
||||||
|
design power (TDP) is an example of derated power.
|
||||||
|
|
||||||
This driver permits reading of registers providing power information
|
This driver permits reading of registers providing power information
|
||||||
of AMD Family 15h and 16h processors.
|
of AMD Family 15h and 16h processors via TDP algorithm.
|
||||||
|
|
||||||
For AMD Family 15h and 16h processors the following power values can
|
For AMD Family 15h and 16h processors the following power values can
|
||||||
be calculated using different processor northbridge function
|
be calculated using different processor northbridge function
|
||||||
|
@ -37,3 +45,58 @@ This driver provides ProcessorPwrWatts and CurrPwrWatts:
|
||||||
On multi-node processors the calculated value is for the entire
|
On multi-node processors the calculated value is for the entire
|
||||||
package and not for a single node. Thus the driver creates sysfs
|
package and not for a single node. Thus the driver creates sysfs
|
||||||
attributes only for internal node0 of a multi-node processor.
|
attributes only for internal node0 of a multi-node processor.
|
||||||
|
|
||||||
|
2) Accumulated Power Mechanism
|
||||||
|
|
||||||
|
This driver also introduces an algorithm that should be used to
|
||||||
|
calculate the average power consumed by a processor during a
|
||||||
|
measurement interval Tm. The feature of accumulated power mechanism is
|
||||||
|
indicated by CPUID Fn8000_0007_EDX[12].
|
||||||
|
|
||||||
|
* Tsample: compute unit power accumulator sample period
|
||||||
|
* Tref: the PTSC counter period
|
||||||
|
* PTSC: performance timestamp counter
|
||||||
|
* N: the ratio of compute unit power accumulator sample period to the
|
||||||
|
PTSC period
|
||||||
|
* Jmax: max compute unit accumulated power which is indicated by
|
||||||
|
MaxCpuSwPwrAcc MSR C001007b
|
||||||
|
* Jx/Jy: compute unit accumulated power which is indicated by
|
||||||
|
CpuSwPwrAcc MSR C001007a
|
||||||
|
* Tx/Ty: the value of performance timestamp counter which is indicated
|
||||||
|
by CU_PTSC MSR C0010280
|
||||||
|
* PwrCPUave: CPU average power
|
||||||
|
|
||||||
|
i. Determine the ratio of Tsample to Tref by executing CPUID Fn8000_0007.
|
||||||
|
N = value of CPUID Fn8000_0007_ECX[CpuPwrSampleTimeRatio[15:0]].
|
||||||
|
|
||||||
|
ii. Read the full range of the cumulative energy value from the new
|
||||||
|
MSR MaxCpuSwPwrAcc.
|
||||||
|
Jmax = value returned.
|
||||||
|
iii. At time x, SW reads CpuSwPwrAcc MSR and samples the PTSC.
|
||||||
|
Jx = value read from CpuSwPwrAcc and Tx = value read from
|
||||||
|
PTSC.
|
||||||
|
|
||||||
|
iv. At time y, SW reads CpuSwPwrAcc MSR and samples the PTSC.
|
||||||
|
Jy = value read from CpuSwPwrAcc and Ty = value read from
|
||||||
|
PTSC.
|
||||||
|
|
||||||
|
v. Calculate the average power consumption for a compute unit over
|
||||||
|
time period (y-x). Unit of result is uWatt.
|
||||||
|
if (Jy < Jx) // Rollover has occurred
|
||||||
|
Jdelta = (Jy + Jmax) - Jx
|
||||||
|
else
|
||||||
|
Jdelta = Jy - Jx
|
||||||
|
PwrCPUave = N * Jdelta * 1000 / (Ty - Tx)
|
||||||
|
|
||||||
|
This driver provides PwrCPUave and interval(default is 10 millisecond
|
||||||
|
and maximum is 1 second):
|
||||||
|
* power1_average (PwrCPUave)
|
||||||
|
* power1_average_interval (Interval)
|
||||||
|
|
||||||
|
The power1_average_interval can be updated at /etc/sensors3.conf file
|
||||||
|
as below:
|
||||||
|
|
||||||
|
chip "fam15h_power-*"
|
||||||
|
set power1_average_interval 0.01
|
||||||
|
|
||||||
|
Then save it with "sensors -s".
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* fam15h_power.c - AMD Family 15h processor power monitoring
|
* fam15h_power.c - AMD Family 15h processor power monitoring
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 Advanced Micro Devices, Inc.
|
* Copyright (c) 2011-2016 Advanced Micro Devices, Inc.
|
||||||
* Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
|
* Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue