18c2ecf20Sopenharmony_ciDynamic debug 28c2ecf20Sopenharmony_ci+++++++++++++ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciIntroduction 68c2ecf20Sopenharmony_ci============ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciThis document describes how to use the dynamic debug (dyndbg) feature. 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciDynamic debug is designed to allow you to dynamically enable/disable 118c2ecf20Sopenharmony_cikernel code to obtain additional kernel information. Currently, if 128c2ecf20Sopenharmony_ci``CONFIG_DYNAMIC_DEBUG`` is set, then all ``pr_debug()``/``dev_dbg()`` and 138c2ecf20Sopenharmony_ci``print_hex_dump_debug()``/``print_hex_dump_bytes()`` calls can be dynamically 148c2ecf20Sopenharmony_cienabled per-callsite. 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciIf you do not want to enable dynamic debug globally (i.e. in some embedded 178c2ecf20Sopenharmony_cisystem), you may set ``CONFIG_DYNAMIC_DEBUG_CORE`` as basic support of dynamic 188c2ecf20Sopenharmony_cidebug and add ``ccflags := -DDYNAMIC_DEBUG_MODULE`` into the Makefile of any 198c2ecf20Sopenharmony_cimodules which you'd like to dynamically debug later. 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciIf ``CONFIG_DYNAMIC_DEBUG`` is not set, ``print_hex_dump_debug()`` is just 228c2ecf20Sopenharmony_cishortcut for ``print_hex_dump(KERN_DEBUG)``. 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciFor ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is 258c2ecf20Sopenharmony_ciits ``prefix_str`` argument, if it is constant string; or ``hexdump`` 268c2ecf20Sopenharmony_ciin case ``prefix_str`` is built dynamically. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ciDynamic debug has even more useful features: 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci * Simple query language allows turning on and off debugging 318c2ecf20Sopenharmony_ci statements by matching any combination of 0 or 1 of: 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci - source filename 348c2ecf20Sopenharmony_ci - function name 358c2ecf20Sopenharmony_ci - line number (including ranges of line numbers) 368c2ecf20Sopenharmony_ci - module name 378c2ecf20Sopenharmony_ci - format string 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci * Provides a debugfs control file: ``<debugfs>/dynamic_debug/control`` 408c2ecf20Sopenharmony_ci which can be read to display the complete list of known debug 418c2ecf20Sopenharmony_ci statements, to help guide you 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciControlling dynamic debug Behaviour 448c2ecf20Sopenharmony_ci=================================== 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciThe behaviour of ``pr_debug()``/``dev_dbg()`` are controlled via writing to a 478c2ecf20Sopenharmony_cicontrol file in the 'debugfs' filesystem. Thus, you must first mount 488c2ecf20Sopenharmony_cithe debugfs filesystem, in order to make use of this feature. 498c2ecf20Sopenharmony_ciSubsequently, we refer to the control file as: 508c2ecf20Sopenharmony_ci``<debugfs>/dynamic_debug/control``. For example, if you want to enable 518c2ecf20Sopenharmony_ciprinting from source file ``svcsock.c``, line 1603 you simply do:: 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci nullarbor:~ # echo 'file svcsock.c line 1603 +p' > 548c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciIf you make a mistake with the syntax, the write will fail thus:: 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci nullarbor:~ # echo 'file svcsock.c wtf 1 +p' > 598c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 608c2ecf20Sopenharmony_ci -bash: echo: write error: Invalid argument 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciNote, for systems without 'debugfs' enabled, the control file can be 638c2ecf20Sopenharmony_cifound in ``/proc/dynamic_debug/control``. 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ciViewing Dynamic Debug Behaviour 668c2ecf20Sopenharmony_ci=============================== 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciYou can view the currently configured behaviour of all the debug 698c2ecf20Sopenharmony_cistatements via:: 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci nullarbor:~ # cat <debugfs>/dynamic_debug/control 728c2ecf20Sopenharmony_ci # filename:lineno [module]function flags format 738c2ecf20Sopenharmony_ci net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012" 748c2ecf20Sopenharmony_ci net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012" 758c2ecf20Sopenharmony_ci net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init =_ "\011sq_depth : %d\012" 768c2ecf20Sopenharmony_ci net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init =_ "\011max_requests : %d\012" 778c2ecf20Sopenharmony_ci ... 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ciYou can also apply standard Unix text manipulation filters to this 818c2ecf20Sopenharmony_cidata, e.g.:: 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci nullarbor:~ # grep -i rdma <debugfs>/dynamic_debug/control | wc -l 848c2ecf20Sopenharmony_ci 62 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci nullarbor:~ # grep -i tcp <debugfs>/dynamic_debug/control | wc -l 878c2ecf20Sopenharmony_ci 42 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ciThe third column shows the currently enabled flags for each debug 908c2ecf20Sopenharmony_cistatement callsite (see below for definitions of the flags). The 918c2ecf20Sopenharmony_cidefault value, with no flags enabled, is ``=_``. So you can view all 928c2ecf20Sopenharmony_cithe debug statement callsites with any non-default flags:: 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci nullarbor:~ # awk '$3 != "=_"' <debugfs>/dynamic_debug/control 958c2ecf20Sopenharmony_ci # filename:lineno [module]function flags format 968c2ecf20Sopenharmony_ci net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012" 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ciCommand Language Reference 998c2ecf20Sopenharmony_ci========================== 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ciAt the lexical level, a command comprises a sequence of words separated 1028c2ecf20Sopenharmony_ciby spaces or tabs. So these are all equivalent:: 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > 1058c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 1068c2ecf20Sopenharmony_ci nullarbor:~ # echo -n ' file svcsock.c line 1603 +p ' > 1078c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 1088c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > 1098c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ciCommand submissions are bounded by a write() system call. 1128c2ecf20Sopenharmony_ciMultiple commands can be written together, separated by ``;`` or ``\n``:: 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci ~# echo "func pnpacpi_get_resources +p; func pnp_assign_mem +p" \ 1158c2ecf20Sopenharmony_ci > <debugfs>/dynamic_debug/control 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ciIf your query set is big, you can batch them too:: 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci ~# cat query-batch-file > <debugfs>/dynamic_debug/control 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ciAnother way is to use wildcards. The match rule supports ``*`` (matches 1228c2ecf20Sopenharmony_cizero or more characters) and ``?`` (matches exactly one character). For 1238c2ecf20Sopenharmony_ciexample, you can match all usb drivers:: 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci ~# echo "file drivers/usb/* +p" > <debugfs>/dynamic_debug/control 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ciAt the syntactical level, a command comprises a sequence of match 1288c2ecf20Sopenharmony_cispecifications, followed by a flags change specification:: 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci command ::= match-spec* flags-spec 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ciThe match-spec's are used to choose a subset of the known pr_debug() 1338c2ecf20Sopenharmony_cicallsites to which to apply the flags-spec. Think of them as a query 1348c2ecf20Sopenharmony_ciwith implicit ANDs between each pair. Note that an empty list of 1358c2ecf20Sopenharmony_cimatch-specs will select all debug statement callsites. 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ciA match specification comprises a keyword, which controls the 1388c2ecf20Sopenharmony_ciattribute of the callsite to be compared, and a value to compare 1398c2ecf20Sopenharmony_ciagainst. Possible keywords are::: 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci match-spec ::= 'func' string | 1428c2ecf20Sopenharmony_ci 'file' string | 1438c2ecf20Sopenharmony_ci 'module' string | 1448c2ecf20Sopenharmony_ci 'format' string | 1458c2ecf20Sopenharmony_ci 'line' line-range 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci line-range ::= lineno | 1488c2ecf20Sopenharmony_ci '-'lineno | 1498c2ecf20Sopenharmony_ci lineno'-' | 1508c2ecf20Sopenharmony_ci lineno'-'lineno 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci lineno ::= unsigned-int 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci.. note:: 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci ``line-range`` cannot contain space, e.g. 1578c2ecf20Sopenharmony_ci "1-30" is valid range but "1 - 30" is not. 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ciThe meanings of each keyword are: 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cifunc 1638c2ecf20Sopenharmony_ci The given string is compared against the function name 1648c2ecf20Sopenharmony_ci of each callsite. Example:: 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci func svc_tcp_accept 1678c2ecf20Sopenharmony_ci func *recv* # in rfcomm, bluetooth, ping, tcp 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_cifile 1708c2ecf20Sopenharmony_ci The given string is compared against either the src-root relative 1718c2ecf20Sopenharmony_ci pathname, or the basename of the source file of each callsite. 1728c2ecf20Sopenharmony_ci Examples:: 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci file svcsock.c 1758c2ecf20Sopenharmony_ci file kernel/freezer.c # ie column 1 of control file 1768c2ecf20Sopenharmony_ci file drivers/usb/* # all callsites under it 1778c2ecf20Sopenharmony_ci file inode.c:start_* # parse :tail as a func (above) 1788c2ecf20Sopenharmony_ci file inode.c:1-100 # parse :tail as a line-range (above) 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_cimodule 1818c2ecf20Sopenharmony_ci The given string is compared against the module name 1828c2ecf20Sopenharmony_ci of each callsite. The module name is the string as 1838c2ecf20Sopenharmony_ci seen in ``lsmod``, i.e. without the directory or the ``.ko`` 1848c2ecf20Sopenharmony_ci suffix and with ``-`` changed to ``_``. Examples:: 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci module sunrpc 1878c2ecf20Sopenharmony_ci module nfsd 1888c2ecf20Sopenharmony_ci module drm* # both drm, drm_kms_helper 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ciformat 1918c2ecf20Sopenharmony_ci The given string is searched for in the dynamic debug format 1928c2ecf20Sopenharmony_ci string. Note that the string does not need to match the 1938c2ecf20Sopenharmony_ci entire format, only some part. Whitespace and other 1948c2ecf20Sopenharmony_ci special characters can be escaped using C octal character 1958c2ecf20Sopenharmony_ci escape ``\ooo`` notation, e.g. the space character is ``\040``. 1968c2ecf20Sopenharmony_ci Alternatively, the string can be enclosed in double quote 1978c2ecf20Sopenharmony_ci characters (``"``) or single quote characters (``'``). 1988c2ecf20Sopenharmony_ci Examples:: 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci format svcrdma: // many of the NFS/RDMA server pr_debugs 2018c2ecf20Sopenharmony_ci format readahead // some pr_debugs in the readahead cache 2028c2ecf20Sopenharmony_ci format nfsd:\040SETATTR // one way to match a format with whitespace 2038c2ecf20Sopenharmony_ci format "nfsd: SETATTR" // a neater way to match a format with whitespace 2048c2ecf20Sopenharmony_ci format 'nfsd: SETATTR' // yet another way to match a format with whitespace 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ciline 2078c2ecf20Sopenharmony_ci The given line number or range of line numbers is compared 2088c2ecf20Sopenharmony_ci against the line number of each ``pr_debug()`` callsite. A single 2098c2ecf20Sopenharmony_ci line number matches the callsite line number exactly. A 2108c2ecf20Sopenharmony_ci range of line numbers matches any callsite between the first 2118c2ecf20Sopenharmony_ci and last line number inclusive. An empty first number means 2128c2ecf20Sopenharmony_ci the first line in the file, an empty last line number means the 2138c2ecf20Sopenharmony_ci last line number in the file. Examples:: 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci line 1603 // exactly line 1603 2168c2ecf20Sopenharmony_ci line 1600-1605 // the six lines from line 1600 to line 1605 2178c2ecf20Sopenharmony_ci line -1605 // the 1605 lines from line 1 to line 1605 2188c2ecf20Sopenharmony_ci line 1600- // all lines from line 1600 to the end of the file 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ciThe flags specification comprises a change operation followed 2218c2ecf20Sopenharmony_ciby one or more flag characters. The change operation is one 2228c2ecf20Sopenharmony_ciof the characters:: 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci - remove the given flags 2258c2ecf20Sopenharmony_ci + add the given flags 2268c2ecf20Sopenharmony_ci = set the flags to the given flags 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ciThe flags are:: 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci p enables the pr_debug() callsite. 2318c2ecf20Sopenharmony_ci f Include the function name in the printed message 2328c2ecf20Sopenharmony_ci l Include line number in the printed message 2338c2ecf20Sopenharmony_ci m Include module name in the printed message 2348c2ecf20Sopenharmony_ci t Include thread ID in messages not generated from interrupt context 2358c2ecf20Sopenharmony_ci _ No flags are set. (Or'd with others on input) 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ciFor ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only ``p`` flag 2388c2ecf20Sopenharmony_cihave meaning, other flags ignored. 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ciFor display, the flags are preceded by ``=`` 2418c2ecf20Sopenharmony_ci(mnemonic: what the flags are currently equal to). 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ciNote the regexp ``^[-+=][flmpt_]+$`` matches a flags specification. 2448c2ecf20Sopenharmony_ciTo clear all flags at once, use ``=_`` or ``-flmpt``. 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ciDebug messages during Boot Process 2488c2ecf20Sopenharmony_ci================================== 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ciTo activate debug messages for core code and built-in modules during 2518c2ecf20Sopenharmony_cithe boot process, even before userspace and debugfs exists, use 2528c2ecf20Sopenharmony_ci``dyndbg="QUERY"``, ``module.dyndbg="QUERY"``, or ``ddebug_query="QUERY"`` 2538c2ecf20Sopenharmony_ci(``ddebug_query`` is obsoleted by ``dyndbg``, and deprecated). QUERY follows 2548c2ecf20Sopenharmony_cithe syntax described above, but must not exceed 1023 characters. Your 2558c2ecf20Sopenharmony_cibootloader may impose lower limits. 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ciThese ``dyndbg`` params are processed just after the ddebug tables are 2588c2ecf20Sopenharmony_ciprocessed, as part of the early_initcall. Thus you can enable debug 2598c2ecf20Sopenharmony_cimessages in all code run after this early_initcall via this boot 2608c2ecf20Sopenharmony_ciparameter. 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ciOn an x86 system for example ACPI enablement is a subsys_initcall and:: 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci dyndbg="file ec.c +p" 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ciwill show early Embedded Controller transactions during ACPI setup if 2678c2ecf20Sopenharmony_ciyour machine (typically a laptop) has an Embedded Controller. 2688c2ecf20Sopenharmony_ciPCI (or other devices) initialization also is a hot candidate for using 2698c2ecf20Sopenharmony_cithis boot parameter for debugging purposes. 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ciIf ``foo`` module is not built-in, ``foo.dyndbg`` will still be processed at 2728c2ecf20Sopenharmony_ciboot time, without effect, but will be reprocessed when module is 2738c2ecf20Sopenharmony_ciloaded later. ``ddebug_query=`` and bare ``dyndbg=`` are only processed at 2748c2ecf20Sopenharmony_ciboot. 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ciDebug Messages at Module Initialization Time 2788c2ecf20Sopenharmony_ci============================================ 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ciWhen ``modprobe foo`` is called, modprobe scans ``/proc/cmdline`` for 2818c2ecf20Sopenharmony_ci``foo.params``, strips ``foo.``, and passes them to the kernel along with 2828c2ecf20Sopenharmony_ciparams given in modprobe args or ``/etc/modprob.d/*.conf`` files, 2838c2ecf20Sopenharmony_ciin the following order: 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci1. parameters given via ``/etc/modprobe.d/*.conf``:: 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci options foo dyndbg=+pt 2888c2ecf20Sopenharmony_ci options foo dyndbg # defaults to +p 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci2. ``foo.dyndbg`` as given in boot args, ``foo.`` is stripped and passed:: 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci foo.dyndbg=" func bar +p; func buz +mp" 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci3. args to modprobe:: 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci modprobe foo dyndbg==pmf # override previous settings 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ciThese ``dyndbg`` queries are applied in order, with last having final say. 2998c2ecf20Sopenharmony_ciThis allows boot args to override or modify those from ``/etc/modprobe.d`` 3008c2ecf20Sopenharmony_ci(sensible, since 1 is system wide, 2 is kernel or boot specific), and 3018c2ecf20Sopenharmony_cimodprobe args to override both. 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ciIn the ``foo.dyndbg="QUERY"`` form, the query must exclude ``module foo``. 3048c2ecf20Sopenharmony_ci``foo`` is extracted from the param-name, and applied to each query in 3058c2ecf20Sopenharmony_ci``QUERY``, and only 1 match-spec of each type is allowed. 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ciThe ``dyndbg`` option is a "fake" module parameter, which means: 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci- modules do not need to define it explicitly 3108c2ecf20Sopenharmony_ci- every module gets it tacitly, whether they use pr_debug or not 3118c2ecf20Sopenharmony_ci- it doesn't appear in ``/sys/module/$module/parameters/`` 3128c2ecf20Sopenharmony_ci To see it, grep the control file, or inspect ``/proc/cmdline.`` 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ciFor ``CONFIG_DYNAMIC_DEBUG`` kernels, any settings given at boot-time (or 3158c2ecf20Sopenharmony_cienabled by ``-DDEBUG`` flag during compilation) can be disabled later via 3168c2ecf20Sopenharmony_cithe debugfs interface if the debug messages are no longer needed:: 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci echo "module module_name -p" > <debugfs>/dynamic_debug/control 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ciExamples 3218c2ecf20Sopenharmony_ci======== 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci:: 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci // enable the message at line 1603 of file svcsock.c 3268c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > 3278c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci // enable all the messages in file svcsock.c 3308c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'file svcsock.c +p' > 3318c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci // enable all the messages in the NFS server module 3348c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'module nfsd +p' > 3358c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci // enable all 12 messages in the function svc_process() 3388c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'func svc_process +p' > 3398c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci // disable all 12 messages in the function svc_process() 3428c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'func svc_process -p' > 3438c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci // enable messages for NFS calls READ, READLINK, READDIR and READDIR+. 3468c2ecf20Sopenharmony_ci nullarbor:~ # echo -n 'format "nfsd: READ" +p' > 3478c2ecf20Sopenharmony_ci <debugfs>/dynamic_debug/control 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci // enable messages in files of which the paths include string "usb" 3508c2ecf20Sopenharmony_ci nullarbor:~ # echo -n '*usb* +p' > <debugfs>/dynamic_debug/control 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci // enable all messages 3538c2ecf20Sopenharmony_ci nullarbor:~ # echo -n '+p' > <debugfs>/dynamic_debug/control 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci // add module, function to all enabled messages 3568c2ecf20Sopenharmony_ci nullarbor:~ # echo -n '+mf' > <debugfs>/dynamic_debug/control 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci // boot-args example, with newlines and comments for readability 3598c2ecf20Sopenharmony_ci Kernel command line: ... 3608c2ecf20Sopenharmony_ci // see whats going on in dyndbg=value processing 3618c2ecf20Sopenharmony_ci dynamic_debug.verbose=1 3628c2ecf20Sopenharmony_ci // enable pr_debugs in 2 builtins, #cmt is stripped 3638c2ecf20Sopenharmony_ci dyndbg="module params +p #cmt ; module sys +p" 3648c2ecf20Sopenharmony_ci // enable pr_debugs in 2 functions in a module loaded later 3658c2ecf20Sopenharmony_ci pc87360.dyndbg="func pc87360_init_device +p; func pc87360_find +p" 366