method-tracing.rst 9.0 KB

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