method-tracing.txt 9.0 KB

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