blob: 0dc2eb8e44e5fa56ad19cb1191f182090ee614f8 [file] [log] [blame]
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -03001Dynamic debug
2+++++++++++++
3
Jason Baron86151fd2009-02-05 11:53:15 -05004
5Introduction
6============
7
Jim Cromie29e36c92012-04-27 14:30:41 -06008This document describes how to use the dynamic debug (dyndbg) feature.
Jason Baron86151fd2009-02-05 11:53:15 -05009
Jim Cromie29e36c92012-04-27 14:30:41 -060010Dynamic debug is designed to allow you to dynamically enable/disable
11kernel code to obtain additional kernel information. Currently, if
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030012``CONFIG_DYNAMIC_DEBUG`` is set, then all ``pr_debug()``/``dev_dbg()`` and
13``print_hex_dump_debug()``/``print_hex_dump_bytes()`` calls can be dynamically
Vladimir Kondratiev7a555612012-12-05 16:48:27 -050014enabled per-callsite.
15
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030016If ``CONFIG_DYNAMIC_DEBUG`` is not set, ``print_hex_dump_debug()`` is just
17shortcut for ``print_hex_dump(KERN_DEBUG)``.
Vladimir Kondratiev7a555612012-12-05 16:48:27 -050018
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030019For ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is
20its ``prefix_str`` argument, if it is constant string; or ``hexdump``
Randy Dunlap8c188752017-11-17 15:27:39 -080021in case ``prefix_str`` is built dynamically.
Jason Baron86151fd2009-02-05 11:53:15 -050022
23Dynamic debug has even more useful features:
24
Jim Cromie29e36c92012-04-27 14:30:41 -060025 * Simple query language allows turning on and off debugging
26 statements by matching any combination of 0 or 1 of:
Jason Baron86151fd2009-02-05 11:53:15 -050027
28 - source filename
29 - function name
30 - line number (including ranges of line numbers)
31 - module name
32 - format string
33
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030034 * Provides a debugfs control file: ``<debugfs>/dynamic_debug/control``
Jim Cromie29e36c92012-04-27 14:30:41 -060035 which can be read to display the complete list of known debug
36 statements, to help guide you
Jason Baron86151fd2009-02-05 11:53:15 -050037
38Controlling dynamic debug Behaviour
Thomas Renningera648ec02010-08-06 16:11:02 +020039===================================
Jason Baron86151fd2009-02-05 11:53:15 -050040
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030041The behaviour of ``pr_debug()``/``dev_dbg()`` are controlled via writing to a
Jim Cromie29e36c92012-04-27 14:30:41 -060042control file in the 'debugfs' filesystem. Thus, you must first mount
43the debugfs filesystem, in order to make use of this feature.
44Subsequently, we refer to the control file as:
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030045``<debugfs>/dynamic_debug/control``. For example, if you want to enable
46printing from source file ``svcsock.c``, line 1603 you simply do::
Jason Baron86151fd2009-02-05 11:53:15 -050047
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030048 nullarbor:~ # echo 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -050049 <debugfs>/dynamic_debug/control
50
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030051If you make a mistake with the syntax, the write will fail thus::
Jason Baron86151fd2009-02-05 11:53:15 -050052
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030053 nullarbor:~ # echo 'file svcsock.c wtf 1 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -050054 <debugfs>/dynamic_debug/control
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030055 -bash: echo: write error: Invalid argument
Jason Baron86151fd2009-02-05 11:53:15 -050056
Greg Kroah-Hartman239a5792020-02-10 13:11:42 -080057Note, for systems without 'debugfs' enabled, the control file can be
58found in ``/proc/dynamic_debug/control``.
59
Jason Baron86151fd2009-02-05 11:53:15 -050060Viewing Dynamic Debug Behaviour
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030061===============================
Jason Baron86151fd2009-02-05 11:53:15 -050062
Jim Cromie29e36c92012-04-27 14:30:41 -060063You can view the currently configured behaviour of all the debug
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030064statements via::
Jason Baron86151fd2009-02-05 11:53:15 -050065
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030066 nullarbor:~ # cat <debugfs>/dynamic_debug/control
67 # filename:lineno [module]function flags format
68 /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012"
69 /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012"
70 /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init =_ "\011sq_depth : %d\012"
71 /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init =_ "\011max_requests : %d\012"
72 ...
Jason Baron86151fd2009-02-05 11:53:15 -050073
74
75You can also apply standard Unix text manipulation filters to this
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030076data, e.g.::
Jason Baron86151fd2009-02-05 11:53:15 -050077
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030078 nullarbor:~ # grep -i rdma <debugfs>/dynamic_debug/control | wc -l
79 62
Jason Baron86151fd2009-02-05 11:53:15 -050080
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030081 nullarbor:~ # grep -i tcp <debugfs>/dynamic_debug/control | wc -l
82 42
Jason Baron86151fd2009-02-05 11:53:15 -050083
Jim Cromie29e36c92012-04-27 14:30:41 -060084The third column shows the currently enabled flags for each debug
85statement callsite (see below for definitions of the flags). The
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030086default value, with no flags enabled, is ``=_``. So you can view all
87the debug statement callsites with any non-default flags::
Jason Baron86151fd2009-02-05 11:53:15 -050088
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030089 nullarbor:~ # awk '$3 != "=_"' <debugfs>/dynamic_debug/control
90 # filename:lineno [module]function flags format
91 /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012"
Jason Baron86151fd2009-02-05 11:53:15 -050092
93Command Language Reference
94==========================
95
96At the lexical level, a command comprises a sequence of words separated
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030097by spaces or tabs. So these are all equivalent::
Jason Baron86151fd2009-02-05 11:53:15 -050098
Steven Price31fc93d2017-01-17 13:38:49 +000099 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500100 <debugfs>/dynamic_debug/control
Steven Price31fc93d2017-01-17 13:38:49 +0000101 nullarbor:~ # echo -n ' file svcsock.c line 1603 +p ' >
Jason Baron86151fd2009-02-05 11:53:15 -0500102 <debugfs>/dynamic_debug/control
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300103 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500104 <debugfs>/dynamic_debug/control
105
Jim Cromie85f7f6c2011-12-19 17:13:21 -0500106Command submissions are bounded by a write() system call.
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300107Multiple commands can be written together, separated by ``;`` or ``\n``::
Jason Baron86151fd2009-02-05 11:53:15 -0500108
Jim Cromie85f7f6c2011-12-19 17:13:21 -0500109 ~# echo "func pnpacpi_get_resources +p; func pnp_assign_mem +p" \
110 > <debugfs>/dynamic_debug/control
Jason Baron86151fd2009-02-05 11:53:15 -0500111
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300112If your query set is big, you can batch them too::
Jason Baron86151fd2009-02-05 11:53:15 -0500113
Jim Cromie85f7f6c2011-12-19 17:13:21 -0500114 ~# cat query-batch-file > <debugfs>/dynamic_debug/control
Jason Baron86151fd2009-02-05 11:53:15 -0500115
Randy Dunlap1afc5fb2018-10-19 18:10:58 -0700116Another way is to use wildcards. The match rule supports ``*`` (matches
117zero or more characters) and ``?`` (matches exactly one character). For
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300118example, you can match all usb drivers::
Du, Changbin8f073bd2014-01-23 15:54:15 -0800119
120 ~# echo "file drivers/usb/* +p" > <debugfs>/dynamic_debug/control
121
Jason Baron86151fd2009-02-05 11:53:15 -0500122At the syntactical level, a command comprises a sequence of match
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300123specifications, followed by a flags change specification::
Jason Baron86151fd2009-02-05 11:53:15 -0500124
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300125 command ::= match-spec* flags-spec
Jason Baron86151fd2009-02-05 11:53:15 -0500126
Jim Cromie29e36c92012-04-27 14:30:41 -0600127The match-spec's are used to choose a subset of the known pr_debug()
Jason Baron86151fd2009-02-05 11:53:15 -0500128callsites to which to apply the flags-spec. Think of them as a query
129with implicit ANDs between each pair. Note that an empty list of
Jim Cromie29e36c92012-04-27 14:30:41 -0600130match-specs will select all debug statement callsites.
Jason Baron86151fd2009-02-05 11:53:15 -0500131
Jim Cromie29e36c92012-04-27 14:30:41 -0600132A match specification comprises a keyword, which controls the
133attribute of the callsite to be compared, and a value to compare
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300134against. Possible keywords are:::
Jason Baron86151fd2009-02-05 11:53:15 -0500135
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300136 match-spec ::= 'func' string |
137 'file' string |
138 'module' string |
139 'format' string |
140 'line' line-range
Jason Baron86151fd2009-02-05 11:53:15 -0500141
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300142 line-range ::= lineno |
143 '-'lineno |
144 lineno'-' |
145 lineno'-'lineno
Jason Baron86151fd2009-02-05 11:53:15 -0500146
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300147 lineno ::= unsigned-int
148
149.. note::
150
151 ``line-range`` cannot contain space, e.g.
152 "1-30" is valid range but "1 - 30" is not.
153
Jason Baron86151fd2009-02-05 11:53:15 -0500154
155The meanings of each keyword are:
156
157func
158 The given string is compared against the function name
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300159 of each callsite. Example::
Jason Baron86151fd2009-02-05 11:53:15 -0500160
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300161 func svc_tcp_accept
Jason Baron86151fd2009-02-05 11:53:15 -0500162
163file
Jim Cromie2b678312011-12-19 17:13:12 -0500164 The given string is compared against either the full pathname, the
165 src-root relative pathname, or the basename of the source file of
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300166 each callsite. Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500167
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300168 file svcsock.c
169 file kernel/freezer.c
170 file /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c
Jason Baron86151fd2009-02-05 11:53:15 -0500171
172module
173 The given string is compared against the module name
174 of each callsite. The module name is the string as
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300175 seen in ``lsmod``, i.e. without the directory or the ``.ko``
176 suffix and with ``-`` changed to ``_``. Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500177
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300178 module sunrpc
179 module nfsd
Jason Baron86151fd2009-02-05 11:53:15 -0500180
181format
182 The given string is searched for in the dynamic debug format
183 string. Note that the string does not need to match the
184 entire format, only some part. Whitespace and other
185 special characters can be escaped using C octal character
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300186 escape ``\ooo`` notation, e.g. the space character is ``\040``.
Greg Banks9898abb2009-02-06 12:54:26 +1100187 Alternatively, the string can be enclosed in double quote
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300188 characters (``"``) or single quote characters (``'``).
189 Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500190
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300191 format svcrdma: // many of the NFS/RDMA server pr_debugs
192 format readahead // some pr_debugs in the readahead cache
193 format nfsd:\040SETATTR // one way to match a format with whitespace
194 format "nfsd: SETATTR" // a neater way to match a format with whitespace
195 format 'nfsd: SETATTR' // yet another way to match a format with whitespace
Jason Baron86151fd2009-02-05 11:53:15 -0500196
197line
198 The given line number or range of line numbers is compared
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300199 against the line number of each ``pr_debug()`` callsite. A single
Jason Baron86151fd2009-02-05 11:53:15 -0500200 line number matches the callsite line number exactly. A
201 range of line numbers matches any callsite between the first
202 and last line number inclusive. An empty first number means
Randy Dunlap8c188752017-11-17 15:27:39 -0800203 the first line in the file, an empty last line number means the
204 last line number in the file. Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500205
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300206 line 1603 // exactly line 1603
207 line 1600-1605 // the six lines from line 1600 to line 1605
208 line -1605 // the 1605 lines from line 1 to line 1605
209 line 1600- // all lines from line 1600 to the end of the file
Jason Baron86151fd2009-02-05 11:53:15 -0500210
211The flags specification comprises a change operation followed
212by one or more flag characters. The change operation is one
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300213of the characters::
Jason Baron86151fd2009-02-05 11:53:15 -0500214
Jim Cromie29e36c92012-04-27 14:30:41 -0600215 - remove the given flags
216 + add the given flags
217 = set the flags to the given flags
Jason Baron86151fd2009-02-05 11:53:15 -0500218
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300219The flags are::
Jason Baron86151fd2009-02-05 11:53:15 -0500220
Jim Cromie29e36c92012-04-27 14:30:41 -0600221 p enables the pr_debug() callsite.
222 f Include the function name in the printed message
223 l Include line number in the printed message
224 m Include module name in the printed message
225 t Include thread ID in messages not generated from interrupt context
226 _ No flags are set. (Or'd with others on input)
Jason Baron86151fd2009-02-05 11:53:15 -0500227
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300228For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only ``p`` flag
Vladimir Kondratiev7a555612012-12-05 16:48:27 -0500229have meaning, other flags ignored.
230
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300231For display, the flags are preceded by ``=``
Jim Cromie29e36c92012-04-27 14:30:41 -0600232(mnemonic: what the flags are currently equal to).
233
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300234Note the regexp ``^[-+=][flmpt_]+$`` matches a flags specification.
235To clear all flags at once, use ``=_`` or ``-flmpt``.
Jason Baron86151fd2009-02-05 11:53:15 -0500236
Thomas Renningera648ec02010-08-06 16:11:02 +0200237
Jim Cromie29e36c92012-04-27 14:30:41 -0600238Debug messages during Boot Process
Thomas Renningera648ec02010-08-06 16:11:02 +0200239==================================
240
Jim Cromie29e36c92012-04-27 14:30:41 -0600241To activate debug messages for core code and built-in modules during
242the boot process, even before userspace and debugfs exists, use
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300243``dyndbg="QUERY"``, ``module.dyndbg="QUERY"``, or ``ddebug_query="QUERY"``
244(``ddebug_query`` is obsoleted by ``dyndbg``, and deprecated). QUERY follows
Jim Cromie29e36c92012-04-27 14:30:41 -0600245the syntax described above, but must not exceed 1023 characters. Your
246bootloader may impose lower limits.
Thomas Renningera648ec02010-08-06 16:11:02 +0200247
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300248These ``dyndbg`` params are processed just after the ddebug tables are
Jim Cromie29e36c92012-04-27 14:30:41 -0600249processed, as part of the arch_initcall. Thus you can enable debug
250messages in all code run after this arch_initcall via this boot
251parameter.
252
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300253On an x86 system for example ACPI enablement is a subsys_initcall and::
254
Jim Cromie29e36c92012-04-27 14:30:41 -0600255 dyndbg="file ec.c +p"
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300256
Thomas Renningera648ec02010-08-06 16:11:02 +0200257will show early Embedded Controller transactions during ACPI setup if
258your machine (typically a laptop) has an Embedded Controller.
259PCI (or other devices) initialization also is a hot candidate for using
260this boot parameter for debugging purposes.
261
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300262If ``foo`` module is not built-in, ``foo.dyndbg`` will still be processed at
Jim Cromie29e36c92012-04-27 14:30:41 -0600263boot time, without effect, but will be reprocessed when module is
Randy Dunlap005ae6d2018-10-19 16:55:34 -0700264loaded later. ``ddebug_query=`` and bare ``dyndbg=`` are only processed at
Jim Cromie29e36c92012-04-27 14:30:41 -0600265boot.
266
267
268Debug Messages at Module Initialization Time
269============================================
270
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300271When ``modprobe foo`` is called, modprobe scans ``/proc/cmdline`` for
272``foo.params``, strips ``foo.``, and passes them to the kernel along with
273params given in modprobe args or ``/etc/modprob.d/*.conf`` files,
Jim Cromie29e36c92012-04-27 14:30:41 -0600274in the following order:
275
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -03002761. parameters given via ``/etc/modprobe.d/*.conf``::
Jim Cromie29e36c92012-04-27 14:30:41 -0600277
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300278 options foo dyndbg=+pt
279 options foo dyndbg # defaults to +p
Jim Cromie29e36c92012-04-27 14:30:41 -0600280
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -03002812. ``foo.dyndbg`` as given in boot args, ``foo.`` is stripped and passed::
Jim Cromie29e36c92012-04-27 14:30:41 -0600282
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300283 foo.dyndbg=" func bar +p; func buz +mp"
284
2853. args to modprobe::
286
287 modprobe foo dyndbg==pmf # override previous settings
288
289These ``dyndbg`` queries are applied in order, with last having final say.
290This allows boot args to override or modify those from ``/etc/modprobe.d``
Jim Cromie29e36c92012-04-27 14:30:41 -0600291(sensible, since 1 is system wide, 2 is kernel or boot specific), and
292modprobe args to override both.
293
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300294In the ``foo.dyndbg="QUERY"`` form, the query must exclude ``module foo``.
295``foo`` is extracted from the param-name, and applied to each query in
296``QUERY``, and only 1 match-spec of each type is allowed.
Jim Cromie29e36c92012-04-27 14:30:41 -0600297
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300298The ``dyndbg`` option is a "fake" module parameter, which means:
Jim Cromie29e36c92012-04-27 14:30:41 -0600299
300- modules do not need to define it explicitly
301- every module gets it tacitly, whether they use pr_debug or not
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300302- it doesn't appear in ``/sys/module/$module/parameters/``
303 To see it, grep the control file, or inspect ``/proc/cmdline.``
Jim Cromie29e36c92012-04-27 14:30:41 -0600304
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300305For ``CONFIG_DYNAMIC_DEBUG`` kernels, any settings given at boot-time (or
306enabled by ``-DDEBUG`` flag during compilation) can be disabled later via
Randy Dunlap005ae6d2018-10-19 16:55:34 -0700307the debugfs interface if the debug messages are no longer needed::
Jim Cromie29e36c92012-04-27 14:30:41 -0600308
309 echo "module module_name -p" > <debugfs>/dynamic_debug/control
Thomas Renningera648ec02010-08-06 16:11:02 +0200310
Jason Baron86151fd2009-02-05 11:53:15 -0500311Examples
312========
313
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300314::
315
316 // enable the message at line 1603 of file svcsock.c
317 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500318 <debugfs>/dynamic_debug/control
319
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300320 // enable all the messages in file svcsock.c
321 nullarbor:~ # echo -n 'file svcsock.c +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500322 <debugfs>/dynamic_debug/control
323
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300324 // enable all the messages in the NFS server module
325 nullarbor:~ # echo -n 'module nfsd +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500326 <debugfs>/dynamic_debug/control
327
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300328 // enable all 12 messages in the function svc_process()
329 nullarbor:~ # echo -n 'func svc_process +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500330 <debugfs>/dynamic_debug/control
331
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300332 // disable all 12 messages in the function svc_process()
333 nullarbor:~ # echo -n 'func svc_process -p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500334 <debugfs>/dynamic_debug/control
Greg Banks9898abb2009-02-06 12:54:26 +1100335
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300336 // enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
337 nullarbor:~ # echo -n 'format "nfsd: READ" +p' >
Greg Banks9898abb2009-02-06 12:54:26 +1100338 <debugfs>/dynamic_debug/control
Jim Cromie29e36c92012-04-27 14:30:41 -0600339
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300340 // enable messages in files of which the paths include string "usb"
341 nullarbor:~ # echo -n '*usb* +p' > <debugfs>/dynamic_debug/control
Du, Changbin8f073bd2014-01-23 15:54:15 -0800342
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300343 // enable all messages
344 nullarbor:~ # echo -n '+p' > <debugfs>/dynamic_debug/control
Jim Cromie29e36c92012-04-27 14:30:41 -0600345
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300346 // add module, function to all enabled messages
347 nullarbor:~ # echo -n '+mf' > <debugfs>/dynamic_debug/control
Jim Cromie29e36c92012-04-27 14:30:41 -0600348
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300349 // boot-args example, with newlines and comments for readability
350 Kernel command line: ...
351 // see whats going on in dyndbg=value processing
352 dynamic_debug.verbose=1
353 // enable pr_debugs in 2 builtins, #cmt is stripped
354 dyndbg="module params +p #cmt ; module sys +p"
355 // enable pr_debugs in 2 functions in a module loaded later
356 pc87360.dyndbg="func pc87360_init_device +p; func pc87360_find +p"