blob: 6c04aea8f4cd83652fc8de70cb104f2348a1d456 [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
Orson Zhaiceabef72020-06-07 21:40:14 -070016If you do not want to enable dynamic debug globally (i.e. in some embedded
17system), you may set ``CONFIG_DYNAMIC_DEBUG_CORE`` as basic support of dynamic
18debug and add ``ccflags := -DDYNAMIC_DEBUG_MODULE`` into the Makefile of any
19modules which you'd like to dynamically debug later.
20
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030021If ``CONFIG_DYNAMIC_DEBUG`` is not set, ``print_hex_dump_debug()`` is just
22shortcut for ``print_hex_dump(KERN_DEBUG)``.
Vladimir Kondratiev7a555612012-12-05 16:48:27 -050023
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030024For ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is
25its ``prefix_str`` argument, if it is constant string; or ``hexdump``
Randy Dunlap8c188752017-11-17 15:27:39 -080026in case ``prefix_str`` is built dynamically.
Jason Baron86151fd2009-02-05 11:53:15 -050027
28Dynamic debug has even more useful features:
29
Jim Cromie29e36c92012-04-27 14:30:41 -060030 * Simple query language allows turning on and off debugging
31 statements by matching any combination of 0 or 1 of:
Jason Baron86151fd2009-02-05 11:53:15 -050032
33 - source filename
34 - function name
35 - line number (including ranges of line numbers)
36 - module name
37 - format string
38
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030039 * Provides a debugfs control file: ``<debugfs>/dynamic_debug/control``
Jim Cromie29e36c92012-04-27 14:30:41 -060040 which can be read to display the complete list of known debug
41 statements, to help guide you
Jason Baron86151fd2009-02-05 11:53:15 -050042
43Controlling dynamic debug Behaviour
Thomas Renningera648ec02010-08-06 16:11:02 +020044===================================
Jason Baron86151fd2009-02-05 11:53:15 -050045
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030046The behaviour of ``pr_debug()``/``dev_dbg()`` are controlled via writing to a
Jim Cromie29e36c92012-04-27 14:30:41 -060047control file in the 'debugfs' filesystem. Thus, you must first mount
48the debugfs filesystem, in order to make use of this feature.
49Subsequently, we refer to the control file as:
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030050``<debugfs>/dynamic_debug/control``. For example, if you want to enable
51printing from source file ``svcsock.c``, line 1603 you simply do::
Jason Baron86151fd2009-02-05 11:53:15 -050052
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030053 nullarbor:~ # echo 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -050054 <debugfs>/dynamic_debug/control
55
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030056If you make a mistake with the syntax, the write will fail thus::
Jason Baron86151fd2009-02-05 11:53:15 -050057
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030058 nullarbor:~ # echo 'file svcsock.c wtf 1 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -050059 <debugfs>/dynamic_debug/control
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030060 -bash: echo: write error: Invalid argument
Jason Baron86151fd2009-02-05 11:53:15 -050061
Greg Kroah-Hartman239a5792020-02-10 13:11:42 -080062Note, for systems without 'debugfs' enabled, the control file can be
63found in ``/proc/dynamic_debug/control``.
64
Jason Baron86151fd2009-02-05 11:53:15 -050065Viewing Dynamic Debug Behaviour
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030066===============================
Jason Baron86151fd2009-02-05 11:53:15 -050067
Jim Cromie29e36c92012-04-27 14:30:41 -060068You can view the currently configured behaviour of all the debug
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030069statements via::
Jason Baron86151fd2009-02-05 11:53:15 -050070
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030071 nullarbor:~ # cat <debugfs>/dynamic_debug/control
72 # filename:lineno [module]function flags format
Jim Cromiee20e3102020-07-19 17:10:41 -060073 net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012"
74 net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012"
75 net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init =_ "\011sq_depth : %d\012"
76 net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init =_ "\011max_requests : %d\012"
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030077 ...
Jason Baron86151fd2009-02-05 11:53:15 -050078
79
80You can also apply standard Unix text manipulation filters to this
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030081data, e.g.::
Jason Baron86151fd2009-02-05 11:53:15 -050082
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030083 nullarbor:~ # grep -i rdma <debugfs>/dynamic_debug/control | wc -l
84 62
Jason Baron86151fd2009-02-05 11:53:15 -050085
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030086 nullarbor:~ # grep -i tcp <debugfs>/dynamic_debug/control | wc -l
87 42
Jason Baron86151fd2009-02-05 11:53:15 -050088
Jim Cromie29e36c92012-04-27 14:30:41 -060089The third column shows the currently enabled flags for each debug
90statement callsite (see below for definitions of the flags). The
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030091default value, with no flags enabled, is ``=_``. So you can view all
92the debug statement callsites with any non-default flags::
Jason Baron86151fd2009-02-05 11:53:15 -050093
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -030094 nullarbor:~ # awk '$3 != "=_"' <debugfs>/dynamic_debug/control
95 # filename:lineno [module]function flags format
Jim Cromiee20e3102020-07-19 17:10:41 -060096 net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012"
Jason Baron86151fd2009-02-05 11:53:15 -050097
98Command Language Reference
99==========================
100
101At the lexical level, a command comprises a sequence of words separated
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300102by spaces or tabs. So these are all equivalent::
Jason Baron86151fd2009-02-05 11:53:15 -0500103
Steven Price31fc93d2017-01-17 13:38:49 +0000104 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500105 <debugfs>/dynamic_debug/control
Steven Price31fc93d2017-01-17 13:38:49 +0000106 nullarbor:~ # echo -n ' file svcsock.c line 1603 +p ' >
Jason Baron86151fd2009-02-05 11:53:15 -0500107 <debugfs>/dynamic_debug/control
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300108 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500109 <debugfs>/dynamic_debug/control
110
Jim Cromie85f7f6c2011-12-19 17:13:21 -0500111Command submissions are bounded by a write() system call.
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300112Multiple commands can be written together, separated by ``;`` or ``\n``::
Jason Baron86151fd2009-02-05 11:53:15 -0500113
Jim Cromie85f7f6c2011-12-19 17:13:21 -0500114 ~# echo "func pnpacpi_get_resources +p; func pnp_assign_mem +p" \
115 > <debugfs>/dynamic_debug/control
Jason Baron86151fd2009-02-05 11:53:15 -0500116
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300117If your query set is big, you can batch them too::
Jason Baron86151fd2009-02-05 11:53:15 -0500118
Jim Cromie85f7f6c2011-12-19 17:13:21 -0500119 ~# cat query-batch-file > <debugfs>/dynamic_debug/control
Jason Baron86151fd2009-02-05 11:53:15 -0500120
Randy Dunlap1afc5fb2018-10-19 18:10:58 -0700121Another way is to use wildcards. The match rule supports ``*`` (matches
122zero or more characters) and ``?`` (matches exactly one character). For
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300123example, you can match all usb drivers::
Du, Changbin8f073bd2014-01-23 15:54:15 -0800124
125 ~# echo "file drivers/usb/* +p" > <debugfs>/dynamic_debug/control
126
Jason Baron86151fd2009-02-05 11:53:15 -0500127At the syntactical level, a command comprises a sequence of match
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300128specifications, followed by a flags change specification::
Jason Baron86151fd2009-02-05 11:53:15 -0500129
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300130 command ::= match-spec* flags-spec
Jason Baron86151fd2009-02-05 11:53:15 -0500131
Jim Cromie29e36c92012-04-27 14:30:41 -0600132The match-spec's are used to choose a subset of the known pr_debug()
Jason Baron86151fd2009-02-05 11:53:15 -0500133callsites to which to apply the flags-spec. Think of them as a query
134with implicit ANDs between each pair. Note that an empty list of
Jim Cromie29e36c92012-04-27 14:30:41 -0600135match-specs will select all debug statement callsites.
Jason Baron86151fd2009-02-05 11:53:15 -0500136
Jim Cromie29e36c92012-04-27 14:30:41 -0600137A match specification comprises a keyword, which controls the
138attribute of the callsite to be compared, and a value to compare
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300139against. Possible keywords are:::
Jason Baron86151fd2009-02-05 11:53:15 -0500140
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300141 match-spec ::= 'func' string |
142 'file' string |
143 'module' string |
144 'format' string |
145 'line' line-range
Jason Baron86151fd2009-02-05 11:53:15 -0500146
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300147 line-range ::= lineno |
148 '-'lineno |
149 lineno'-' |
150 lineno'-'lineno
Jason Baron86151fd2009-02-05 11:53:15 -0500151
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300152 lineno ::= unsigned-int
153
154.. note::
155
156 ``line-range`` cannot contain space, e.g.
157 "1-30" is valid range but "1 - 30" is not.
158
Jason Baron86151fd2009-02-05 11:53:15 -0500159
160The meanings of each keyword are:
161
162func
163 The given string is compared against the function name
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300164 of each callsite. Example::
Jason Baron86151fd2009-02-05 11:53:15 -0500165
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300166 func svc_tcp_accept
Jim Cromieaaebe322020-07-19 17:10:53 -0600167 func *recv* # in rfcomm, bluetooth, ping, tcp
Jason Baron86151fd2009-02-05 11:53:15 -0500168
169file
Jim Cromiee20e3102020-07-19 17:10:41 -0600170 The given string is compared against either the src-root relative
171 pathname, or the basename of the source file of each callsite.
172 Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500173
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300174 file svcsock.c
Jim Cromiee20e3102020-07-19 17:10:41 -0600175 file kernel/freezer.c # ie column 1 of control file
Jim Cromieaaebe322020-07-19 17:10:53 -0600176 file drivers/usb/* # all callsites under it
177 file inode.c:start_* # parse :tail as a func (above)
178 file inode.c:1-100 # parse :tail as a line-range (above)
Jason Baron86151fd2009-02-05 11:53:15 -0500179
180module
181 The given string is compared against the module name
182 of each callsite. The module name is the string as
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300183 seen in ``lsmod``, i.e. without the directory or the ``.ko``
184 suffix and with ``-`` changed to ``_``. Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500185
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300186 module sunrpc
187 module nfsd
Jim Cromieaaebe322020-07-19 17:10:53 -0600188 module drm* # both drm, drm_kms_helper
Jason Baron86151fd2009-02-05 11:53:15 -0500189
190format
191 The given string is searched for in the dynamic debug format
192 string. Note that the string does not need to match the
193 entire format, only some part. Whitespace and other
194 special characters can be escaped using C octal character
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300195 escape ``\ooo`` notation, e.g. the space character is ``\040``.
Greg Banks9898abb2009-02-06 12:54:26 +1100196 Alternatively, the string can be enclosed in double quote
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300197 characters (``"``) or single quote characters (``'``).
198 Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500199
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300200 format svcrdma: // many of the NFS/RDMA server pr_debugs
201 format readahead // some pr_debugs in the readahead cache
202 format nfsd:\040SETATTR // one way to match a format with whitespace
203 format "nfsd: SETATTR" // a neater way to match a format with whitespace
204 format 'nfsd: SETATTR' // yet another way to match a format with whitespace
Jason Baron86151fd2009-02-05 11:53:15 -0500205
206line
207 The given line number or range of line numbers is compared
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300208 against the line number of each ``pr_debug()`` callsite. A single
Jason Baron86151fd2009-02-05 11:53:15 -0500209 line number matches the callsite line number exactly. A
210 range of line numbers matches any callsite between the first
211 and last line number inclusive. An empty first number means
Randy Dunlap8c188752017-11-17 15:27:39 -0800212 the first line in the file, an empty last line number means the
213 last line number in the file. Examples::
Jason Baron86151fd2009-02-05 11:53:15 -0500214
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300215 line 1603 // exactly line 1603
216 line 1600-1605 // the six lines from line 1600 to line 1605
217 line -1605 // the 1605 lines from line 1 to line 1605
218 line 1600- // all lines from line 1600 to the end of the file
Jason Baron86151fd2009-02-05 11:53:15 -0500219
220The flags specification comprises a change operation followed
221by one or more flag characters. The change operation is one
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300222of the characters::
Jason Baron86151fd2009-02-05 11:53:15 -0500223
Jim Cromie29e36c92012-04-27 14:30:41 -0600224 - remove the given flags
225 + add the given flags
226 = set the flags to the given flags
Jason Baron86151fd2009-02-05 11:53:15 -0500227
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300228The flags are::
Jason Baron86151fd2009-02-05 11:53:15 -0500229
Jim Cromie29e36c92012-04-27 14:30:41 -0600230 p enables the pr_debug() callsite.
231 f Include the function name in the printed message
232 l Include line number in the printed message
233 m Include module name in the printed message
234 t Include thread ID in messages not generated from interrupt context
235 _ No flags are set. (Or'd with others on input)
Jason Baron86151fd2009-02-05 11:53:15 -0500236
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300237For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only ``p`` flag
Vladimir Kondratiev7a555612012-12-05 16:48:27 -0500238have meaning, other flags ignored.
239
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300240For display, the flags are preceded by ``=``
Jim Cromie29e36c92012-04-27 14:30:41 -0600241(mnemonic: what the flags are currently equal to).
242
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300243Note the regexp ``^[-+=][flmpt_]+$`` matches a flags specification.
244To clear all flags at once, use ``=_`` or ``-flmpt``.
Jason Baron86151fd2009-02-05 11:53:15 -0500245
Thomas Renningera648ec02010-08-06 16:11:02 +0200246
Jim Cromie29e36c92012-04-27 14:30:41 -0600247Debug messages during Boot Process
Thomas Renningera648ec02010-08-06 16:11:02 +0200248==================================
249
Jim Cromie29e36c92012-04-27 14:30:41 -0600250To activate debug messages for core code and built-in modules during
251the boot process, even before userspace and debugfs exists, use
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300252``dyndbg="QUERY"``, ``module.dyndbg="QUERY"``, or ``ddebug_query="QUERY"``
253(``ddebug_query`` is obsoleted by ``dyndbg``, and deprecated). QUERY follows
Jim Cromie29e36c92012-04-27 14:30:41 -0600254the syntax described above, but must not exceed 1023 characters. Your
255bootloader may impose lower limits.
Thomas Renningera648ec02010-08-06 16:11:02 +0200256
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300257These ``dyndbg`` params are processed just after the ddebug tables are
Jim Cromiefa080522020-07-19 17:10:42 -0600258processed, as part of the early_initcall. Thus you can enable debug
259messages in all code run after this early_initcall via this boot
Jim Cromie29e36c92012-04-27 14:30:41 -0600260parameter.
261
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300262On an x86 system for example ACPI enablement is a subsys_initcall and::
263
Jim Cromie29e36c92012-04-27 14:30:41 -0600264 dyndbg="file ec.c +p"
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300265
Thomas Renningera648ec02010-08-06 16:11:02 +0200266will show early Embedded Controller transactions during ACPI setup if
267your machine (typically a laptop) has an Embedded Controller.
268PCI (or other devices) initialization also is a hot candidate for using
269this boot parameter for debugging purposes.
270
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300271If ``foo`` module is not built-in, ``foo.dyndbg`` will still be processed at
Jim Cromie29e36c92012-04-27 14:30:41 -0600272boot time, without effect, but will be reprocessed when module is
Randy Dunlap005ae6d2018-10-19 16:55:34 -0700273loaded later. ``ddebug_query=`` and bare ``dyndbg=`` are only processed at
Jim Cromie29e36c92012-04-27 14:30:41 -0600274boot.
275
276
277Debug Messages at Module Initialization Time
278============================================
279
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300280When ``modprobe foo`` is called, modprobe scans ``/proc/cmdline`` for
281``foo.params``, strips ``foo.``, and passes them to the kernel along with
282params given in modprobe args or ``/etc/modprob.d/*.conf`` files,
Jim Cromie29e36c92012-04-27 14:30:41 -0600283in the following order:
284
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -03002851. parameters given via ``/etc/modprobe.d/*.conf``::
Jim Cromie29e36c92012-04-27 14:30:41 -0600286
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300287 options foo dyndbg=+pt
288 options foo dyndbg # defaults to +p
Jim Cromie29e36c92012-04-27 14:30:41 -0600289
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -03002902. ``foo.dyndbg`` as given in boot args, ``foo.`` is stripped and passed::
Jim Cromie29e36c92012-04-27 14:30:41 -0600291
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300292 foo.dyndbg=" func bar +p; func buz +mp"
293
2943. args to modprobe::
295
296 modprobe foo dyndbg==pmf # override previous settings
297
298These ``dyndbg`` queries are applied in order, with last having final say.
299This allows boot args to override or modify those from ``/etc/modprobe.d``
Jim Cromie29e36c92012-04-27 14:30:41 -0600300(sensible, since 1 is system wide, 2 is kernel or boot specific), and
301modprobe args to override both.
302
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300303In the ``foo.dyndbg="QUERY"`` form, the query must exclude ``module foo``.
304``foo`` is extracted from the param-name, and applied to each query in
305``QUERY``, and only 1 match-spec of each type is allowed.
Jim Cromie29e36c92012-04-27 14:30:41 -0600306
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300307The ``dyndbg`` option is a "fake" module parameter, which means:
Jim Cromie29e36c92012-04-27 14:30:41 -0600308
309- modules do not need to define it explicitly
310- every module gets it tacitly, whether they use pr_debug or not
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300311- it doesn't appear in ``/sys/module/$module/parameters/``
312 To see it, grep the control file, or inspect ``/proc/cmdline.``
Jim Cromie29e36c92012-04-27 14:30:41 -0600313
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300314For ``CONFIG_DYNAMIC_DEBUG`` kernels, any settings given at boot-time (or
315enabled by ``-DDEBUG`` flag during compilation) can be disabled later via
Randy Dunlap005ae6d2018-10-19 16:55:34 -0700316the debugfs interface if the debug messages are no longer needed::
Jim Cromie29e36c92012-04-27 14:30:41 -0600317
318 echo "module module_name -p" > <debugfs>/dynamic_debug/control
Thomas Renningera648ec02010-08-06 16:11:02 +0200319
Jason Baron86151fd2009-02-05 11:53:15 -0500320Examples
321========
322
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300323::
324
325 // enable the message at line 1603 of file svcsock.c
326 nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500327 <debugfs>/dynamic_debug/control
328
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300329 // enable all the messages in file svcsock.c
330 nullarbor:~ # echo -n 'file svcsock.c +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500331 <debugfs>/dynamic_debug/control
332
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300333 // enable all the messages in the NFS server module
334 nullarbor:~ # echo -n 'module nfsd +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500335 <debugfs>/dynamic_debug/control
336
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300337 // enable all 12 messages in the function svc_process()
338 nullarbor:~ # echo -n 'func svc_process +p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500339 <debugfs>/dynamic_debug/control
340
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300341 // disable all 12 messages in the function svc_process()
342 nullarbor:~ # echo -n 'func svc_process -p' >
Jason Baron86151fd2009-02-05 11:53:15 -0500343 <debugfs>/dynamic_debug/control
Greg Banks9898abb2009-02-06 12:54:26 +1100344
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300345 // enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
346 nullarbor:~ # echo -n 'format "nfsd: READ" +p' >
Greg Banks9898abb2009-02-06 12:54:26 +1100347 <debugfs>/dynamic_debug/control
Jim Cromie29e36c92012-04-27 14:30:41 -0600348
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300349 // enable messages in files of which the paths include string "usb"
350 nullarbor:~ # echo -n '*usb* +p' > <debugfs>/dynamic_debug/control
Du, Changbin8f073bd2014-01-23 15:54:15 -0800351
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300352 // enable all messages
353 nullarbor:~ # echo -n '+p' > <debugfs>/dynamic_debug/control
Jim Cromie29e36c92012-04-27 14:30:41 -0600354
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300355 // add module, function to all enabled messages
356 nullarbor:~ # echo -n '+mf' > <debugfs>/dynamic_debug/control
Jim Cromie29e36c92012-04-27 14:30:41 -0600357
Mauro Carvalho Chehab7d4e3512016-09-21 16:32:00 -0300358 // boot-args example, with newlines and comments for readability
359 Kernel command line: ...
360 // see whats going on in dyndbg=value processing
361 dynamic_debug.verbose=1
362 // enable pr_debugs in 2 builtins, #cmt is stripped
363 dyndbg="module params +p #cmt ; module sys +p"
364 // enable pr_debugs in 2 functions in a module loaded later
365 pc87360.dyndbg="func pc87360_init_device +p; func pc87360_find +p"