요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=======================
CPU cooling APIs How To
=======================
Written by Amit Daniel Kachhap <[email protected]>
Updated: 6 Jan 2015
Copyright (c) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
0. Introduction
===============
The generic cpu cooling(freq clipping) provides registration/unregistration APIs
to the caller. The binding of the cooling devices to the trip point is left for
the user. The registration APIs returns the cooling device pointer.
1. cpu cooling APIs
===================
1.1 cpufreq registration/unregistration APIs
--------------------------------------------
::
struct thermal_cooling_device
*cpufreq_cooling_register(struct cpumask *clip_cpus)
This interface function registers the cpufreq cooling device with the name
"thermal-cpufreq-%x". This api can support multiple instances of cpufreq
cooling devices.
clip_cpus:
cpumask of cpus where the frequency constraints will happen.
::
struct thermal_cooling_device
*of_cpufreq_cooling_register(struct cpufreq_policy *policy)
This interface function registers the cpufreq cooling device with
the name "thermal-cpufreq-%x" linking it with a device tree node, in
order to bind it via the thermal DT code. This api can support multiple
instances of cpufreq cooling devices.
policy:
CPUFreq policy.
::
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
This interface function unregisters the "thermal-cpufreq-%x" cooling device.
cdev: Cooling device pointer which has to be unregistered.
2. Power models
===============
The power API registration functions provide a simple power model for
CPUs. The current power is calculated as dynamic power (static power isn't
supported currently). This power model requires that the operating-points of
the CPUs are registered using the kernel's opp library and the
`cpufreq_frequency_table` is assigned to the `struct device` of the
cpu. If you are using CONFIG_CPUFREQ_DT then the
`cpufreq_frequency_table` should already be assigned to the cpu
device.
The dynamic power consumption of a processor depends on many factors.
For a given processor implementation the primary factors are:
- The time the processor spends running, consuming dynamic power, as
compared to the time in idle states where dynamic consumption is
negligible. Herein we refer to this as 'utilisation'.
- The voltage and frequency levels as a result of DVFS. The DVFS
level is a dominant factor governing power consumption.
- In running time the 'execution' behaviour (instruction types, memory
access patterns and so forth) causes, in most cases, a second order
variation. In pathological cases this variation can be significant,
but typically it is of a much lesser impact than the factors above.
A high level dynamic power consumption model may then be represented as::
Pdyn = f(run) * Voltage^2 * Frequency * Utilisation
f(run) here represents the described execution behaviour and its
result has a units of Watts/Hz/Volt^2 (this often expressed in
mW/MHz/uVolt^2)
The detailed behaviour for f(run) could be modelled on-line. However,
in practice, such an on-line model has dependencies on a number of
implementation specific processor support and characterisation
factors. Therefore, in initial implementation that contribution is
represented as a constant coefficient. This is a simplification
consistent with the relative contribution to overall power variation.
In this simplified representation our model becomes::
Pdyn = Capacitance * Voltage^2 * Frequency * Utilisation
Where `capacitance` is a constant that represents an indicative
running time dynamic power coefficient in fundamental units of
mW/MHz/uVolt^2. Typical values for mobile CPUs might lie in range
from 100 to 500. For reference, the approximate values for the SoC in
ARM's Juno Development Platform are 530 for the Cortex-A57 cluster and
140 for the Cortex-A53 cluster.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
CPU cooling API 개요
1-17이 CPU cooling API guide는 Amit Daniel Kachhap이 작성했고 2015년 1월 6일 갱신됐으며 Samsung Electronics의 2012년 copyright를 표시합니다.
Generic CPU cooling, 즉 frequency clipping 기능은 caller에게 cooling device 등록·해제 API를 제공합니다.
Cooling device를 thermal trip point에 bind하는 책임은 user에게 남겨 둡니다. Registration API는 등록된 cooling device pointer를 반환합니다.
API는 device 등록을 제공하고 trip binding은 caller가 구성합니다.
=======================
CPU cooling APIs How To
=======================
Written by Amit Daniel Kachhap <[email protected]>
Updated: 6 Jan 2015
Copyright (c) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
0. Introduction
===============
The generic cpu cooling(freq clipping) provides registration/unregistration APIs
to the caller. The binding of the cooling devices to the trip point is left for
the user. The registration APIs returns the cooling device pointer.
CPUFreq cooling device 등록
18-35CPU cooling API의 첫 interface는 `cpufreq_cooling_register(struct cpumask *clip_cpus)`입니다. `struct thermal_cooling_device *`를 반환합니다.
이 function은 `thermal-cpufreq-%x` 이름으로 CPUFreq cooling device를 등록하며 여러 CPUFreq cooling device instance를 지원합니다.
`clip_cpus`는 frequency constraint가 적용될 CPU의 cpumask입니다.
1. cpu cooling APIs
===================
1.1 cpufreq registration/unregistration APIs
--------------------------------------------
::
struct thermal_cooling_device
*cpufreq_cooling_register(struct cpumask *clip_cpus)
This interface function registers the cpufreq cooling device with the name
"thermal-cpufreq-%x". This api can support multiple instances of cpufreq
cooling devices.
clip_cpus:
cpumask of cpus where the frequency constraints will happen.
Device Tree 기반 CPUFreq cooling 등록
36-49`of_cpufreq_cooling_register(struct cpufreq_policy *policy)`도 `struct thermal_cooling_device *`를 반환합니다.
이 function은 `thermal-cpufreq-%x` 이름으로 CPUFreq cooling device를 등록하면서 device tree node와 연결하여 thermal DT code가 bind할 수 있게 합니다.
여러 CPUFreq cooling device instance를 지원하며 `policy` 인자는 CPUFreq policy입니다.
::
struct thermal_cooling_device
*of_cpufreq_cooling_register(struct cpufreq_policy *policy)
This interface function registers the cpufreq cooling device with
the name "thermal-cpufreq-%x" linking it with a device tree node, in
order to bind it via the thermal DT code. This api can support multiple
instances of cpufreq cooling devices.
policy:
CPUFreq policy.
CPUFreq cooling device 해제
50-57`cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)`는 `thermal-cpufreq-%x` cooling device를 등록 해제합니다.
`cdev`는 해제할 cooling device pointer입니다.
Registration API가 반환한 device pointer를 unregister에 전달합니다.
::
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
This interface function unregisters the "thermal-cpufreq-%x" cooling device.
cdev: Cooling device pointer which has to be unregistered.
CPU dynamic power model의 전제와 요인
58-82Power API registration function은 CPU를 위한 단순 power model을 제공합니다. 현재 power는 dynamic power로 계산하며 static power는 아직 지원하지 않습니다.
이 model을 사용하려면 CPU operating point를 kernel OPP library로 등록하고 `cpufreq_frequency_table`을 CPU의 `struct device`에 연결해야 합니다.
`CONFIG_CPUFREQ_DT`를 사용한다면 `cpufreq_frequency_table`은 이미 CPU device에 연결되어 있어야 합니다.
Processor dynamic power consumption의 첫 주요 요인은 실행 상태에서 dynamic power를 소비하는 시간과 dynamic consumption이 무시할 만한 idle state 시간의 비율인 utilisation입니다.
두 번째는 DVFS가 정하는 voltage와 frequency level이며 power consumption을 지배하는 요인입니다.
세 번째는 실행 중 instruction type, memory access pattern 같은 execution behavior입니다. 병적인 경우 영향이 클 수 있지만 보통 앞의 두 요인보다 작은 second-order variation입니다.
2. Power models
===============
The power API registration functions provide a simple power model for
CPUs. The current power is calculated as dynamic power (static power isn't
supported currently). This power model requires that the operating-points of
the CPUs are registered using the kernel's opp library and the
`cpufreq_frequency_table` is assigned to the `struct device` of the
cpu. If you are using CONFIG_CPUFREQ_DT then the
`cpufreq_frequency_table` should already be assigned to the cpu
device.
The dynamic power consumption of a processor depends on many factors.
For a given processor implementation the primary factors are:
- The time the processor spends running, consuming dynamic power, as
compared to the time in idle states where dynamic consumption is
negligible. Herein we refer to this as 'utilisation'.
- The voltage and frequency levels as a result of DVFS. The DVFS
level is a dominant factor governing power consumption.
- In running time the 'execution' behaviour (instruction types, memory
access patterns and so forth) causes, in most cases, a second order
variation. In pathological cases this variation can be significant,
but typically it is of a much lesser impact than the factors above.
Dynamic power equation과 capacitance 계수
83-107High-level dynamic power consumption model은 `Pdyn = f(run) * Voltage^2 * Frequency * Utilisation`으로 표현합니다.
여기서 `f(run)`은 execution behavior를 나타내며 결과 단위는 Watts/Hz/Volt²입니다. 흔히 `mW/MHz/uVolt²`로 표현합니다.
`f(run)`의 세부 동작을 online으로 model할 수 있지만, 실제 online model은 implementation-specific processor support와 characterization 요인에 의존합니다.
초기 구현에서는 전체 power variation에 대한 상대적 기여가 작다는 점에 맞춰 이 항을 constant coefficient로 단순화합니다.
단순화한 식은 `Pdyn = Capacitance * Voltage^2 * Frequency * Utilisation`입니다. `capacitance`는 실행 중 dynamic power를 나타내는 상수 계수이며 기본 단위는 `mW/MHz/uVolt²`입니다.
Mobile CPU의 typical capacitance 값은 100~500 범위입니다. ARM Juno Development Platform SoC의 근사값은 Cortex-A57 cluster가 530, Cortex-A53 cluster가 140입니다.
A high level dynamic power consumption model may then be represented as::
Pdyn = f(run) * Voltage^2 * Frequency * Utilisation
f(run) here represents the described execution behaviour and its
result has a units of Watts/Hz/Volt^2 (this often expressed in
mW/MHz/uVolt^2)
The detailed behaviour for f(run) could be modelled on-line. However,
in practice, such an on-line model has dependencies on a number of
implementation specific processor support and characterisation
factors. Therefore, in initial implementation that contribution is
represented as a constant coefficient. This is a simplification
consistent with the relative contribution to overall power variation.
In this simplified representation our model becomes::
Pdyn = Capacitance * Voltage^2 * Frequency * Utilisation
Where `capacitance` is a constant that represents an indicative
running time dynamic power coefficient in fundamental units of
mW/MHz/uVolt^2. Typical values for mobile CPUs might lie in range
from 100 to 500. For reference, the approximate values for the SoC in
ARM's Juno Development Platform are 530 for the Cortex-A57 cluster and
140 for the Cortex-A53 cluster.
요약과 해설
cpu-cooling-api.rst:1-107Generic CPU cooling API는 CPUFreq cooling device를 일반 또는 Device Tree 경로로 등록하고 해제합니다. Power-aware cooling은 OPP·frequency table·utilisation·DVFS를 사용하며 execution behavior를 capacitance 상수로 단순화한 dynamic power model을 제공합니다.