diff options
author | Steffen Maier <maier@linux.ibm.com> | 2019-07-03 06:19:49 -0400 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2019-07-05 07:42:24 -0400 |
commit | 499723d12063aab97dfe6b41c822e9c1c74eff3e (patch) | |
tree | 3cb13679fe8b34704d394385a6787f71720ee13d | |
parent | 0328e519a726ff6e4abacba838eb00415171c34b (diff) |
docs: s390: s390dbf: typos and formatting, update crash command
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1562149189-1417-4-git-send-email-maier@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r-- | Documentation/s390/s390dbf.rst | 122 |
1 files changed, 68 insertions, 54 deletions
diff --git a/Documentation/s390/s390dbf.rst b/Documentation/s390/s390dbf.rst index be42892b159e..cdb36842b898 100644 --- a/Documentation/s390/s390dbf.rst +++ b/Documentation/s390/s390dbf.rst | |||
@@ -23,7 +23,8 @@ The debug feature may also very useful for kernel and driver development. | |||
23 | Design: | 23 | Design: |
24 | ------- | 24 | ------- |
25 | Kernel components (e.g. device drivers) can register themselves at the debug | 25 | Kernel components (e.g. device drivers) can register themselves at the debug |
26 | feature with the function call debug_register(). This function initializes a | 26 | feature with the function call :c:func:`debug_register()`. |
27 | This function initializes a | ||
27 | debug log for the caller. For each debug log exists a number of debug areas | 28 | debug log for the caller. For each debug log exists a number of debug areas |
28 | where exactly one is active at one time. Each debug area consists of contiguous | 29 | where exactly one is active at one time. Each debug area consists of contiguous |
29 | pages in memory. In the debug areas there are stored debug entries (log records) | 30 | pages in memory. In the debug areas there are stored debug entries (log records) |
@@ -44,8 +45,9 @@ The debug areas themselves are also ordered in form of a ring buffer. | |||
44 | When an exception is thrown in the last debug area, the following debug | 45 | When an exception is thrown in the last debug area, the following debug |
45 | entries are then written again in the very first area. | 46 | entries are then written again in the very first area. |
46 | 47 | ||
47 | There are three versions for the event- and exception-calls: One for | 48 | There are four versions for the event- and exception-calls: One for |
48 | logging raw data, one for text and one for numbers. | 49 | logging raw data, one for text, one for numbers (unsigned int and long), |
50 | and one for sprintf-like formatted strings. | ||
49 | 51 | ||
50 | Each debug entry contains the following data: | 52 | Each debug entry contains the following data: |
51 | 53 | ||
@@ -56,29 +58,29 @@ Each debug entry contains the following data: | |||
56 | - Flag, if entry is an exception or not | 58 | - Flag, if entry is an exception or not |
57 | 59 | ||
58 | The debug logs can be inspected in a live system through entries in | 60 | The debug logs can be inspected in a live system through entries in |
59 | the debugfs-filesystem. Under the toplevel directory "s390dbf" there is | 61 | the debugfs-filesystem. Under the toplevel directory "``s390dbf``" there is |
60 | a directory for each registered component, which is named like the | 62 | a directory for each registered component, which is named like the |
61 | corresponding component. The debugfs normally should be mounted to | 63 | corresponding component. The debugfs normally should be mounted to |
62 | /sys/kernel/debug therefore the debug feature can be accessed under | 64 | ``/sys/kernel/debug`` therefore the debug feature can be accessed under |
63 | /sys/kernel/debug/s390dbf. | 65 | ``/sys/kernel/debug/s390dbf``. |
64 | 66 | ||
65 | The content of the directories are files which represent different views | 67 | The content of the directories are files which represent different views |
66 | to the debug log. Each component can decide which views should be | 68 | to the debug log. Each component can decide which views should be |
67 | used through registering them with the function debug_register_view(). | 69 | used through registering them with the function :c:func:`debug_register_view()`. |
68 | Predefined views for hex/ascii, sprintf and raw binary data are provided. | 70 | Predefined views for hex/ascii, sprintf and raw binary data are provided. |
69 | It is also possible to define other views. The content of | 71 | It is also possible to define other views. The content of |
70 | a view can be inspected simply by reading the corresponding debugfs file. | 72 | a view can be inspected simply by reading the corresponding debugfs file. |
71 | 73 | ||
72 | All debug logs have an actual debug level (range from 0 to 6). | 74 | All debug logs have an actual debug level (range from 0 to 6). |
73 | The default level is 3. Event and Exception functions have a 'level' | 75 | The default level is 3. Event and Exception functions have a :c:data:`level` |
74 | parameter. Only debug entries with a level that is lower or equal | 76 | parameter. Only debug entries with a level that is lower or equal |
75 | than the actual level are written to the log. This means, when | 77 | than the actual level are written to the log. This means, when |
76 | writing events, high priority log entries should have a low level | 78 | writing events, high priority log entries should have a low level |
77 | value whereas low priority entries should have a high one. | 79 | value whereas low priority entries should have a high one. |
78 | The actual debug level can be changed with the help of the debugfs-filesystem | 80 | The actual debug level can be changed with the help of the debugfs-filesystem |
79 | through writing a number string "x" to the 'level' debugfs file which is | 81 | through writing a number string "x" to the ``level`` debugfs file which is |
80 | provided for every debug log. Debugging can be switched off completely | 82 | provided for every debug log. Debugging can be switched off completely |
81 | by using "-" on the 'level' debugfs file. | 83 | by using "-" on the ``level`` debugfs file. |
82 | 84 | ||
83 | Example:: | 85 | Example:: |
84 | 86 | ||
@@ -86,21 +88,21 @@ Example:: | |||
86 | 88 | ||
87 | It is also possible to deactivate the debug feature globally for every | 89 | It is also possible to deactivate the debug feature globally for every |
88 | debug log. You can change the behavior using 2 sysctl parameters in | 90 | debug log. You can change the behavior using 2 sysctl parameters in |
89 | /proc/sys/s390dbf: | 91 | ``/proc/sys/s390dbf``: |
90 | 92 | ||
91 | There are currently 2 possible triggers, which stop the debug feature | 93 | There are currently 2 possible triggers, which stop the debug feature |
92 | globally. The first possibility is to use the "debug_active" sysctl. If | 94 | globally. The first possibility is to use the ``debug_active`` sysctl. If |
93 | set to 1 the debug feature is running. If "debug_active" is set to 0 the | 95 | set to 1 the debug feature is running. If ``debug_active`` is set to 0 the |
94 | debug feature is turned off. | 96 | debug feature is turned off. |
95 | 97 | ||
96 | The second trigger which stops the debug feature is a kernel oops. | 98 | The second trigger which stops the debug feature is a kernel oops. |
97 | That prevents the debug feature from overwriting debug information that | 99 | That prevents the debug feature from overwriting debug information that |
98 | happened before the oops. After an oops you can reactivate the debug feature | 100 | happened before the oops. After an oops you can reactivate the debug feature |
99 | by piping 1 to /proc/sys/s390dbf/debug_active. Nevertheless, its not | 101 | by piping 1 to ``/proc/sys/s390dbf/debug_active``. Nevertheless, it's not |
100 | suggested to use an oopsed kernel in a production environment. | 102 | suggested to use an oopsed kernel in a production environment. |
101 | 103 | ||
102 | If you want to disallow the deactivation of the debug feature, you can use | 104 | If you want to disallow the deactivation of the debug feature, you can use |
103 | the "debug_stoppable" sysctl. If you set "debug_stoppable" to 0 the debug | 105 | the ``debug_stoppable`` sysctl. If you set ``debug_stoppable`` to 0 the debug |
104 | feature cannot be stopped. If the debug feature is already stopped, it | 106 | feature cannot be stopped. If the debug feature is already stopped, it |
105 | will stay deactivated. | 107 | will stay deactivated. |
106 | 108 | ||
@@ -113,16 +115,18 @@ Kernel Interfaces: | |||
113 | Predefined views: | 115 | Predefined views: |
114 | ----------------- | 116 | ----------------- |
115 | 117 | ||
116 | extern struct debug_view debug_hex_ascii_view; | 118 | .. code-block:: c |
117 | 119 | ||
118 | extern struct debug_view debug_raw_view; | 120 | extern struct debug_view debug_hex_ascii_view; |
119 | 121 | ||
120 | extern struct debug_view debug_sprintf_view; | 122 | extern struct debug_view debug_raw_view; |
123 | |||
124 | extern struct debug_view debug_sprintf_view; | ||
121 | 125 | ||
122 | Examples | 126 | Examples |
123 | -------- | 127 | -------- |
124 | 128 | ||
125 | :: | 129 | .. code-block:: c |
126 | 130 | ||
127 | /* | 131 | /* |
128 | * hex_ascii- + raw-view Example | 132 | * hex_ascii- + raw-view Example |
@@ -131,15 +135,15 @@ Examples | |||
131 | #include <linux/init.h> | 135 | #include <linux/init.h> |
132 | #include <asm/debug.h> | 136 | #include <asm/debug.h> |
133 | 137 | ||
134 | static debug_info_t* debug_info; | 138 | static debug_info_t *debug_info; |
135 | 139 | ||
136 | static int init(void) | 140 | static int init(void) |
137 | { | 141 | { |
138 | /* register 4 debug areas with one page each and 4 byte data field */ | 142 | /* register 4 debug areas with one page each and 4 byte data field */ |
139 | 143 | ||
140 | debug_info = debug_register ("test", 1, 4, 4 ); | 144 | debug_info = debug_register("test", 1, 4, 4 ); |
141 | debug_register_view(debug_info,&debug_hex_ascii_view); | 145 | debug_register_view(debug_info, &debug_hex_ascii_view); |
142 | debug_register_view(debug_info,&debug_raw_view); | 146 | debug_register_view(debug_info, &debug_raw_view); |
143 | 147 | ||
144 | debug_text_event(debug_info, 4 , "one "); | 148 | debug_text_event(debug_info, 4 , "one "); |
145 | debug_int_exception(debug_info, 4, 4711); | 149 | debug_int_exception(debug_info, 4, 4711); |
@@ -150,13 +154,13 @@ Examples | |||
150 | 154 | ||
151 | static void cleanup(void) | 155 | static void cleanup(void) |
152 | { | 156 | { |
153 | debug_unregister (debug_info); | 157 | debug_unregister(debug_info); |
154 | } | 158 | } |
155 | 159 | ||
156 | module_init(init); | 160 | module_init(init); |
157 | module_exit(cleanup); | 161 | module_exit(cleanup); |
158 | 162 | ||
159 | :: | 163 | .. code-block:: c |
160 | 164 | ||
161 | /* | 165 | /* |
162 | * sprintf-view Example | 166 | * sprintf-view Example |
@@ -165,15 +169,15 @@ Examples | |||
165 | #include <linux/init.h> | 169 | #include <linux/init.h> |
166 | #include <asm/debug.h> | 170 | #include <asm/debug.h> |
167 | 171 | ||
168 | static debug_info_t* debug_info; | 172 | static debug_info_t *debug_info; |
169 | 173 | ||
170 | static int init(void) | 174 | static int init(void) |
171 | { | 175 | { |
172 | /* register 4 debug areas with one page each and data field for */ | 176 | /* register 4 debug areas with one page each and data field for */ |
173 | /* format string pointer + 2 varargs (= 3 * sizeof(long)) */ | 177 | /* format string pointer + 2 varargs (= 3 * sizeof(long)) */ |
174 | 178 | ||
175 | debug_info = debug_register ("test", 1, 4, sizeof(long) * 3); | 179 | debug_info = debug_register("test", 1, 4, sizeof(long) * 3); |
176 | debug_register_view(debug_info,&debug_sprintf_view); | 180 | debug_register_view(debug_info, &debug_sprintf_view); |
177 | 181 | ||
178 | debug_sprintf_event(debug_info, 2 , "first event in %s:%i\n",__FILE__,__LINE__); | 182 | debug_sprintf_event(debug_info, 2 , "first event in %s:%i\n",__FILE__,__LINE__); |
179 | debug_sprintf_exception(debug_info, 1, "pointer to debug info: %p\n",&debug_info); | 183 | debug_sprintf_exception(debug_info, 1, "pointer to debug info: %p\n",&debug_info); |
@@ -183,7 +187,7 @@ Examples | |||
183 | 187 | ||
184 | static void cleanup(void) | 188 | static void cleanup(void) |
185 | { | 189 | { |
186 | debug_unregister (debug_info); | 190 | debug_unregister(debug_info); |
187 | } | 191 | } |
188 | 192 | ||
189 | module_init(init); | 193 | module_init(init); |
@@ -252,7 +256,7 @@ Define 4 pages for the debug areas of debug feature "dasd":: | |||
252 | 256 | ||
253 | > echo "4" > /sys/kernel/debug/s390dbf/dasd/pages | 257 | > echo "4" > /sys/kernel/debug/s390dbf/dasd/pages |
254 | 258 | ||
255 | Stooping the debug feature | 259 | Stopping the debug feature |
256 | -------------------------- | 260 | -------------------------- |
257 | Example: | 261 | Example: |
258 | 262 | ||
@@ -264,10 +268,11 @@ Example: | |||
264 | 268 | ||
265 | > echo 0 > /proc/sys/s390dbf/debug_active | 269 | > echo 0 > /proc/sys/s390dbf/debug_active |
266 | 270 | ||
267 | lcrash Interface | 271 | crash Interface |
268 | ---------------- | 272 | ---------------- |
269 | It is planned that the dump analysis tool lcrash gets an additional command | 273 | The ``crash`` tool since v5.1.0 has a built-in command |
270 | 's390dbf' to display all the debug logs. With this tool it will be possible | 274 | ``s390dbf`` to display all the debug logs or export them to the file system. |
275 | With this tool it is possible | ||
271 | to investigate the debug logs on a live system and with a memory dump after | 276 | to investigate the debug logs on a live system and with a memory dump after |
272 | a system crash. | 277 | a system crash. |
273 | 278 | ||
@@ -276,8 +281,8 @@ Investigating raw memory | |||
276 | One last possibility to investigate the debug logs at a live | 281 | One last possibility to investigate the debug logs at a live |
277 | system and after a system crash is to look at the raw memory | 282 | system and after a system crash is to look at the raw memory |
278 | under VM or at the Service Element. | 283 | under VM or at the Service Element. |
279 | It is possible to find the anker of the debug-logs through | 284 | It is possible to find the anchor of the debug-logs through |
280 | the 'debug_area_first' symbol in the System map. Then one has | 285 | the ``debug_area_first`` symbol in the System map. Then one has |
281 | to follow the correct pointers of the data-structures defined | 286 | to follow the correct pointers of the data-structures defined |
282 | in debug.h and find the debug-areas in memory. | 287 | in debug.h and find the debug-areas in memory. |
283 | Normally modules which use the debug feature will also have | 288 | Normally modules which use the debug feature will also have |
@@ -286,7 +291,7 @@ this pointer it will also be possible to find the debug logs in | |||
286 | memory. | 291 | memory. |
287 | 292 | ||
288 | For this method it is recommended to use '16 * x + 4' byte (x = 0..n) | 293 | For this method it is recommended to use '16 * x + 4' byte (x = 0..n) |
289 | for the length of the data field in debug_register() in | 294 | for the length of the data field in :c:func:`debug_register()` in |
290 | order to see the debug entries well formatted. | 295 | order to see the debug entries well formatted. |
291 | 296 | ||
292 | 297 | ||
@@ -295,7 +300,7 @@ Predefined Views | |||
295 | 300 | ||
296 | There are three predefined views: hex_ascii, raw and sprintf. | 301 | There are three predefined views: hex_ascii, raw and sprintf. |
297 | The hex_ascii view shows the data field in hex and ascii representation | 302 | The hex_ascii view shows the data field in hex and ascii representation |
298 | (e.g. '45 43 4b 44 | ECKD'). | 303 | (e.g. ``45 43 4b 44 | ECKD``). |
299 | The raw view returns a bytestream as the debug areas are stored in memory. | 304 | The raw view returns a bytestream as the debug areas are stored in memory. |
300 | 305 | ||
301 | The sprintf view formats the debug entries in the same way as the sprintf | 306 | The sprintf view formats the debug entries in the same way as the sprintf |
@@ -335,18 +340,20 @@ The format of the raw view is: | |||
335 | - datafield | 340 | - datafield |
336 | 341 | ||
337 | A typical line of the hex_ascii view will look like the following (first line | 342 | A typical line of the hex_ascii view will look like the following (first line |
338 | is only for explanation and will not be displayed when 'cating' the view): | 343 | is only for explanation and will not be displayed when 'cating' the view):: |
339 | 344 | ||
340 | area time level exception cpu caller data (hex + ascii) | 345 | area time level exception cpu caller data (hex + ascii) |
341 | -------------------------------------------------------------------------- | 346 | -------------------------------------------------------------------------- |
342 | 00 00964419409:440690 1 - 00 88023fe | 347 | 00 00964419409:440690 1 - 00 88023fe |
343 | 348 | ||
344 | 349 | ||
345 | Defining views | 350 | Defining views |
346 | -------------- | 351 | -------------- |
347 | 352 | ||
348 | Views are specified with the 'debug_view' structure. There are defined | 353 | Views are specified with the 'debug_view' structure. There are defined |
349 | callback functions which are used for reading and writing the debugfs files:: | 354 | callback functions which are used for reading and writing the debugfs files: |
355 | |||
356 | .. code-block:: c | ||
350 | 357 | ||
351 | struct debug_view { | 358 | struct debug_view { |
352 | char name[DEBUG_MAX_PROCF_LEN]; | 359 | char name[DEBUG_MAX_PROCF_LEN]; |
@@ -357,7 +364,9 @@ callback functions which are used for reading and writing the debugfs files:: | |||
357 | void* private_data; | 364 | void* private_data; |
358 | }; | 365 | }; |
359 | 366 | ||
360 | where:: | 367 | where: |
368 | |||
369 | .. code-block:: c | ||
361 | 370 | ||
362 | typedef int (debug_header_proc_t) (debug_info_t* id, | 371 | typedef int (debug_header_proc_t) (debug_info_t* id, |
363 | struct debug_view* view, | 372 | struct debug_view* view, |
@@ -395,10 +404,10 @@ Then 'header_proc' and 'format_proc' are called for each | |||
395 | existing debug entry. | 404 | existing debug entry. |
396 | 405 | ||
397 | The input_proc can be used to implement functionality when it is written to | 406 | The input_proc can be used to implement functionality when it is written to |
398 | the view (e.g. like with 'echo "0" > /sys/kernel/debug/s390dbf/dasd/level). | 407 | the view (e.g. like with ``echo "0" > /sys/kernel/debug/s390dbf/dasd/level``). |
399 | 408 | ||
400 | For header_proc there can be used the default function | 409 | For header_proc there can be used the default function |
401 | debug_dflt_header_fn() which is defined in debug.h. | 410 | :c:func:`debug_dflt_header_fn()` which is defined in debug.h. |
402 | and which produces the same header output as the predefined views. | 411 | and which produces the same header output as the predefined views. |
403 | E.g:: | 412 | E.g:: |
404 | 413 | ||
@@ -407,7 +416,9 @@ E.g:: | |||
407 | In order to see how to use the callback functions check the implementation | 416 | In order to see how to use the callback functions check the implementation |
408 | of the default views! | 417 | of the default views! |
409 | 418 | ||
410 | Example:: | 419 | Example: |
420 | |||
421 | .. code-block:: c | ||
411 | 422 | ||
412 | #include <asm/debug.h> | 423 | #include <asm/debug.h> |
413 | 424 | ||
@@ -423,21 +434,20 @@ Example:: | |||
423 | }; | 434 | }; |
424 | 435 | ||
425 | static int debug_test_format_fn( | 436 | static int debug_test_format_fn( |
426 | debug_info_t * id, struct debug_view *view, | 437 | debug_info_t *id, struct debug_view *view, |
427 | char *out_buf, const char *in_buf | 438 | char *out_buf, const char *in_buf |
428 | ) | 439 | ) |
429 | { | 440 | { |
430 | int i, rc = 0; | 441 | int i, rc = 0; |
431 | 442 | ||
432 | if(id->buf_size >= 4) { | 443 | if (id->buf_size >= 4) { |
433 | int msg_nr = *((int*)in_buf); | 444 | int msg_nr = *((int*)in_buf); |
434 | if(msg_nr < sizeof(messages)/sizeof(char*) - 1) | 445 | if (msg_nr < sizeof(messages) / sizeof(char*) - 1) |
435 | rc += sprintf(out_buf, "%s", messages[msg_nr]); | 446 | rc += sprintf(out_buf, "%s", messages[msg_nr]); |
436 | else | 447 | else |
437 | rc += sprintf(out_buf, UNKNOWNSTR, msg_nr); | 448 | rc += sprintf(out_buf, UNKNOWNSTR, msg_nr); |
438 | } | 449 | } |
439 | out: | 450 | return rc; |
440 | return rc; | ||
441 | } | 451 | } |
442 | 452 | ||
443 | struct debug_view debug_test_view = { | 453 | struct debug_view debug_test_view = { |
@@ -452,13 +462,17 @@ Example:: | |||
452 | test: | 462 | test: |
453 | ===== | 463 | ===== |
454 | 464 | ||
455 | :: | 465 | .. code-block:: c |
456 | 466 | ||
457 | debug_info_t *debug_info; | 467 | debug_info_t *debug_info; |
468 | int i; | ||
458 | ... | 469 | ... |
459 | debug_info = debug_register ("test", 0, 4, 4 )); | 470 | debug_info = debug_register("test", 0, 4, 4); |
460 | debug_register_view(debug_info, &debug_test_view); | 471 | debug_register_view(debug_info, &debug_test_view); |
461 | for(i = 0; i < 10; i ++) debug_int_event(debug_info, 1, i); | 472 | for (i = 0; i < 10; i ++) |
473 | debug_int_event(debug_info, 1, i); | ||
474 | |||
475 | :: | ||
462 | 476 | ||
463 | > cat /sys/kernel/debug/s390dbf/test/myview | 477 | > cat /sys/kernel/debug/s390dbf/test/myview |
464 | 00 00964419734:611402 1 - 00 88042ca This error........... | 478 | 00 00964419734:611402 1 - 00 88042ca This error........... |