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