Documentation/driver-api/thermal/cpu-cooling-api.rst GitHub 원문 ↗

Linux 6.18.37 · Driver API

CPU Cooling APIs How To

CPUFreq cooling device 등록·해제와 OPP·DVFS 기반 dynamic power model을 설명하는 한국어 전문 번역입니다.

Source pathDocumentation/driver-api/thermal/cpu-cooling-api.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

cpu-cooling-api.rst:1-107

Generic CPU cooling API는 CPUFreq cooling device를 일반 또는 Device Tree 경로로 등록하고 해제합니다. Power-aware cooling은 OPP·frequency table·utilisation·DVFS를 사용하며 execution behavior를 capacitance 상수로 단순화한 dynamic power model을 제공합니다.

CPU cooling API 구성
원문 줄핵심 내용
1-17CPU cooling registration 개요와 trip binding
18-49일반·Device Tree CPUFreq cooling 등록
50-57Cooling device 등록 해제
58-82Power model 전제와 주요 요인
83-107Dynamic power equation과 reference coefficient

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 =======================
2 CPU cooling APIs How To
3 =======================
4
5 Written by Amit Daniel Kachhap <amit.kachhap@linaro.org>
6
7 Updated: 6 Jan 2015
8
9 Copyright (c) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
10
11 0. Introduction
12 ===============
13
14 The generic cpu cooling(freq clipping) provides registration/unregistration APIs
15 to the caller. The binding of the cooling devices to the trip point is left for
16 the user. The registration APIs returns the cooling device pointer.
17
18 1. cpu cooling APIs
19 ===================
20
21 1.1 cpufreq registration/unregistration APIs
22 --------------------------------------------
23
24 ::
25
26 struct thermal_cooling_device
27 *cpufreq_cooling_register(struct cpumask *clip_cpus)
28
29 This interface function registers the cpufreq cooling device with the name
30 "thermal-cpufreq-%x". This api can support multiple instances of cpufreq
31 cooling devices.
32
33 clip_cpus:
34 cpumask of cpus where the frequency constraints will happen.
35
36 ::
37
38 struct thermal_cooling_device
39 *of_cpufreq_cooling_register(struct cpufreq_policy *policy)
40
41 This interface function registers the cpufreq cooling device with
42 the name "thermal-cpufreq-%x" linking it with a device tree node, in
43 order to bind it via the thermal DT code. This api can support multiple
44 instances of cpufreq cooling devices.
45
46 policy:
47 CPUFreq policy.
48
49
50 ::
51
52 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
53
54 This interface function unregisters the "thermal-cpufreq-%x" cooling device.
55
56 cdev: Cooling device pointer which has to be unregistered.
57
58 2. Power models
59 ===============
60
61 The power API registration functions provide a simple power model for
62 CPUs. The current power is calculated as dynamic power (static power isn't
63 supported currently). This power model requires that the operating-points of
64 the CPUs are registered using the kernel's opp library and the
65 `cpufreq_frequency_table` is assigned to the `struct device` of the
66 cpu. If you are using CONFIG_CPUFREQ_DT then the
67 `cpufreq_frequency_table` should already be assigned to the cpu
68 device.
69
70 The dynamic power consumption of a processor depends on many factors.
71 For a given processor implementation the primary factors are:
72
73 - The time the processor spends running, consuming dynamic power, as
74 compared to the time in idle states where dynamic consumption is
75 negligible. Herein we refer to this as 'utilisation'.
76 - The voltage and frequency levels as a result of DVFS. The DVFS
77 level is a dominant factor governing power consumption.
78 - In running time the 'execution' behaviour (instruction types, memory
79 access patterns and so forth) causes, in most cases, a second order
80 variation. In pathological cases this variation can be significant,
81 but typically it is of a much lesser impact than the factors above.
82
83 A high level dynamic power consumption model may then be represented as::
84
85 Pdyn = f(run) * Voltage^2 * Frequency * Utilisation
86
87 f(run) here represents the described execution behaviour and its
88 result has a units of Watts/Hz/Volt^2 (this often expressed in
89 mW/MHz/uVolt^2)
90
91 The detailed behaviour for f(run) could be modelled on-line. However,
92 in practice, such an on-line model has dependencies on a number of
93 implementation specific processor support and characterisation
94 factors. Therefore, in initial implementation that contribution is
95 represented as a constant coefficient. This is a simplification
96 consistent with the relative contribution to overall power variation.
97
98 In this simplified representation our model becomes::
99
100 Pdyn = Capacitance * Voltage^2 * Frequency * Utilisation
101
102 Where `capacitance` is a constant that represents an indicative
103 running time dynamic power coefficient in fundamental units of
104 mW/MHz/uVolt^2. Typical values for mobile CPUs might lie in range
105 from 100 to 500. For reference, the approximate values for the SoC in
106 ARM's Juno Development Platform are 530 for the Cortex-A57 cluster and
107 140 for the Cortex-A53 cluster.
108

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를 반환합니다.

Generic CPU cooling lifecycle
CallerRegister CPU cooling device`thermal_cooling_device *`
User or platform thermal setupBind cooling deviceThermal trip point
CallerUnregister cooling device

API는 device 등록을 제공하고 trip binding은 caller가 구성합니다.

=======================
CPU cooling APIs How To
=======================

Written by Amit Daniel Kachhap <amit.kachhap@linaro.org>

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-35

CPU 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입니다.

cpufreq_cooling_register 계약
항목내용
Prototype`struct thermal_cooling_device *cpufreq_cooling_register(struct cpumask *clip_cpus)`
Device name`thermal-cpufreq-%x`
Multiple instances지원
`clip_cpus`Frequency constraint 대상 CPU mask

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입니다.

of_cpufreq_cooling_register 계약
항목내용
Prototype`struct thermal_cooling_device *of_cpufreq_cooling_register(struct cpufreq_policy *policy)`
Device name`thermal-cpufreq-%x`
DT integrationThermal DT code를 통한 binding
`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입니다.

CPUFreq cooling 해제
Registered `thermal_cooling_device *cdev``cpufreq_cooling_unregister(cdev)`Cooling device removed

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-82

Power 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입니다.

Dynamic power model 입력
요인영향
UtilisationRunning time 대비 idle time
Voltage and frequencyDVFS level, 지배적 power factor
Execution behaviorInstruction type·memory pattern의 2차 variation
OPP registrationKernel OPP library 필요
Frequency table`cpufreq_frequency_table`을 CPU device에 연결

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-107

High-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입니다.

Dynamic power 수식 비교
Model수식계수 의미
High-level`Pdyn = f(run) × Voltage² × Frequency × Utilisation`Online execution behavior
Simplified`Pdyn = Capacitance × Voltage² × Frequency × Utilisation`Constant running-time coefficient
Mobile CPU referenceCapacitance 100..500`mW/MHz/uVolt²`
ARM Juno Cortex-A57530Cluster coefficient
ARM Juno Cortex-A53140Cluster coefficient

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.