요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
Kernel driver fam15h_power
==========================
Supported chips:
* AMD Family 15h Processors
* AMD Family 16h Processors
Prefix: 'fam15h_power'
Addresses scanned: PCI space
Datasheets:
- BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h 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>
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
of AMD Family 15h and 16h processors via TDP algorithm.
For AMD Family 15h and 16h processors the following power values can
be calculated using different processor northbridge function
registers:
* BasePwrWatts:
Specifies in watts the maximum amount of power
consumed by the processor for NB and logic external to the core.
* ProcessorPwrWatts:
Specifies in watts the maximum amount of power
the processor can support.
* CurrPwrWatts:
Specifies in watts the current amount of power being
consumed by the processor.
This driver provides ProcessorPwrWatts and CurrPwrWatts:
* power1_crit (ProcessorPwrWatts)
* power1_input (CurrPwrWatts)
On multi-node processors the calculated value is for the entire
package and not for a single node. Thus the driver creates sysfs
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".
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
AMD Family 15h·16h 지원
1-23이 드라이버는 AMD Family 15h와 Family 16h processor를 지원하며 prefix는 `fam15h_power`입니다. 장치는 PCI space에서 검색합니다.
참조 문서는 AMD Family 15h·16h BIOS and Kernel Developer's Guide(BKDG)와 AMD64 Architecture Programmer's Manual Volume 2: System Programming입니다. 저자는 Andreas Herrmann입니다.
Power register 해석에 사용하는 processor family와 자료입니다.
PCI northbridge 기능에서 package power 정보를 찾습니다.
Kernel driver fam15h_power
==========================
Supported chips:
* AMD Family 15h Processors
* AMD Family 16h Processors
Prefix: 'fam15h_power'
Addresses scanned: PCI space
Datasheets:
- BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h 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>
Description
-----------
TDP 기반 전력 값
24-58고정된 frequency와 voltage에서도 processor 소비 전력은 실행 workload에 따라 달라집니다. 특정 application을 실행할 때 소비하는 전력이 derated power이며 thermal design power(TDP)가 그 예입니다. 이 드라이버는 TDP algorithm을 통해 AMD Family 15h·16h power register를 읽습니다.
서로 다른 processor northbridge function register로 `BasePwrWatts`, `ProcessorPwrWatts`, `CurrPwrWatts`를 계산할 수 있습니다. `BasePwrWatts`는 core 외부의 NB와 logic이 소비하는 최대 전력, `ProcessorPwrWatts`는 processor가 지원할 수 있는 최대 전력, `CurrPwrWatts`는 현재 processor 소비 전력이며 모두 watt 단위입니다.
드라이버는 `ProcessorPwrWatts`를 `power1_crit`, `CurrPwrWatts`를 `power1_input`으로 제공합니다. Multi-node processor에서 계산값은 단일 node가 아니라 전체 package 값이므로 내부 node0에만 sysfs attribute를 만듭니다.
Register 기반 값과 hwmon attribute 대응입니다.
Northbridge register를 package 단위 hwmon 값으로 변환합니다.
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
of AMD Family 15h and 16h processors via TDP algorithm.
For AMD Family 15h and 16h processors the following power values can
be calculated using different processor northbridge function
registers:
* BasePwrWatts:
Specifies in watts the maximum amount of power
consumed by the processor for NB and logic external to the core.
* ProcessorPwrWatts:
Specifies in watts the maximum amount of power
the processor can support.
* CurrPwrWatts:
Specifies in watts the current amount of power being
consumed by the processor.
This driver provides ProcessorPwrWatts and CurrPwrWatts:
* power1_crit (ProcessorPwrWatts)
* power1_input (CurrPwrWatts)
On multi-node processors the calculated value is for the entire
package and not for a single node. Thus the driver creates sysfs
attributes only for internal node0 of a multi-node processor.
Accumulated Power Mechanism 용어
59-92드라이버는 측정 구간 `Tm` 동안 processor가 소비한 평균 전력을 계산하는 accumulated power mechanism algorithm도 제공합니다. 이 기능의 존재는 `CPUID Fn8000_0007_EDX[12]`로 확인합니다.
`Tsample`은 compute unit power accumulator sample period, `Tref`는 PTSC counter period, `PTSC`는 performance timestamp counter입니다. `N`은 Tsample과 PTSC period의 비율입니다.
`Jmax`는 `MaxCpuSwPwrAcc MSR C001007b`가 나타내는 compute unit accumulated power 최댓값입니다. `Jx`·`Jy`는 `CpuSwPwrAcc MSR C001007a`에서 읽는 두 시점의 누적 전력이고, `Tx`·`Ty`는 `CU_PTSC MSR C0010280`에서 읽는 두 시점의 performance timestamp counter입니다. `PwrCPUave`는 CPU average power입니다.
평균 전력 계산에 쓰는 register와 시간 값입니다.
두 시점의 accumulator와 PTSC 차이를 함께 사용합니다.
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
평균 전력 계산식
93-118먼저 `CPUID Fn8000_0007`을 실행해 `Tsample/Tref` 비율을 정합니다. `N`은 `CPUID Fn8000_0007_ECX[CpuPwrSampleTimeRatio[15:0]]`의 값입니다. 이어 `MaxCpuSwPwrAcc`에서 누적 energy의 전체 범위를 읽어 `Jmax`로 둡니다.
시점 x에서 software가 `CpuSwPwrAcc`와 PTSC를 읽어 `Jx`, `Tx`를 얻고, 시점 y에서 같은 register를 읽어 `Jy`, `Ty`를 얻습니다.
`Jy < Jx`이면 accumulator rollover가 발생했으므로 `Jdelta = (Jy + Jmax) - Jx`, 그렇지 않으면 `Jdelta = Jy - Jx`입니다. Compute unit의 x~y 평균 전력은 micro-watt 단위로 `PwrCPUave = N * Jdelta * 1000 / (Ty - Tx)`입니다.
Rollover 여부에 따라 energy delta만 달라집니다.
CPUID 비율과 두 MSR sample로 구간 평균을 구합니다.
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)
Average power interval 설정
119-131드라이버는 `PwrCPUave`를 `power1_average`로, 측정 interval을 `power1_average_interval`로 제공합니다. 기본 interval은 10 millisecond이고 최댓값은 1 second입니다.
`/etc/sensors3.conf`에서 `chip `fam15h_power-*`` 항목에 `set power1_average_interval 0.01`을 넣어 interval을 갱신할 수 있습니다. 이후 `sensors -s`로 설정을 저장·적용합니다.
평균값과 측정 구간의 사용자 interface입니다.
sensors configuration을 통해 다음 평균 구간을 정합니다.
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".
요약·해설
fam15h_power.rst:1-131Northbridge power register와 두 시점의 accumulator·PTSC sample로 package 전력을 제공합니다.
원문 분량과 핵심 범위입니다.
장치 동작의 기본 순서입니다.