Lines Matching refs:debug
4 files: arch/s390/kernel/debug.c
5 arch/s390/include/asm/debug.h
9 The goal of this feature is to provide a kernel debug logging API
11 (e.g. device drivers) can have one separate debug log.
12 One purpose of this is to inspect the debug logs after a production system crash
15 it is possible to look at the debug logs on a live system via the Linux
17 The debug feature may also very useful for kernel and driver development.
21 Kernel components (e.g. device drivers) can register themselves at the debug
23 debug log for the caller. For each debug log exists a number of debug areas
24 where exactly one is active at one time. Each debug area consists of contiguous
25 pages in memory. In the debug areas there are stored debug entries (log records)
28 An event-call writes the specified debug entry to the active debug
30 of the active debug area is reached, a wrap around is done (ring buffer)
31 and the next debug entry will be written at the beginning of the active
32 debug area.
34 An exception-call writes the specified debug entry to the log and
35 switches to the next debug area. This is done in order to be sure
39 The debug areas themselves are also ordered in form of a ring buffer.
40 When an exception is thrown in the last debug area, the following debug
46 Each debug entry contains the following data:
50 - Level of debug entry (0...6)
54 The debug logs can be inspected in a live system through entries in
58 /sys/kernel/debug therefore the debug feature can be accessed under
59 /sys/kernel/debug/s390dbf.
62 to the debug log. Each component can decide which views should be
68 All debug logs have an actual debug level (range from 0 to 6).
70 parameter. Only debug entries with a level that is lower or equal
74 The actual debug level can be changed with the help of the debugfs-filesystem
76 provided for every debug log. Debugging can be switched off completely
81 > echo "-" > /sys/kernel/debug/s390dbf/dasd/level
83 It is also possible to deactivate the debug feature globally for every
84 debug log. You can change the behavior using 2 sysctl parameters in
86 There are currently 2 possible triggers, which stop the debug feature
88 set to 1 the debug feature is running. If "debug_active" is set to 0 the
89 debug feature is turned off.
90 The second trigger which stops the debug feature is a kernel oops.
91 That prevents the debug feature from overwriting debug information that
92 happened before the oops. After an oops you can reactivate the debug feature
95 If you want to disallow the deactivation of the debug feature, you can use
96 the "debug_stoppable" sysctl. If you set "debug_stoppable" to 0 the debug
97 feature cannot be stopped. If the debug feature is already stopped, it
107 Parameter: name: Name of debug log (e.g. used for debugfs entry)
109 nr_areas: number of debug areas
110 buf_size: size of data area in each debug entry
112 Return Value: Handle for generated debug area
115 Description: Allocates memory for a debug log
123 Parameter: name: Name of debug log (e.g. used for debugfs entry)
125 nr_areas: Number of debug areas
126 buf_size: Size of data area in each debug entry
133 Return Value: Handle for generated debug area
136 Description: Allocates memory for a debug log
142 Parameter: id: handle for debug log
146 Description: frees memory for a debug log and removes all registered debug
153 Parameter: id: handle for debug log
154 new_level: new debug level
158 Description: Sets new actual debug level if new_level is valid.
163 Parameter: id: handle for debug log
164 level: debug level
166 Return Value: True if level is less or equal to the current debug level.
168 Description: Returns true if debug events for the specified level would be
177 Description: stops the debug feature if stopping is allowed. Currently
184 Parameter: id: handle for debug log
185 level: debug level
186 data: pointer to data for debug entry
189 Return Value: Address of written debug entry
191 Description: writes debug entry to active debug area (if level <= actual
192 debug level)
200 Parameter: id: handle for debug log
201 level: debug level
202 data: integer value for debug entry
204 Return Value: Address of written debug entry
206 Description: writes debug entry to active debug area (if level <= actual
207 debug level)
213 Parameter: id: handle for debug log
214 level: debug level
215 data: string for debug entry
217 Return Value: Address of written debug entry
219 Description: writes debug entry in ascii format to active debug area
220 (if level <= actual debug level)
226 Parameter: id: handle for debug log
227 level: debug level
228 string: format string for debug entry
231 Return Value: Address of written debug entry
233 Description: writes debug entry with format string and varargs (longs) to
234 active debug area (if level $<=$ actual debug level).
242 Parameter: id: handle for debug log
243 level: debug level
244 data: pointer to data for debug entry
247 Return Value: Address of written debug entry
249 Description: writes debug entry to active debug area (if level <= actual
250 debug level) and switches to next debug area
258 Parameter: id: handle for debug log
259 level: debug level
260 data: integer value for debug entry
262 Return Value: Address of written debug entry
264 Description: writes debug entry to active debug area (if level <= actual
265 debug level) and switches to next debug area
271 Parameter: id: handle for debug log
272 level: debug level
273 data: string for debug entry
275 Return Value: Address of written debug entry
277 Description: writes debug entry in ascii format to active debug area
278 (if level <= actual debug level) and switches to next debug
285 Parameter: id: handle for debug log
286 level: debug level
287 string: format string for debug entry
290 Return Value: Address of written debug entry
292 Description: writes debug entry with format string and varargs (longs) to
293 active debug area (if level $<=$ actual debug level) and
294 switches to next debug area.
301 Parameter: id: handle for debug log
302 view: pointer to debug view struct
307 Description: registers new debug view and creates debugfs dir entry
312 Parameter: id: handle for debug log
313 view: pointer to debug view struct
318 Description: unregisters debug view and removes debugfs dir entry
337 #include <asm/debug.h>
343 /* register 4 debug areas with one page each and 4 byte data field */
371 #include <asm/debug.h>
377 /* register 4 debug areas with one page each and data field for */
384 debug_sprintf_exception(debug_info, 1, "pointer to debug info: %p\n",&debug_info);
401 Views to the debug logs can be investigated through reading the corresponding
406 > ls /sys/kernel/debug/s390dbf/dasd
408 > cat /sys/kernel/debug/s390dbf/dasd/hex_ascii | sort +1
422 Changing the debug level
428 > cat /sys/kernel/debug/s390dbf/dasd/level
430 > echo "5" > /sys/kernel/debug/s390dbf/dasd/level
431 > cat /sys/kernel/debug/s390dbf/dasd/level
434 Flushing debug areas
437 area (0...n) to the debugfs file "flush". When using "-" all debug areas
442 1. Flush debug area 0:
443 > echo "0" > /sys/kernel/debug/s390dbf/dasd/flush
445 2. Flush all debug areas:
446 > echo "-" > /sys/kernel/debug/s390dbf/dasd/flush
448 Changing the size of debug areas
450 It is possible the change the size of debug areas through piping
452 also flush the debug areas.
456 Define 4 pages for the debug areas of debug feature "dasd":
457 > echo "4" > /sys/kernel/debug/s390dbf/dasd/pages
459 Stooping the debug feature
465 2. Stop debug feature
471 's390dbf' to display all the debug logs. With this tool it will be possible
472 to investigate the debug logs on a live system and with a memory dump after
477 One last possibility to investigate the debug logs at a live
480 It is possible to find the anker of the debug-logs through
483 in debug.h and find the debug-areas in memory.
484 Normally modules which use the debug feature will also have
485 a global variable with the pointer to the debug-logs. Following
486 this pointer it will also be possible to find the debug logs in
491 order to see the debug entries well formatted.
500 The raw view returns a bytestream as the debug areas are stored in memory.
502 The sprintf view formats the debug entries in the same way as the sprintf
504 debug entry a pointer to the format string (size = sizeof(long))
505 and for each vararg a long value. So e.g. for a debug entry with a format
511 available as long as the debug feature exists. The reason behind this is that
513 the debug feature. If you log a string that is freed afterwards, you will get
514 an OOPS when inspecting the debug feature, because then the debug feature will
524 - level of debug entry
531 - Header as described in debug.h
578 It is not used by the debug feature itself.
592 existing debug entry.
595 the view (e.g. like with 'echo "0" > /sys/kernel/debug/s390dbf/dasd/level).
598 debug_dflt_header_fn() which is defined in debug.h.
608 #include <asm/debug.h>
657 > cat /sys/kernel/debug/s390dbf/test/myview