← Documents Documentation/firmware-guide/acpi/method-tracing.rst GitHub 원문 ↗

Linux 6.18.37 · Firmware

ACPICA Trace Facility

ACPICA log reducer와 AML tracer의 module parameter, trace_state mode 및 명령 예를 설명하는 전문 번역입니다.

Source pathDocumentation/firmware-guide/acpi/method-tracing.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

method-tracing.rst:1-238

ACPICA method tracing facility는 상세 debug message를 control method 실행 구간에만 제한하는 log reducer와, AML method·opcode의 Begin/End를 기록하는 AML tracer를 제공한다. 두 기능 모두 `ACPI_DEBUG_PRINT()`에 기반하므로 `CONFIG_ACPI_DEBUG`가 필요하다.

핵심 설정은 `/sys/module/acpi/parameters/`의 `trace_method_name`, `trace_debug_layer`, `trace_debug_level`, `trace_state`이다. AML tracer 기본 mask는 `ACPI_EXECUTER (0x80)`과 `ACPI_LV_TRACE_POINT (0x10)`이다.

`enable`, `method`, `method-once`, `opcode`, `opcode-once`는 범위와 반복 여부가 다르다. `enable`은 method 이름을 `NULL`로 reset하며, method/opcode mode에서도 이름이 `NULL`이면 모든 control method에 적용되므로 활성화 순서가 중요하다.

원문 사용 예의 `opcode-opcode`는 뒤의 공식 mode 목록 및 boot 예의 `opcode-once`와 불일치한다. 원문은 변경하지 않고 보존했으며, 실제 1회 opcode tracing에는 정의된 `opcode-once`를 사용한다.

안전한 method tracing 설정 순서
Kernel이 CONFIG_ACPI_DEBUG로 빌드되었는지 확인trace_debug_layer와 trace_debug_level mask 결정특정 범위면 trace_method_name을 먼저 설정필요한 method/opcode 및 once mode 선택trace_state를 마지막에 기록해 tracing 시작수집 후 trace_state=disable로 종료

대량 log와 잘못된 범위를 피하기 위한 설정 순서이다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2 .. include:: <isonum.txt>
3
4 =====================
5 ACPICA Trace Facility
6 =====================
7
8 :Copyright: |copy| 2015, Intel Corporation
9 :Author: Lv Zheng <lv.zheng@intel.com>
10
11
12 Abstract
13 ========
14 This document describes the functions and the interfaces of the
15 method tracing facility.
16
17 Functionalities and usage examples
18 ==================================
19
20 ACPICA provides method tracing capability. And two functions are
21 currently implemented using this capability.
22
23 Log reducer
24 -----------
25
26 ACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is
27 enabled. The debugging messages which are deployed via
28 ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component
29 level (known as debug layer, configured via
30 /sys/module/acpi/parameters/debug_layer) and per-type level (known as
31 debug level, configured via /sys/module/acpi/parameters/debug_level).
32
33 But when the particular layer/level is applied to the control method
34 evaluations, the quantity of the debugging outputs may still be too
35 large to be put into the kernel log buffer. The idea thus is worked out
36 to only enable the particular debug layer/level (normally more detailed)
37 logs when the control method evaluation is started, and disable the
38 detailed logging when the control method evaluation is stopped.
39
40 The following command examples illustrate the usage of the "log reducer"
41 functionality:
42
43 a. Filter out the debug layer/level matched logs when control methods
44 are being evaluated::
45
46 # cd /sys/module/acpi/parameters
47 # echo "0xXXXXXXXX" > trace_debug_layer
48 # echo "0xYYYYYYYY" > trace_debug_level
49 # echo "enable" > trace_state
50
51 b. Filter out the debug layer/level matched logs when the specified
52 control method is being evaluated::
53
54 # cd /sys/module/acpi/parameters
55 # echo "0xXXXXXXXX" > trace_debug_layer
56 # echo "0xYYYYYYYY" > trace_debug_level
57 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
58 # echo "method" > /sys/module/acpi/parameters/trace_state
59
60 c. Filter out the debug layer/level matched logs when the specified
61 control method is being evaluated for the first time::
62
63 # cd /sys/module/acpi/parameters
64 # echo "0xXXXXXXXX" > trace_debug_layer
65 # echo "0xYYYYYYYY" > trace_debug_level
66 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
67 # echo "method-once" > /sys/module/acpi/parameters/trace_state
68
69 Where:
70 0xXXXXXXXX/0xYYYYYYYY
71 Refer to Documentation/firmware-guide/acpi/debug.rst for possible debug layer/level
72 masking values.
73 \PPPP.AAAA.TTTT.HHHH
74 Full path of a control method that can be found in the ACPI namespace.
75 It needn't be an entry of a control method evaluation.
76
77 AML tracer
78 ----------
79
80 There are special log entries added by the method tracing facility at
81 the "trace points" the AML interpreter starts/stops to execute a control
82 method, or an AML opcode. Note that the format of the log entries are
83 subject to change::
84
85 [ 0.186427] exdebug-0398 ex_trace_point : Method Begin [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
86 [ 0.186630] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905c88:If] execution.
87 [ 0.186820] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:LEqual] execution.
88 [ 0.187010] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905a20:-NamePath-] execution.
89 [ 0.187214] exdebug-0398 ex_trace_point : Opcode End [0xf5905a20:-NamePath-] execution.
90 [ 0.187407] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
91 [ 0.187594] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
92 [ 0.187789] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:LEqual] execution.
93 [ 0.187980] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905cc0:Return] execution.
94 [ 0.188146] exdebug-0398 ex_trace_point : Opcode Begin [0xf5905f60:One] execution.
95 [ 0.188334] exdebug-0398 ex_trace_point : Opcode End [0xf5905f60:One] execution.
96 [ 0.188524] exdebug-0398 ex_trace_point : Opcode End [0xf5905cc0:Return] execution.
97 [ 0.188712] exdebug-0398 ex_trace_point : Opcode End [0xf5905c88:If] execution.
98 [ 0.188903] exdebug-0398 ex_trace_point : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
99
100 Developers can utilize these special log entries to track the AML
101 interpretation, thus can aid issue debugging and performance tuning. Note
102 that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT()
103 macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling
104 "AML tracer" logs.
105
106 The following command examples illustrate the usage of the "AML tracer"
107 functionality:
108
109 a. Filter out the method start/stop "AML tracer" logs when control
110 methods are being evaluated::
111
112 # cd /sys/module/acpi/parameters
113 # echo "0x80" > trace_debug_layer
114 # echo "0x10" > trace_debug_level
115 # echo "enable" > trace_state
116
117 b. Filter out the method start/stop "AML tracer" when the specified
118 control method is being evaluated::
119
120 # cd /sys/module/acpi/parameters
121 # echo "0x80" > trace_debug_layer
122 # echo "0x10" > trace_debug_level
123 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
124 # echo "method" > trace_state
125
126 c. Filter out the method start/stop "AML tracer" logs when the specified
127 control method is being evaluated for the first time::
128
129 # cd /sys/module/acpi/parameters
130 # echo "0x80" > trace_debug_layer
131 # echo "0x10" > trace_debug_level
132 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
133 # echo "method-once" > trace_state
134
135 d. Filter out the method/opcode start/stop "AML tracer" when the
136 specified control method is being evaluated::
137
138 # cd /sys/module/acpi/parameters
139 # echo "0x80" > trace_debug_layer
140 # echo "0x10" > trace_debug_level
141 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
142 # echo "opcode" > trace_state
143
144 e. Filter out the method/opcode start/stop "AML tracer" when the
145 specified control method is being evaluated for the first time::
146
147 # cd /sys/module/acpi/parameters
148 # echo "0x80" > trace_debug_layer
149 # echo "0x10" > trace_debug_level
150 # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
151 # echo "opcode-opcode" > trace_state
152
153 Note that all above method tracing facility related module parameters can
154 be used as the boot parameters, for example::
155
156 acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 \
157 acpi.trace_method_name=\_SB.LID0._LID acpi.trace_state=opcode-once
158
159
160 Interface descriptions
161 ======================
162
163 All method tracing functions can be configured via ACPI module
164 parameters that are accessible at /sys/module/acpi/parameters/:
165
166 trace_method_name
167 The full path of the AML method that the user wants to trace.
168
169 Note that the full path shouldn't contain the trailing "_"s in its
170 name segments but may contain "\" to form an absolute path.
171
172 trace_debug_layer
173 The temporary debug_layer used when the tracing feature is enabled.
174
175 Using ACPI_EXECUTER (0x80) by default, which is the debug_layer
176 used to match all "AML tracer" logs.
177
178 trace_debug_level
179 The temporary debug_level used when the tracing feature is enabled.
180
181 Using ACPI_LV_TRACE_POINT (0x10) by default, which is the
182 debug_level used to match all "AML tracer" logs.
183
184 trace_state
185 The status of the tracing feature.
186
187 Users can enable/disable this debug tracing feature by executing
188 the following command::
189
190 # echo string > /sys/module/acpi/parameters/trace_state
191
192 Where "string" should be one of the following:
193
194 "disable"
195 Disable the method tracing feature.
196
197 "enable"
198 Enable the method tracing feature.
199
200 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
201 during any method execution will be logged.
202
203 "method"
204 Enable the method tracing feature.
205
206 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
207 during method execution of "trace_method_name" will be logged.
208
209 "method-once"
210 Enable the method tracing feature.
211
212 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
213 during method execution of "trace_method_name" will be logged only once.
214
215 "opcode"
216 Enable the method tracing feature.
217
218 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
219 during method/opcode execution of "trace_method_name" will be logged.
220
221 "opcode-once"
222 Enable the method tracing feature.
223
224 ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
225 during method/opcode execution of "trace_method_name" will be logged only
226 once.
227
228 Note that, the difference between the "enable" and other feature
229 enabling options are:
230
231 1. When "enable" is specified, since
232 "trace_debug_layer/trace_debug_level" shall apply to all control
233 method evaluations, after configuring "trace_state" to "enable",
234 "trace_method_name" will be reset to NULL.
235 2. When "method/opcode" is specified, if
236 "trace_method_name" is NULL when "trace_state" is configured to
237 these options, the "trace_debug_layer/trace_debug_level" will
238 apply to all control method evaluations.
239

3. 한국어 전문 번역

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

ACPICA trace facility와 log reducer

1-38

이 문서는 Intel Corporation의 Lv Zheng이 작성한 ACPICA method tracing facility의 기능과 인터페이스를 설명한다. ACPICA는 method tracing 능력을 바탕으로 `log reducer`와 `AML tracer`라는 두 기능을 제공한다.

`CONFIG_ACPI_DEBUG`가 활성화되면 ACPICA subsystem은 `ACPI_DEBUG_PRINT()` macro로 debugging output을 만든다. 이 message는 component별 `debug layer`와 type별 `debug level`이라는 두 단계에서 줄일 수 있으며, 각각 `/sys/module/acpi/parameters/debug_layer`와 `/sys/module/acpi/parameters/debug_level`로 설정한다.

그러나 특정 layer와 level을 control method evaluation 전체에 적용하면 kernel log buffer에 담기 어려울 만큼 출력이 많을 수 있다. Log reducer는 control method evaluation이 시작될 때만 선택한 상세 layer와 level을 임시로 활성화하고, evaluation이 끝나면 상세 logging을 비활성화한다.

ACPICA method tracing 기능
기능목적필수 조건
Log reducer상세 debug layer/level을 method evaluation 구간에만 적용CONFIG_ACPI_DEBUG
AML tracerAML method와 opcode의 Begin/End trace point 기록CONFIG_ACPI_DEBUG

같은 tracing 기반 위에서 log reducer와 AML tracer가 해결하는 문제를 구분한다.

Log reducer의 적용 범위
Control method evaluation 시작trace_debug_layer와 trace_debug_level 임시 적용선택된 상세 ACPICA message 기록Control method evaluation 종료상세 logging 비활성화

상세 logging이 control method 실행 경계 안에서만 켜지는 흐름이다.

.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

=====================
ACPICA Trace Facility
=====================

:Copyright: |copy| 2015, Intel Corporation
:Author: Lv Zheng <lv.zheng@intel.com>


Abstract
========
This document describes the functions and the interfaces of the
method tracing facility.

Functionalities and usage examples
==================================

ACPICA provides method tracing capability. And two functions are
currently implemented using this capability.

Log reducer
-----------

ACPICA subsystem provides debugging outputs when CONFIG_ACPI_DEBUG is
enabled. The debugging messages which are deployed via
ACPI_DEBUG_PRINT() macro can be reduced at 2 levels - per-component
level (known as debug layer, configured via
/sys/module/acpi/parameters/debug_layer) and per-type level (known as
debug level, configured via /sys/module/acpi/parameters/debug_level).

But when the particular layer/level is applied to the control method
evaluations, the quantity of the debugging outputs may still be too
large to be put into the kernel log buffer. The idea thus is worked out
to only enable the particular debug layer/level (normally more detailed)
logs when the control method evaluation is started, and disable the
detailed logging when the control method evaluation is stopped.

Log reducer 설정 예

39-75

첫 번째 예는 `/sys/module/acpi/parameters`로 이동한 뒤 `trace_debug_layer`에 `0xXXXXXXXX`, `trace_debug_level`에 `0xYYYYYYYY`를 쓰고 `trace_state`를 `enable`로 설정한다. 이 방식은 모든 control method가 evaluation되는 동안 선택한 layer/level과 일치하는 log를 대상으로 한다.

두 번째 예는 위 두 mask에 더해 `trace_method_name`에 ACPI namespace의 전체 경로 `\PPPP.AAAA.TTTT.HHHH`를 쓰고 `trace_state`를 `method`로 설정한다. 그러면 지정한 control method가 evaluation되는 동안 일치하는 log를 기록한다.

세 번째 예는 같은 method path를 사용하되 `trace_state`를 `method-once`로 설정한다. 지정한 control method가 처음 evaluation될 때 한 번만 일치하는 log를 기록한다.

`0xXXXXXXXX`와 `0xYYYYYYYY`에 사용할 수 있는 debug layer/level mask 값은 `Documentation/firmware-guide/acpi/debug.rst`를 참조한다. `\PPPP.AAAA.TTTT.HHHH`는 ACPI namespace에서 찾을 수 있는 control method의 전체 경로이며, control method evaluation의 최상위 진입 method일 필요는 없다.

Log reducer trace_state 선택
trace_statetrace_method_name적용 범위
enable사용하지 않음모든 control method evaluation
method전체 AML path지정 method가 실행될 때마다
method-once전체 AML path지정 method의 첫 실행 한 번

세 사용 예가 tracing 범위와 반복 횟수를 어떻게 바꾸는지 비교한다.

지정 method log reducer 설정
trace_debug_layer에 component mask 기록trace_debug_level에 type mask 기록trace_method_name에 전체 ACPI namespace path 기록trace_state에 method 또는 method-once 기록

Mask와 method path를 설정한 뒤 tracing mode를 마지막에 활성화한다.


The following command examples illustrate the usage of the "log reducer"
functionality:

a. Filter out the debug layer/level matched logs when control methods
   are being evaluated::

      # cd /sys/module/acpi/parameters
      # echo "0xXXXXXXXX" > trace_debug_layer
      # echo "0xYYYYYYYY" > trace_debug_level
      # echo "enable" > trace_state

b. Filter out the debug layer/level matched logs when the specified
   control method is being evaluated::

      # cd /sys/module/acpi/parameters
      # echo "0xXXXXXXXX" > trace_debug_layer
      # echo "0xYYYYYYYY" > trace_debug_level
      # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
      # echo "method" > /sys/module/acpi/parameters/trace_state

c. Filter out the debug layer/level matched logs when the specified
   control method is being evaluated for the first time::

      # cd /sys/module/acpi/parameters
      # echo "0xXXXXXXXX" > trace_debug_layer
      # echo "0xYYYYYYYY" > trace_debug_level
      # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
      # echo "method-once" > /sys/module/acpi/parameters/trace_state

Where:
   0xXXXXXXXX/0xYYYYYYYY
     Refer to Documentation/firmware-guide/acpi/debug.rst for possible debug layer/level
     masking values.
   \PPPP.AAAA.TTTT.HHHH
     Full path of a control method that can be found in the ACPI namespace.
     It needn't be an entry of a control method evaluation.

AML tracer의 trace point

76-104

Method tracing facility는 AML interpreter가 control method 또는 AML opcode 실행을 시작하거나 끝내는 trace point에 특별한 log entry를 추가한다. 이 log entry 형식은 향후 변경될 수 있으므로 parser가 예시의 열 위치나 문자열을 영구 ABI처럼 가정해서는 안 된다.

예시 trace는 `\_SB.PCI0.LPCB.ECOK`의 `Method Begin`으로 시작한다. 이어서 `If`, `LEqual`, `-NamePath-`, `One`, `Return` opcode의 `Opcode Begin`과 `Opcode End`가 실행 중첩 순서에 따라 나타나고, 마지막에 같은 method의 `Method End`가 기록된다.

개발자는 이 entry를 이용해 AML interpretation 흐름을 추적하고 문제 debugging과 performance tuning에 활용할 수 있다. AML tracer log도 `ACPI_DEBUG_PRINT()` macro로 구현되므로, 이를 사용하려면 kernel에서 `CONFIG_ACPI_DEBUG`가 활성화되어 있어야 한다.

예시 AML trace 중첩
Method Begin: \_SB.PCI0.LPCB.ECOKOpcode Begin: IfOpcode Begin/End: LEqual 내부 NamePath와 OneOpcode Begin/End: Return 내부 OneOpcode End: IfMethod End: \_SB.PCI0.LPCB.ECOK

원문 log의 method와 주요 opcode 시작·종료 관계를 간결하게 구조화했다.

AML trace entry 종류
Entry의미
Method Begin / Method EndControl method 실행의 시작과 종료
Opcode Begin / Opcode End개별 AML opcode 실행의 시작과 종료
Address와 name실행 object의 주소와 method 또는 opcode 이름

Trace point가 표시하는 실행 경계를 구분한다.


AML tracer
----------

There are special log entries added by the method tracing facility at
the "trace points" the AML interpreter starts/stops to execute a control
method, or an AML opcode. Note that the format of the log entries are
subject to change::

   [    0.186427]   exdebug-0398 ex_trace_point        : Method Begin [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.
   [    0.186630]   exdebug-0398 ex_trace_point        : Opcode Begin [0xf5905c88:If] execution.
   [    0.186820]   exdebug-0398 ex_trace_point        : Opcode Begin [0xf5905cc0:LEqual] execution.
   [    0.187010]   exdebug-0398 ex_trace_point        : Opcode Begin [0xf5905a20:-NamePath-] execution.
   [    0.187214]   exdebug-0398 ex_trace_point        : Opcode End [0xf5905a20:-NamePath-] execution.
   [    0.187407]   exdebug-0398 ex_trace_point        : Opcode Begin [0xf5905f60:One] execution.
   [    0.187594]   exdebug-0398 ex_trace_point        : Opcode End [0xf5905f60:One] execution.
   [    0.187789]   exdebug-0398 ex_trace_point        : Opcode End [0xf5905cc0:LEqual] execution.
   [    0.187980]   exdebug-0398 ex_trace_point        : Opcode Begin [0xf5905cc0:Return] execution.
   [    0.188146]   exdebug-0398 ex_trace_point        : Opcode Begin [0xf5905f60:One] execution.
   [    0.188334]   exdebug-0398 ex_trace_point        : Opcode End [0xf5905f60:One] execution.
   [    0.188524]   exdebug-0398 ex_trace_point        : Opcode End [0xf5905cc0:Return] execution.
   [    0.188712]   exdebug-0398 ex_trace_point        : Opcode End [0xf5905c88:If] execution.
   [    0.188903]   exdebug-0398 ex_trace_point        : Method End [0xf58394d8:\_SB.PCI0.LPCB.ECOK] execution.

Developers can utilize these special log entries to track the AML
interpretation, thus can aid issue debugging and performance tuning. Note
that, as the "AML tracer" logs are implemented via ACPI_DEBUG_PRINT()
macro, CONFIG_ACPI_DEBUG is also required to be enabled for enabling
"AML tracer" logs.

AML tracer mode와 boot parameter

105-158

AML tracer의 기본 mask는 `trace_debug_layer=0x80`과 `trace_debug_level=0x10`이다. `trace_state=enable`은 control method가 evaluation될 때 method 시작/종료 trace를 전체 범위에서 수집한다.

특정 method만 추적하려면 `trace_method_name`에 `\PPPP.AAAA.TTTT.HHHH`를 쓰고 `trace_state=method`를 선택한다. 첫 evaluation 한 번만 필요하면 `method-once`를 사용한다.

지정 method 내부의 method 경계뿐 아니라 opcode 경계까지 추적하려면 `trace_state=opcode`를 사용한다. 첫 evaluation 한 번의 method/opcode trace만 수집하는 mode는 뒤의 인터페이스 설명과 boot parameter 예에서 `opcode-once`로 정의된다.

원문의 다섯 번째 shell 예는 `trace_state`에 `opcode-opcode`를 쓰지만, 같은 문서의 mode 목록과 바로 뒤 boot parameter 예는 `opcode-once`를 사용한다. 원문 명령은 보존하되 실제 설정에서는 정의된 값인 `opcode-once`를 사용해야 한다.

Method tracing과 관련된 모든 module parameter는 boot parameter로도 지정할 수 있다. 예시는 `acpi.trace_debug_layer=0x80`, `acpi.trace_debug_level=0x10`, `acpi.trace_method_name=\_SB.LID0._LID`, `acpi.trace_state=opcode-once`를 kernel command line에 연속해서 배치한다.

AML tracer 사용 mode
trace_state대상횟수
enable모든 method의 method Begin/End매 evaluation
method지정 method의 method Begin/End매 evaluation
method-once지정 method의 method Begin/End첫 evaluation 한 번
opcode지정 method의 method/opcode Begin/End매 evaluation
opcode-once지정 method의 method/opcode Begin/End첫 evaluation 한 번

Method 경계와 opcode 경계, 반복 여부를 기준으로 mode를 비교한다.

Boot-time AML tracing 설정
acpi.trace_debug_layer=0x80acpi.trace_debug_level=0x10acpi.trace_method_name=\_SB.LID0._LIDacpi.trace_state=opcode-onceKernel boot 후 첫 해당 method 실행을 method/opcode 수준으로 기록

Sysfs를 사용할 수 있기 전부터 추적하려면 같은 값을 acpi.* boot parameter로 전달한다.


The following command examples illustrate the usage of the "AML tracer"
functionality:

a. Filter out the method start/stop "AML tracer" logs when control
   methods are being evaluated::

      # cd /sys/module/acpi/parameters
      # echo "0x80" > trace_debug_layer
      # echo "0x10" > trace_debug_level
      # echo "enable" > trace_state

b. Filter out the method start/stop "AML tracer" when the specified
   control method is being evaluated::

      # cd /sys/module/acpi/parameters
      # echo "0x80" > trace_debug_layer
      # echo "0x10" > trace_debug_level
      # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
      # echo "method" > trace_state

c. Filter out the method start/stop "AML tracer" logs when the specified
   control method is being evaluated for the first time::

      # cd /sys/module/acpi/parameters
      # echo "0x80" > trace_debug_layer
      # echo "0x10" > trace_debug_level
      # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
      # echo "method-once" > trace_state

d. Filter out the method/opcode start/stop "AML tracer" when the
   specified control method is being evaluated::

      # cd /sys/module/acpi/parameters
      # echo "0x80" > trace_debug_layer
      # echo "0x10" > trace_debug_level
      # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
      # echo "opcode" > trace_state

e. Filter out the method/opcode start/stop "AML tracer" when the
   specified control method is being evaluated for the first time::

      # cd /sys/module/acpi/parameters
      # echo "0x80" > trace_debug_layer
      # echo "0x10" > trace_debug_level
      # echo "\PPPP.AAAA.TTTT.HHHH" > trace_method_name
      # echo "opcode-opcode" > trace_state

Note that all above method tracing facility related module parameters can
be used as the boot parameters, for example::

   acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 \
   acpi.trace_method_name=\_SB.LID0._LID acpi.trace_state=opcode-once

ACPI module parameter 인터페이스

159-192

모든 method tracing 기능은 `/sys/module/acpi/parameters/`에서 접근할 수 있는 ACPI module parameter로 설정한다. `trace_method_name`에는 사용자가 추적하려는 AML method의 전체 경로를 기록한다.

전체 path의 각 name segment에는 뒤쪽을 채우는 trailing `_`를 포함하지 않아야 한다. 반면 namespace root에서 시작하는 absolute path를 만들기 위한 `\`는 포함할 수 있다.

`trace_debug_layer`는 tracing 기능이 활성화된 동안 임시로 사용할 `debug_layer`이다. 기본값은 모든 AML tracer log와 일치시키는 layer인 `ACPI_EXECUTER (0x80)`이다.

`trace_debug_level`은 tracing이 활성화된 동안 임시로 사용할 `debug_level`이다. 기본값은 모든 AML tracer log와 일치시키는 level인 `ACPI_LV_TRACE_POINT (0x10)`이다.

`trace_state`는 tracing 기능의 상태와 범위를 선택한다. 사용자는 `echo string > /sys/module/acpi/parameters/trace_state` 형식으로 다음 절에 정의된 문자열 중 하나를 써서 debug tracing을 활성화하거나 비활성화한다.

Method tracing module parameter
Parameter값 또는 기본값역할
trace_method_name전체 AML method path추적할 method 선택
trace_debug_layerACPI_EXECUTER (0x80)임시 component debug mask
trace_debug_levelACPI_LV_TRACE_POINT (0x10)임시 type debug mask
trace_statemode 문자열기능 활성화, 범위와 1회 여부 선택

각 parameter의 값과 기본 동작을 정리한다.


Interface descriptions
======================

All method tracing functions can be configured via ACPI module
parameters that are accessible at /sys/module/acpi/parameters/:

trace_method_name
  The full path of the AML method that the user wants to trace.

  Note that the full path shouldn't contain the trailing "_"s in its
  name segments but may contain "\" to form an absolute path.

trace_debug_layer
  The temporary debug_layer used when the tracing feature is enabled.

  Using ACPI_EXECUTER (0x80) by default, which is the debug_layer
  used to match all "AML tracer" logs.

trace_debug_level
  The temporary debug_level used when the tracing feature is enabled.

  Using ACPI_LV_TRACE_POINT (0x10) by default, which is the
  debug_level used to match all "AML tracer" logs.

trace_state
  The status of the tracing feature.

  Users can enable/disable this debug tracing feature by executing
  the following command::

   # echo string > /sys/module/acpi/parameters/trace_state

Where "string" should be one of the following:

trace_state 값과 fallback 규칙

193-238

`disable`은 method tracing 기능을 끈다. `enable`은 기능을 켜고, 모든 method 실행 중 `trace_debug_layer/trace_debug_level`과 일치하는 ACPICA debugging message를 기록한다.

`method`는 `trace_method_name`으로 지정한 method가 실행되는 동안 일치하는 message를 기록한다. `method-once`는 같은 범위를 첫 실행 한 번으로 제한한다.

`opcode`는 지정 method의 method 실행과 그 안의 opcode 실행 동안 일치하는 message를 기록한다. `opcode-once`는 method/opcode 범위를 지정 method의 첫 실행 한 번만 기록한다.

`enable`은 mask를 모든 control method evaluation에 적용하므로 특정 method 이름이 필요 없다. 따라서 `trace_state`를 `enable`로 설정하면 `trace_method_name`은 `NULL`로 reset된다.

`method` 또는 `opcode` 계열 mode를 선택했는데 `trace_method_name`이 `NULL`이면, `trace_debug_layer/trace_debug_level`은 특정 method가 아니라 모든 control method evaluation에 적용된다. 의도치 않은 대량 log를 피하려면 state를 활성화하기 전에 method path가 설정되어 있는지 확인해야 한다.

trace_state 의미
Method 범위Opcode 포함반복
disableTracing 비활성아니요해당 없음
enable모든 method아니요매번
method지정 method아니요매번
method-once지정 method아니요한 번
opcode지정 method매번
opcode-once지정 method한 번

지원되는 문자열과 method 선택, opcode 포함, 1회 제한을 한 표에서 비교한다.

trace_method_name 처리 규칙
trace_state=enable 설정trace_method_name을 NULL로 reset모든 control method evaluation에 mask 적용또는 method/opcode mode 선택trace_method_name이 있으면 지정 method에 적용trace_method_name이 NULL이면 모든 method에 적용

trace_state와 method path의 조합에 따라 실제 적용 범위가 결정된다.


"disable"
  Disable the method tracing feature.

"enable"
  Enable the method tracing feature.
  
  ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
  during any method execution will be logged.

"method"
  Enable the method tracing feature.

  ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
  during method execution of "trace_method_name" will be logged.

"method-once"
  Enable the method tracing feature.

  ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
  during method execution of "trace_method_name" will be logged only once.

"opcode"
  Enable the method tracing feature.

  ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
  during method/opcode execution of "trace_method_name" will be logged.

"opcode-once"
  Enable the method tracing feature.

  ACPICA debugging messages matching "trace_debug_layer/trace_debug_level"
  during method/opcode execution of "trace_method_name" will be logged only
  once.

Note that, the difference between the "enable" and other feature
enabling options are:

1. When "enable" is specified, since
   "trace_debug_layer/trace_debug_level" shall apply to all control
   method evaluations, after configuring "trace_state" to "enable",
   "trace_method_name" will be reset to NULL.
2. When "method/opcode" is specified, if
   "trace_method_name" is NULL when "trace_state" is configured to
   these options, the "trace_debug_layer/trace_debug_level" will
   apply to all control method evaluations.