← Documents Documentation/trace/events-power.rst GitHub 원문 ↗

Linux 6.18.37 · Tracing

Subsystem Trace Points: power

CPU power state, clock, power domain과 PM QoS request transition을 기록하는 power subsystem tracepoint입니다.

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

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

1. 요약·해설

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

요약·해설

events-power.rst:1-104

CPU power state, clock, power domain과 PM QoS request transition을 기록하는 power subsystem tracepoint입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 =============================
2 Subsystem Trace Points: power
3 =============================
4
5 The power tracing system captures events related to power transitions
6 within the kernel. Broadly speaking there are three major subheadings:
7
8 - Power state switch which reports events related to suspend (S-states),
9 cpuidle (C-states) and cpufreq (P-states)
10 - System clock related changes
11 - Power domains related changes and transitions
12
13 This document describes what each of the tracepoints is and why they
14 might be useful.
15
16 Cf. include/trace/events/power.h for the events definitions.
17
18 1. Power state switch events
19 ============================
20
21 1.1 Trace API
22 -----------------
23
24 A 'cpu' event class gathers the CPU-related events: cpuidle and
25 cpufreq.
26 ::
27
28 cpu_idle "state=%lu cpu_id=%lu"
29 cpu_frequency "state=%lu cpu_id=%lu"
30 cpu_frequency_limits "min=%lu max=%lu cpu_id=%lu"
31
32 A suspend event is used to indicate the system going in and out of the
33 suspend mode:
34 ::
35
36 machine_suspend "state=%lu"
37
38
39 Note: the value of '-1' or '4294967295' for state means an exit from the current state,
40 i.e. trace_cpu_idle(4, smp_processor_id()) means that the system
41 enters the idle state 4, while trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id())
42 means that the system exits the previous idle state.
43
44 The event which has 'state=4294967295' in the trace is very important to the user
45 space tools which are using it to detect the end of the current state, and so to
46 correctly draw the states diagrams and to calculate accurate statistics etc.
47
48 2. Clocks events
49 ================
50 The clock events are used for clock enable/disable and for
51 clock rate change.
52 ::
53
54 clock_enable "%s state=%lu cpu_id=%lu"
55 clock_disable "%s state=%lu cpu_id=%lu"
56 clock_set_rate "%s state=%lu cpu_id=%lu"
57
58 The first parameter gives the clock name (e.g. "gpio1_iclk").
59 The second parameter is '1' for enable, '0' for disable, the target
60 clock rate for set_rate.
61
62 3. Power domains events
63 =======================
64 The power domain events are used for power domains transitions
65 ::
66
67 power_domain_target "%s state=%lu cpu_id=%lu"
68
69 The first parameter gives the power domain name (e.g. "mpu_pwrdm").
70 The second parameter is the power domain target state.
71
72 4. PM QoS events
73 ================
74 The PM QoS events are used for QoS add/update/remove request and for
75 target/flags update.
76 ::
77
78 pm_qos_update_target "action=%s prev_value=%d curr_value=%d"
79 pm_qos_update_flags "action=%s prev_value=0x%x curr_value=0x%x"
80
81 The first parameter gives the QoS action name (e.g. "ADD_REQ").
82 The second parameter is the previous QoS value.
83 The third parameter is the current QoS value to update.
84
85 There are also events used for device PM QoS add/update/remove request.
86 ::
87
88 dev_pm_qos_add_request "device=%s type=%s new_value=%d"
89 dev_pm_qos_update_request "device=%s type=%s new_value=%d"
90 dev_pm_qos_remove_request "device=%s type=%s new_value=%d"
91
92 The first parameter gives the device name which tries to add/update/remove
93 QoS requests.
94 The second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY").
95 The third parameter is value to be added/updated/removed.
96
97 And, there are events used for CPU latency QoS add/update/remove request.
98 ::
99
100 pm_qos_add_request "value=%d"
101 pm_qos_update_request "value=%d"
102 pm_qos_remove_request "value=%d"
103
104 The parameter is the value to be added/updated/removed.
105

3. 한국어 전문 번역

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

Power tracepoint 범주

1-17

power tracing system은 kernel 내부의 power transition 관련 event를 캡처한다. 이 문서는 각 tracepoint와 활용 이유를 설명하며 event 정의는 `include/trace/events/power.h`에 있다.

큰 범주는 suspend S-state, cpuidle C-state, cpufreq P-state를 포함한 power state switch, system clock change, power domain change와 transition이다. 뒤에는 PM QoS event도 설명한다.

Power trace 범주
범주대상
Power stateSuspend, cpuidle, cpufreq
ClockEnable, disable, rate
Power domainTarget-state transition
PM QoSRequest, target, flags

system 전력 상태와 제약 변경을 네 영역으로 정리한다.

Power tracing 범위
CPU and system statePower events
Clock treeClock events
Power domainDomain events
QoS requestPM QoS events

CPU에서 device QoS까지 여러 계층의 transition을 기록한다.

=============================
Subsystem Trace Points: power
=============================

The power tracing system captures events related to power transitions
within the kernel. Broadly speaking there are three major subheadings:

  - Power state switch which reports events related to suspend (S-states),
    cpuidle (C-states) and cpufreq (P-states)
  - System clock related changes
  - Power domains related changes and transitions

This document describes what each of the tracepoints is and why they
might be useful.

Cf. include/trace/events/power.h for the events definitions.

CPU와 suspend state event

18-47

`cpu` event class는 cpuidle과 cpufreq 관련 event를 모은다. `cpu_idle`은 state와 cpu_id, `cpu_frequency`는 frequency state와 cpu_id, `cpu_frequency_limits`는 min, max, cpu_id를 기록한다.

`machine_suspend` event는 system이 suspend mode에 들어가고 나오는 것을 state 값으로 표시한다.

state가 `-1` 또는 unsigned 표현 `4294967295`이면 현재 state에서 빠져나왔다는 뜻이다. `trace_cpu_idle(4, cpu)`는 idle state 4 진입이고 `trace_cpu_idle(PWR_EVENT_EXIT, cpu)`는 이전 idle state 종료다.

`state=4294967295` event는 user-space tool이 현재 state 종료 시점을 감지하는 데 매우 중요하다. 이를 사용해야 state diagram을 정확히 그리고 올바른 통계를 계산할 수 있다.

CPU power event
EventField
cpu_idlestate, cpu_id
cpu_frequencystate, cpu_id
cpu_frequency_limitsmin, max, cpu_id
machine_suspendstate

CPU state와 frequency 관련 field를 구분한다.

Idle state lifecycle
trace_cpu_idle state=4Enter idle state 4
Time in statePWR_EVENT_EXIT
PWR_EVENT_EXITstate=4294967295
Entry and exitAccurate duration statistics

진입 event와 PWR_EVENT_EXIT가 한 상태의 구간을 닫는다.

1. Power state switch events
============================

1.1 Trace API
-----------------

A 'cpu' event class gathers the CPU-related events: cpuidle and
cpufreq.
::

  cpu_idle		"state=%lu cpu_id=%lu"
  cpu_frequency		"state=%lu cpu_id=%lu"
  cpu_frequency_limits	"min=%lu max=%lu cpu_id=%lu"

A suspend event is used to indicate the system going in and out of the
suspend mode:
::

  machine_suspend		"state=%lu"


Note: the value of '-1' or '4294967295' for state means an exit from the current state,
i.e. trace_cpu_idle(4, smp_processor_id()) means that the system
enters the idle state 4, while trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id())
means that the system exits the previous idle state.

The event which has 'state=4294967295' in the trace is very important to the user
space tools which are using it to detect the end of the current state, and so to
correctly draw the states diagrams and to calculate accurate statistics etc.

Clock과 power domain event

48-71

clock event는 clock enable, disable, rate change를 기록한다. `clock_enable`, `clock_disable`, `clock_set_rate` 모두 clock name, state, cpu_id를 제공한다.

첫 parameter는 `gpio1_iclk` 같은 clock name이다. 두 번째 parameter는 enable이면 1, disable이면 0이고 `set_rate`에서는 target clock rate다.

`power_domain_target`은 power domain transition을 기록한다. 첫 parameter는 `mpu_pwrdm` 같은 domain name이고 두 번째는 target state다.

Clock event parameter
Event첫 parameterstate
clock_enableClock name1
clock_disableClock name0
clock_set_rateClock nameTarget rate

같은 state field가 event 종류에 따라 다른 의미를 갖는다.

Power domain transition
Power-domain requestDomain name
Power-domain requestTarget state
Domain name and statepower_domain_target

domain name과 목표 상태를 CPU context와 함께 기록한다.

2. Clocks events
================
The clock events are used for clock enable/disable and for
clock rate change.
::

  clock_enable		"%s state=%lu cpu_id=%lu"
  clock_disable		"%s state=%lu cpu_id=%lu"
  clock_set_rate		"%s state=%lu cpu_id=%lu"

The first parameter gives the clock name (e.g. "gpio1_iclk").
The second parameter is '1' for enable, '0' for disable, the target
clock rate for set_rate.

3. Power domains events
=======================
The power domain events are used for power domains transitions
::

  power_domain_target	"%s state=%lu cpu_id=%lu"

The first parameter gives the power domain name (e.g. "mpu_pwrdm").
The second parameter is the power domain target state.

PM QoS와 device·CPU latency request

72-104

PM QoS event는 QoS request의 add, update, remove와 target 또는 flags update를 기록한다.

`pm_qos_update_target`과 `pm_qos_update_flags`는 action name, previous value, current value를 제공한다. action은 `ADD_REQ` 같은 이름이며 flags는 16진수로 표시된다.

device PM QoS에는 `dev_pm_qos_add_request`, `dev_pm_qos_update_request`, `dev_pm_qos_remove_request`가 있다. parameter는 요청을 조작하는 device name, `DEV_PM_QOS_RESUME_LATENCY` 같은 request type, 추가·갱신·제거할 value다.

CPU latency QoS에는 `pm_qos_add_request`, `pm_qos_update_request`, `pm_qos_remove_request`가 있고 parameter 하나로 추가·갱신·제거할 value를 기록한다.

PM QoS event 계열
계열OperationField
PM QoS target/flagsUpdateaction, prev_value, curr_value
Device PM QoSAdd / update / removedevice, type, new_value
CPU latency QoSAdd / update / removevalue

system target, device request, CPU latency request를 구분한다.

QoS request lifecycle
Add requestCurrent QoS constraints
Update requestNew target or flags
Remove requestConstraint released

request가 추가되고 변경된 뒤 제거되는 과정을 event로 남긴다.

Device PM QoS parameter
순서의미
1Device name요청을 add/update/remove하는 device
2Request typeDEV_PM_QOS_RESUME_LATENCY
3Value추가·갱신·제거할 값

device request event의 세 parameter다.

4. PM QoS events
================
The PM QoS events are used for QoS add/update/remove request and for
target/flags update.
::

  pm_qos_update_target               "action=%s prev_value=%d curr_value=%d"
  pm_qos_update_flags                "action=%s prev_value=0x%x curr_value=0x%x"

The first parameter gives the QoS action name (e.g. "ADD_REQ").
The second parameter is the previous QoS value.
The third parameter is the current QoS value to update.

There are also events used for device PM QoS add/update/remove request.
::

  dev_pm_qos_add_request             "device=%s type=%s new_value=%d"
  dev_pm_qos_update_request          "device=%s type=%s new_value=%d"
  dev_pm_qos_remove_request          "device=%s type=%s new_value=%d"

The first parameter gives the device name which tries to add/update/remove
QoS requests.
The second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY").
The third parameter is value to be added/updated/removed.

And, there are events used for CPU latency QoS add/update/remove request.
::

  pm_qos_add_request        "value=%d"
  pm_qos_update_request     "value=%d"
  pm_qos_remove_request     "value=%d"

The parameter is the value to be added/updated/removed.