← Documents Documentation/power/powercap/powercap.rst GitHub 원문 ↗

Linux 6.18.37 · Power

Power Capping Framework

Control type과 계층형 power zone, monitoring·constraint sysfs attribute, Intel RAPL 예제와 client-driver object 수명을 설명합니다.

Source pathDocumentation/power/powercap/powercap.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

powercap.rst:1-262

Powercap은 driver별 power-limiting 방법을 control type으로, 제어 대상을 계층형 zone으로 노출합니다. Parent zone은 장치 집합을 함께 제한하고 subzone은 세부 제어를 제공하며, monitoring과 constraint attribute는 단위와 access mode가 표준화됩니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 =======================
2 Power Capping Framework
3 =======================
4
5 The power capping framework provides a consistent interface between the kernel
6 and the user space that allows power capping drivers to expose the settings to
7 user space in a uniform way.
8
9 Terminology
10 ===========
11
12 The framework exposes power capping devices to user space via sysfs in the
13 form of a tree of objects. The objects at the root level of the tree represent
14 'control types', which correspond to different methods of power capping. For
15 example, the intel-rapl control type represents the Intel "Running Average
16 Power Limit" (RAPL) technology, whereas the 'idle-injection' control type
17 corresponds to the use of idle injection for controlling power.
18
19 Power zones represent different parts of the system, which can be controlled and
20 monitored using the power capping method determined by the control type the
21 given zone belongs to. They each contain attributes for monitoring power, as
22 well as controls represented in the form of power constraints. If the parts of
23 the system represented by different power zones are hierarchical (that is, one
24 bigger part consists of multiple smaller parts that each have their own power
25 controls), those power zones may also be organized in a hierarchy with one
26 parent power zone containing multiple subzones and so on to reflect the power
27 control topology of the system. In that case, it is possible to apply power
28 capping to a set of devices together using the parent power zone and if more
29 fine grained control is required, it can be applied through the subzones.
30
31
32 Example sysfs interface tree::
33
34 /sys/devices/virtual/powercap
35 └──intel-rapl
36 ├──intel-rapl:0
37 │   ├──constraint_0_name
38 │   ├──constraint_0_power_limit_uw
39 │   ├──constraint_0_time_window_us
40 │   ├──constraint_1_name
41 │   ├──constraint_1_power_limit_uw
42 │   ├──constraint_1_time_window_us
43 │   ├──device -> ../../intel-rapl
44 │   ├──energy_uj
45 │   ├──intel-rapl:0:0
46 │   │   ├──constraint_0_name
47 │   │   ├──constraint_0_power_limit_uw
48 │   │   ├──constraint_0_time_window_us
49 │   │   ├──constraint_1_name
50 │   │   ├──constraint_1_power_limit_uw
51 │   │   ├──constraint_1_time_window_us
52 │   │   ├──device -> ../../intel-rapl:0
53 │   │   ├──energy_uj
54 │   │   ├──max_energy_range_uj
55 │   │   ├──name
56 │   │   ├──enabled
57 │   │   ├──power
58 │   │   │   ├──async
59 │   │   │   []
60 │   │   ├──subsystem -> ../../../../../../class/power_cap
61 │   │   └──uevent
62 │   ├──intel-rapl:0:1
63 │   │   ├──constraint_0_name
64 │   │   ├──constraint_0_power_limit_uw
65 │   │   ├──constraint_0_time_window_us
66 │   │   ├──constraint_1_name
67 │   │   ├──constraint_1_power_limit_uw
68 │   │   ├──constraint_1_time_window_us
69 │   │   ├──device -> ../../intel-rapl:0
70 │   │   ├──energy_uj
71 │   │   ├──max_energy_range_uj
72 │   │   ├──name
73 │   │   ├──enabled
74 │   │   ├──power
75 │   │   │   ├──async
76 │   │   │   []
77 │   │   ├──subsystem -> ../../../../../../class/power_cap
78 │   │   └──uevent
79 │   ├──max_energy_range_uj
80 │   ├──max_power_range_uw
81 │   ├──name
82 │   ├──enabled
83 │   ├──power
84 │   │   ├──async
85 │   │   []
86 │   ├──subsystem -> ../../../../../class/power_cap
87 │   ├──enabled
88 │   ├──uevent
89 ├──intel-rapl:1
90 │   ├──constraint_0_name
91 │   ├──constraint_0_power_limit_uw
92 │   ├──constraint_0_time_window_us
93 │   ├──constraint_1_name
94 │   ├──constraint_1_power_limit_uw
95 │   ├──constraint_1_time_window_us
96 │   ├──device -> ../../intel-rapl
97 │   ├──energy_uj
98 │   ├──intel-rapl:1:0
99 │   │   ├──constraint_0_name
100 │   │   ├──constraint_0_power_limit_uw
101 │   │   ├──constraint_0_time_window_us
102 │   │   ├──constraint_1_name
103 │   │   ├──constraint_1_power_limit_uw
104 │   │   ├──constraint_1_time_window_us
105 │   │   ├──device -> ../../intel-rapl:1
106 │   │   ├──energy_uj
107 │   │   ├──max_energy_range_uj
108 │   │   ├──name
109 │   │   ├──enabled
110 │   │   ├──power
111 │   │   │   ├──async
112 │   │   │   []
113 │   │   ├──subsystem -> ../../../../../../class/power_cap
114 │   │   └──uevent
115 │   ├──intel-rapl:1:1
116 │   │   ├──constraint_0_name
117 │   │   ├──constraint_0_power_limit_uw
118 │   │   ├──constraint_0_time_window_us
119 │   │   ├──constraint_1_name
120 │   │   ├──constraint_1_power_limit_uw
121 │   │   ├──constraint_1_time_window_us
122 │   │   ├──device -> ../../intel-rapl:1
123 │   │   ├──energy_uj
124 │   │   ├──max_energy_range_uj
125 │   │   ├──name
126 │   │   ├──enabled
127 │   │   ├──power
128 │   │   │   ├──async
129 │   │   │   []
130 │   │   ├──subsystem -> ../../../../../../class/power_cap
131 │   │   └──uevent
132 │   ├──max_energy_range_uj
133 │   ├──max_power_range_uw
134 │   ├──name
135 │   ├──enabled
136 │   ├──power
137 │   │   ├──async
138 │   │   []
139 │   ├──subsystem -> ../../../../../class/power_cap
140 │   ├──uevent
141 ├──power
142 │   ├──async
143 │   []
144 ├──subsystem -> ../../../../class/power_cap
145 ├──enabled
146 └──uevent
147
148 The above example illustrates a case in which the Intel RAPL technology,
149 available in Intel® IA-64 and IA-32 Processor Architectures, is used. There is one
150 control type called intel-rapl which contains two power zones, intel-rapl:0 and
151 intel-rapl:1, representing CPU packages. Each of these power zones contains
152 two subzones, intel-rapl:j:0 and intel-rapl:j:1 (j = 0, 1), representing the
153 "core" and the "uncore" parts of the given CPU package, respectively. All of
154 the zones and subzones contain energy monitoring attributes (energy_uj,
155 max_energy_range_uj) and constraint attributes (constraint_*) allowing controls
156 to be applied (the constraints in the 'package' power zones apply to the whole
157 CPU packages and the subzone constraints only apply to the respective parts of
158 the given package individually). Since Intel RAPL doesn't provide instantaneous
159 power value, there is no power_uw attribute.
160
161 In addition to that, each power zone contains a name attribute, allowing the
162 part of the system represented by that zone to be identified.
163 For example::
164
165 cat /sys/class/power_cap/intel-rapl/intel-rapl:0/name
166
167 package-0
168 ---------
169
170 Depending on different power zones, the Intel RAPL technology allows
171 one or multiple constraints like short term, long term and peak power,
172 with different time windows to be applied to each power zone.
173 All the zones contain attributes representing the constraint names,
174 power limits and the sizes of the time windows. Note that time window
175 is not applicable to peak power. Here, constraint_j_* attributes
176 correspond to the jth constraint (j = 0,1,2).
177
178 For example::
179
180 constraint_0_name
181 constraint_0_power_limit_uw
182 constraint_0_time_window_us
183 constraint_1_name
184 constraint_1_power_limit_uw
185 constraint_1_time_window_us
186 constraint_2_name
187 constraint_2_power_limit_uw
188 constraint_2_time_window_us
189
190 Power Zone Attributes
191 =====================
192
193 Monitoring attributes
194 ---------------------
195
196 energy_uj (rw)
197 Current energy counter in micro joules. Write "0" to reset.
198 If the counter can not be reset, then this attribute is read only.
199
200 max_energy_range_uj (ro)
201 Range of the above energy counter in micro-joules.
202
203 power_uw (ro)
204 Current power in micro watts.
205
206 max_power_range_uw (ro)
207 Range of the above power value in micro-watts.
208
209 name (ro)
210 Name of this power zone.
211
212 It is possible that some domains have both power ranges and energy counter ranges;
213 however, only one is mandatory.
214
215 Constraints
216 -----------
217
218 constraint_X_power_limit_uw (rw)
219 Power limit in micro watts, which should be applicable for the
220 time window specified by "constraint_X_time_window_us".
221
222 constraint_X_time_window_us (rw)
223 Time window in micro seconds.
224
225 constraint_X_name (ro)
226 An optional name of the constraint
227
228 constraint_X_max_power_uw(ro)
229 Maximum allowed power in micro watts.
230
231 constraint_X_min_power_uw(ro)
232 Minimum allowed power in micro watts.
233
234 constraint_X_max_time_window_us(ro)
235 Maximum allowed time window in micro seconds.
236
237 constraint_X_min_time_window_us(ro)
238 Minimum allowed time window in micro seconds.
239
240 Except power_limit_uw and time_window_us other fields are optional.
241
242 Common zone and control type attributes
243 ---------------------------------------
244
245 enabled (rw): Enable/Disable controls at zone level or for all zones using
246 a control type.
247
248 Power Cap Client Driver Interface
249 =================================
250
251 The API summary:
252
253 Call powercap_register_control_type() to register control type object.
254 Call powercap_register_zone() to register a power zone (under a given
255 control type), either as a top-level power zone or as a subzone of another
256 power zone registered earlier.
257 The number of constraints in a power zone and the corresponding callbacks have
258 to be defined prior to calling powercap_register_zone() to register that zone.
259
260 To Free a power zone call powercap_unregister_zone().
261 To free a control type object call powercap_unregister_control_type().
262 Detailed API can be generated using kernel-doc on include/linux/powercap.h.
263

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Framework 목적

1-8

Power capping framework는 kernel과 사용자 공간 사이에 일관된 interface를 제공해 power capping driver가 설정을 사용자 공간에 통일된 방식으로 노출하게 합니다.

Power capping interface
power capping driverkernel powercap frameworkuniform sysfs treeuserspace monitoring and control

Driver별 구현을 공통 sysfs object와 attribute로 정규화합니다.

=======================
Power Capping Framework
=======================

The power capping framework provides a consistent interface between the kernel
and the user space that allows power capping drivers to expose the settings to
user space in a uniform way.

Control type, power zone과 subzone

9-31

Framework는 power capping device를 sysfs object tree로 사용자 공간에 노출합니다. Root level object는 power capping 방법을 나타내는 `control type`입니다. `intel-rapl` control type은 Intel Running Average Power Limit(RAPL)을, `idle-injection`은 idle injection을 이용한 power 제어를 뜻합니다.

Power zone은 해당 zone이 속한 control type의 방법으로 monitoring하고 제어할 수 있는 system 일부를 나타냅니다. 각 zone에는 power monitoring attribute와 power constraint 형태의 control이 있습니다.

System의 power zone이 계층적이라면 parent power zone 아래에 여러 subzone을 두는 방식으로 system의 power-control topology를 반영할 수 있습니다. Parent zone으로 device 집합 전체를 함께 제한하고, 더 세밀한 제어가 필요하면 subzone별로 제한할 수 있습니다.

Powercap 용어
Object의미
Control typePower capping 방법intel-rapl, idle-injection
Power zoneMonitoring·constraint 대상 system 부분CPU package
SubzoneParent보다 세밀한 제어 대상core, uncore

Control method와 제어 대상의 계층을 분리합니다.

Terminology
===========

The framework exposes power capping devices to user space via sysfs in the
form of a tree of objects. The objects at the root level of the tree represent
'control types', which correspond to different methods of power capping.  For
example, the intel-rapl control type represents the Intel "Running Average
Power Limit" (RAPL) technology, whereas the 'idle-injection' control type
corresponds to the use of idle injection for controlling power.

Power zones represent different parts of the system, which can be controlled and
monitored using the power capping method determined by the control type the
given zone belongs to. They each contain attributes for monitoring power, as
well as controls represented in the form of power constraints.  If the parts of
the system represented by different power zones are hierarchical (that is, one
bigger part consists of multiple smaller parts that each have their own power
controls), those power zones may also be organized in a hierarchy with one
parent power zone containing multiple subzones and so on to reflect the power
control topology of the system.  In that case, it is possible to apply power
capping to a set of devices together using the parent power zone and if more
fine grained control is required, it can be applied through the subzones.

Intel RAPL sysfs tree

32-147

예제 sysfs root는 `/sys/devices/virtual/powercap`입니다. 그 아래 `intel-rapl` control type이 있고 `intel-rapl:0`과 `intel-rapl:1` package power zone이 있습니다. 각 package 아래에는 `intel-rapl:j:0`과 `intel-rapl:j:1` subzone이 있습니다.

Package zone에는 `constraint_0_*`, `constraint_1_*`, `device`, `energy_uj`, `max_energy_range_uj`, `max_power_range_uw`, `name`, `enabled`, `power`, `subsystem`, `uevent` 등이 있습니다.

각 subzone에도 constraint, `device`, `energy_uj`, `max_energy_range_uj`, `name`, `enabled`, `power`, `subsystem`, `uevent`가 있습니다. `power/async`는 device power 관리 하위 항목입니다.

Control type level에도 `enabled`, `power`, `subsystem`, `uevent`가 나타납니다. 원문의 tree-drawing 문자가 손상되어 있으므로 아래 표와 흐름은 경로와 parent-child 관계를 기준으로 같은 구조를 깨끗하게 재구성한 것입니다.

Intel RAPL object hierarchy
/sys/devices/virtual/powercapintel-rapl control typeintel-rapl:0 and intel-rapl:1 package zonesintel-rapl:j:0 core and intel-rapl:j:1 uncore subzonesmonitoring + constraints + common attributes

두 package와 package별 core·uncore subzone을 같은 패턴으로 구성합니다.

Sysfs level별 주요 항목
LevelObject주요 child/attribute
Root/sys/devices/virtual/powercapintel-rapl
Control typeintel-raplpackage zones, enabled, power, subsystem, uevent
Package zoneintel-rapl:jconstraint_0/1_*, energy_uj, ranges, name, enabled, subzones
Subzoneintel-rapl:j:0 / :1constraint_0/1_*, energy_uj, range, name, enabled

긴 원문 tree의 반복을 level별 공통 항목으로 정리했습니다.

Example sysfs interface tree::

  /sys/devices/virtual/powercap
  └──intel-rapl
      ├──intel-rapl:0
      │   ├──constraint_0_name
      │   ├──constraint_0_power_limit_uw
      │   ├──constraint_0_time_window_us
      │   ├──constraint_1_name
      │   ├──constraint_1_power_limit_uw
      │   ├──constraint_1_time_window_us
      │   ├──device -> ../../intel-rapl
      │   ├──energy_uj
      │   ├──intel-rapl:0:0
      │   │   ├──constraint_0_name
      │   │   ├──constraint_0_power_limit_uw
      │   │   ├──constraint_0_time_window_us
      │   │   ├──constraint_1_name
      │   │   ├──constraint_1_power_limit_uw
      │   │   ├──constraint_1_time_window_us
      │   │   ├──device -> ../../intel-rapl:0
      │   │   ├──energy_uj
      │   │   ├──max_energy_range_uj
      │   │   ├──name
      │   │   ├──enabled
      │   │   ├──power
      │   │   │   ├──async
      │   │   │   []
      │   │   ├──subsystem -> ../../../../../../class/power_cap
      │   │   └──uevent
      │   ├──intel-rapl:0:1
      │   │   ├──constraint_0_name
      │   │   ├──constraint_0_power_limit_uw
      │   │   ├──constraint_0_time_window_us
      │   │   ├──constraint_1_name
      │   │   ├──constraint_1_power_limit_uw
      │   │   ├──constraint_1_time_window_us
      │   │   ├──device -> ../../intel-rapl:0
      │   │   ├──energy_uj
      │   │   ├──max_energy_range_uj
      │   │   ├──name
      │   │   ├──enabled
      │   │   ├──power
      │   │   │   ├──async
      │   │   │   []
      │   │   ├──subsystem -> ../../../../../../class/power_cap
      │   │   └──uevent
      │   ├──max_energy_range_uj
      │   ├──max_power_range_uw
      │   ├──name
      │   ├──enabled
      │   ├──power
      │   │   ├──async
      │   │   []
      │   ├──subsystem -> ../../../../../class/power_cap
      │   ├──enabled
      │   ├──uevent
      ├──intel-rapl:1
      │   ├──constraint_0_name
      │   ├──constraint_0_power_limit_uw
      │   ├──constraint_0_time_window_us
      │   ├──constraint_1_name
      │   ├──constraint_1_power_limit_uw
      │   ├──constraint_1_time_window_us
      │   ├──device -> ../../intel-rapl
      │   ├──energy_uj
      │   ├──intel-rapl:1:0
      │   │   ├──constraint_0_name
      │   │   ├──constraint_0_power_limit_uw
      │   │   ├──constraint_0_time_window_us
      │   │   ├──constraint_1_name
      │   │   ├──constraint_1_power_limit_uw
      │   │   ├──constraint_1_time_window_us
      │   │   ├──device -> ../../intel-rapl:1
      │   │   ├──energy_uj
      │   │   ├──max_energy_range_uj
      │   │   ├──name
      │   │   ├──enabled
      │   │   ├──power
      │   │   │   ├──async
      │   │   │   []
      │   │   ├──subsystem -> ../../../../../../class/power_cap
      │   │   └──uevent
      │   ├──intel-rapl:1:1
      │   │   ├──constraint_0_name
      │   │   ├──constraint_0_power_limit_uw
      │   │   ├──constraint_0_time_window_us
      │   │   ├──constraint_1_name
      │   │   ├──constraint_1_power_limit_uw
      │   │   ├──constraint_1_time_window_us
      │   │   ├──device -> ../../intel-rapl:1
      │   │   ├──energy_uj
      │   │   ├──max_energy_range_uj
      │   │   ├──name
      │   │   ├──enabled
      │   │   ├──power
      │   │   │   ├──async
      │   │   │   []
      │   │   ├──subsystem -> ../../../../../../class/power_cap
      │   │   └──uevent
      │   ├──max_energy_range_uj
      │   ├──max_power_range_uw
      │   ├──name
      │   ├──enabled
      │   ├──power
      │   │   ├──async
      │   │   []
      │   ├──subsystem -> ../../../../../class/power_cap
      │   ├──uevent
      ├──power
      │   ├──async
      │   []
      ├──subsystem -> ../../../../class/power_cap
      ├──enabled
      └──uevent

RAPL topology와 zone 이름

148-169

이 예제는 Intel IA-64와 IA-32 Processor Architecture에서 제공되는 Intel RAPL 기술을 사용합니다. `intel-rapl` control type 하나에 CPU package를 나타내는 `intel-rapl:0`과 `intel-rapl:1` power zone 두 개가 있습니다.

각 package zone에는 해당 CPU package의 `core`와 `uncore` 부분을 각각 나타내는 `intel-rapl:j:0`과 `intel-rapl:j:1` subzone이 있습니다. 모든 zone과 subzone에는 `energy_uj`, `max_energy_range_uj` energy monitoring attribute와 control을 적용하는 `constraint_*` attribute가 있습니다.

Package power zone의 constraint는 CPU package 전체에 적용되고 subzone constraint는 해당 package의 각 부분에만 적용됩니다. Intel RAPL은 instantaneous power 값을 제공하지 않으므로 `power_uw` attribute가 없습니다.

각 power zone에는 자신이 나타내는 system 부분을 식별하는 `name` attribute도 있습니다. 예를 들어 `cat /sys/class/power_cap/intel-rapl/intel-rapl:0/name`의 결과는 `package-0`입니다.

Intel RAPL 예제
Object대상Constraint 범위
intel-raplRAPL control type모든 RAPL zone
intel-rapl:jCPU package jPackage 전체
intel-rapl:j:0Package j coreCore 부분
intel-rapl:j:1Package j uncoreUncore 부분

Control type, package와 subzone의 의미를 대응시킵니다.

The above example illustrates a case in which the Intel RAPL technology,
available in Intel® IA-64 and IA-32 Processor Architectures, is used. There is one
control type called intel-rapl which contains two power zones, intel-rapl:0 and
intel-rapl:1, representing CPU packages.  Each of these power zones contains
two subzones, intel-rapl:j:0 and intel-rapl:j:1 (j = 0, 1), representing the
"core" and the "uncore" parts of the given CPU package, respectively.  All of
the zones and subzones contain energy monitoring attributes (energy_uj,
max_energy_range_uj) and constraint attributes (constraint_*) allowing controls
to be applied (the constraints in the 'package' power zones apply to the whole
CPU packages and the subzone constraints only apply to the respective parts of
the given package individually). Since Intel RAPL doesn't provide instantaneous
power value, there is no power_uw attribute.

In addition to that, each power zone contains a name attribute, allowing the
part of the system represented by that zone to be identified.
For example::

        cat /sys/class/power_cap/intel-rapl/intel-rapl:0/name

package-0
---------

RAPL constraint 이름과 time window

170-189

Power zone에 따라 Intel RAPL은 short-term, long-term, peak power 같은 하나 이상의 constraint를 서로 다른 time window와 함께 적용할 수 있습니다.

모든 zone에는 constraint name, power limit, time-window size를 나타내는 attribute가 있습니다. Peak power에는 time window가 적용되지 않습니다. `constraint_j_*`는 j번째 constraint를 뜻하며 여기서 j는 0, 1, 2입니다.

예제 attribute는 각 j에 대해 `constraint_j_name`, `constraint_j_power_limit_uw`, `constraint_j_time_window_us`입니다.

RAPL constraint 패턴
IndexNamePower limitTime window
0constraint_0_nameconstraint_0_power_limit_uwconstraint_0_time_window_us
1constraint_1_nameconstraint_1_power_limit_uwconstraint_1_time_window_us
2constraint_2_nameconstraint_2_power_limit_uwconstraint_2_time_window_us

Constraint index마다 동일한 attribute name pattern을 사용합니다.

Depending on different power zones, the Intel RAPL technology allows
one or multiple constraints like short term, long term and peak power,
with different time windows to be applied to each power zone.
All the zones contain attributes representing the constraint names,
power limits and the sizes of the time windows. Note that time window
is not applicable to peak power. Here, constraint_j_* attributes
correspond to the jth constraint (j = 0,1,2).

For example::

        constraint_0_name
        constraint_0_power_limit_uw
        constraint_0_time_window_us
        constraint_1_name
        constraint_1_power_limit_uw
        constraint_1_time_window_us
        constraint_2_name
        constraint_2_power_limit_uw
        constraint_2_time_window_us

Power zone monitoring attribute

190-214

`energy_uj`는 microjoule 단위의 현재 energy counter이며 읽기·쓰기가 가능합니다. `0`을 쓰면 reset합니다. Counter를 reset할 수 없는 구현에서는 read-only입니다.

`max_energy_range_uj`는 energy counter의 microjoule 단위 range입니다. `power_uw`는 microwatt 단위의 현재 power이고 `max_power_range_uw`는 그 power 값의 microwatt 단위 range입니다. `name`은 power zone 이름입니다.

일부 domain에는 power range와 energy-counter range가 모두 있을 수 있지만 둘 중 하나만 있어도 됩니다.

Monitoring attribute
AttributeMode단위·의미
energy_ujrw 또는 ro현재 energy counter, 0으로 reset 가능
max_energy_range_ujroEnergy counter range, microjoule
power_uwro현재 power, microwatt
max_power_range_uwroPower range, microwatt
nameroPower zone 이름

Access mode와 단위를 함께 보존합니다.

Power Zone Attributes
=====================

Monitoring attributes
---------------------

energy_uj (rw)
        Current energy counter in micro joules. Write "0" to reset.
        If the counter can not be reset, then this attribute is read only.

max_energy_range_uj (ro)
        Range of the above energy counter in micro-joules.

power_uw (ro)
        Current power in micro watts.

max_power_range_uw (ro)
        Range of the above power value in micro-watts.

name (ro)
        Name of this power zone.

It is possible that some domains have both power ranges and energy counter ranges;
however, only one is mandatory.

Power constraint attribute

215-241

`constraint_X_power_limit_uw`는 `constraint_X_time_window_us`가 지정하는 기간에 적용할 microwatt 단위 power limit이며 읽기·쓰기가 가능합니다. `constraint_X_time_window_us`는 microsecond 단위 time window이며 역시 읽기·쓰기가 가능합니다.

`constraint_X_name`은 optional read-only constraint 이름입니다. `constraint_X_max_power_uw`와 `constraint_X_min_power_uw`는 허용되는 maximum·minimum power를 microwatt로 나타냅니다.

`constraint_X_max_time_window_us`와 `constraint_X_min_time_window_us`는 허용되는 maximum·minimum time window를 microsecond로 나타냅니다.

`power_limit_uw`와 `time_window_us`를 제외한 나머지 field는 optional입니다.

Constraint attribute
AttributeMode필수 여부
constraint_X_power_limit_uwrw필수
constraint_X_time_window_usrw필수
constraint_X_nameroOptional
constraint_X_max/min_power_uwroOptional
constraint_X_max/min_time_window_usroOptional

필수 control과 optional metadata·range를 구분합니다.

Constraints
-----------

constraint_X_power_limit_uw (rw)
        Power limit in micro watts, which should be applicable for the
        time window specified by "constraint_X_time_window_us".

constraint_X_time_window_us (rw)
        Time window in micro seconds.

constraint_X_name (ro)
        An optional name of the constraint

constraint_X_max_power_uw(ro)
        Maximum allowed power in micro watts.

constraint_X_min_power_uw(ro)
        Minimum allowed power in micro watts.

constraint_X_max_time_window_us(ro)
        Maximum allowed time window in micro seconds.

constraint_X_min_time_window_us(ro)
        Minimum allowed time window in micro seconds.

Except power_limit_uw and time_window_us other fields are optional.

공통 zone과 control type attribute

242-247

`enabled`는 읽기·쓰기가 가능한 공통 attribute입니다. Zone level의 control을 enable/disable하거나 control type을 통해 모든 zone의 control을 한꺼번에 enable/disable합니다.

enabled 범위
위치효과
Power zone해당 zone control enable/disable
Control type그 control type의 모든 zone enable/disable

같은 attribute가 zone 또는 control type level에서 다른 범위에 적용됩니다.

Common zone and control type attributes
---------------------------------------

enabled (rw): Enable/Disable controls at zone level or for all zones using
a control type.

Power Cap client driver interface

248-262

`powercap_register_control_type()`을 호출해 control type object를 등록합니다.

`powercap_register_zone()`을 호출해 지정한 control type 아래에 power zone을 등록합니다. Top-level power zone으로 등록하거나 앞서 등록한 다른 power zone의 subzone으로 등록할 수 있습니다.

Power zone의 constraint 수와 각 callback은 `powercap_register_zone()`을 호출하기 전에 정의해야 합니다.

Power zone을 해제하려면 `powercap_unregister_zone()`을, control type object를 해제하려면 `powercap_unregister_control_type()`을 호출합니다. 상세 API 문서는 `include/linux/powercap.h`에 kernel-doc을 실행해 생성할 수 있습니다.

Powercap object 수명
powercap_register_control_type()define zone constraints + callbackspowercap_register_zone() as top-level or subzonepowercap_unregister_zone()powercap_unregister_control_type()

Parent control type을 먼저 만들고 child zone의 constraint와 callback을 준비한 뒤 등록합니다.

Power Cap Client Driver Interface
=================================

The API summary:

Call powercap_register_control_type() to register control type object.
Call powercap_register_zone() to register a power zone (under a given
control type), either as a top-level power zone or as a subzone of another
power zone registered earlier.
The number of constraints in a power zone and the corresponding callbacks have
to be defined prior to calling powercap_register_zone() to register that zone.

To Free a power zone call powercap_unregister_zone().
To free a control type object call powercap_unregister_control_type().
Detailed API can be generated using kernel-doc on include/linux/powercap.h.