summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Maier <maier@linux.ibm.com>2019-07-03 06:19:49 -0400
committerVasily Gorbik <gor@linux.ibm.com>2019-07-05 07:42:24 -0400
commit499723d12063aab97dfe6b41c822e9c1c74eff3e (patch)
tree3cb13679fe8b34704d394385a6787f71720ee13d
parent0328e519a726ff6e4abacba838eb00415171c34b (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.rst122
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.
23Design: 23Design:
24------- 24-------
25Kernel components (e.g. device drivers) can register themselves at the debug 25Kernel components (e.g. device drivers) can register themselves at the debug
26feature with the function call debug_register(). This function initializes a 26feature with the function call :c:func:`debug_register()`.
27This function initializes a
27debug log for the caller. For each debug log exists a number of debug areas 28debug log for the caller. For each debug log exists a number of debug areas
28where exactly one is active at one time. Each debug area consists of contiguous 29where exactly one is active at one time. Each debug area consists of contiguous
29pages in memory. In the debug areas there are stored debug entries (log records) 30pages 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.
44When an exception is thrown in the last debug area, the following debug 45When an exception is thrown in the last debug area, the following debug
45entries are then written again in the very first area. 46entries are then written again in the very first area.
46 47
47There are three versions for the event- and exception-calls: One for 48There are four versions for the event- and exception-calls: One for
48logging raw data, one for text and one for numbers. 49logging raw data, one for text, one for numbers (unsigned int and long),
50and one for sprintf-like formatted strings.
49 51
50Each debug entry contains the following data: 52Each 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
58The debug logs can be inspected in a live system through entries in 60The debug logs can be inspected in a live system through entries in
59the debugfs-filesystem. Under the toplevel directory "s390dbf" there is 61the debugfs-filesystem. Under the toplevel directory "``s390dbf``" there is
60a directory for each registered component, which is named like the 62a directory for each registered component, which is named like the
61corresponding component. The debugfs normally should be mounted to 63corresponding 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
65The content of the directories are files which represent different views 67The content of the directories are files which represent different views
66to the debug log. Each component can decide which views should be 68to the debug log. Each component can decide which views should be
67used through registering them with the function debug_register_view(). 69used through registering them with the function :c:func:`debug_register_view()`.
68Predefined views for hex/ascii, sprintf and raw binary data are provided. 70Predefined views for hex/ascii, sprintf and raw binary data are provided.
69It is also possible to define other views. The content of 71It is also possible to define other views. The content of
70a view can be inspected simply by reading the corresponding debugfs file. 72a view can be inspected simply by reading the corresponding debugfs file.
71 73
72All debug logs have an actual debug level (range from 0 to 6). 74All debug logs have an actual debug level (range from 0 to 6).
73The default level is 3. Event and Exception functions have a 'level' 75The default level is 3. Event and Exception functions have a :c:data:`level`
74parameter. Only debug entries with a level that is lower or equal 76parameter. Only debug entries with a level that is lower or equal
75than the actual level are written to the log. This means, when 77than the actual level are written to the log. This means, when
76writing events, high priority log entries should have a low level 78writing events, high priority log entries should have a low level
77value whereas low priority entries should have a high one. 79value whereas low priority entries should have a high one.
78The actual debug level can be changed with the help of the debugfs-filesystem 80The actual debug level can be changed with the help of the debugfs-filesystem
79through writing a number string "x" to the 'level' debugfs file which is 81through writing a number string "x" to the ``level`` debugfs file which is
80provided for every debug log. Debugging can be switched off completely 82provided for every debug log. Debugging can be switched off completely
81by using "-" on the 'level' debugfs file. 83by using "-" on the ``level`` debugfs file.
82 84
83Example:: 85Example::
84 86
@@ -86,21 +88,21 @@ Example::
86 88
87It is also possible to deactivate the debug feature globally for every 89It is also possible to deactivate the debug feature globally for every
88debug log. You can change the behavior using 2 sysctl parameters in 90debug log. You can change the behavior using 2 sysctl parameters in
89/proc/sys/s390dbf: 91``/proc/sys/s390dbf``:
90 92
91There are currently 2 possible triggers, which stop the debug feature 93There are currently 2 possible triggers, which stop the debug feature
92globally. The first possibility is to use the "debug_active" sysctl. If 94globally. The first possibility is to use the ``debug_active`` sysctl. If
93set to 1 the debug feature is running. If "debug_active" is set to 0 the 95set to 1 the debug feature is running. If ``debug_active`` is set to 0 the
94debug feature is turned off. 96debug feature is turned off.
95 97
96The second trigger which stops the debug feature is a kernel oops. 98The second trigger which stops the debug feature is a kernel oops.
97That prevents the debug feature from overwriting debug information that 99That prevents the debug feature from overwriting debug information that
98happened before the oops. After an oops you can reactivate the debug feature 100happened before the oops. After an oops you can reactivate the debug feature
99by piping 1 to /proc/sys/s390dbf/debug_active. Nevertheless, its not 101by piping 1 to ``/proc/sys/s390dbf/debug_active``. Nevertheless, it's not
100suggested to use an oopsed kernel in a production environment. 102suggested to use an oopsed kernel in a production environment.
101 103
102If you want to disallow the deactivation of the debug feature, you can use 104If you want to disallow the deactivation of the debug feature, you can use
103the "debug_stoppable" sysctl. If you set "debug_stoppable" to 0 the debug 105the ``debug_stoppable`` sysctl. If you set ``debug_stoppable`` to 0 the debug
104feature cannot be stopped. If the debug feature is already stopped, it 106feature cannot be stopped. If the debug feature is already stopped, it
105will stay deactivated. 107will stay deactivated.
106 108
@@ -113,16 +115,18 @@ Kernel Interfaces:
113Predefined views: 115Predefined views:
114----------------- 116-----------------
115 117
116extern struct debug_view debug_hex_ascii_view; 118.. code-block:: c
117 119
118extern struct debug_view debug_raw_view; 120 extern struct debug_view debug_hex_ascii_view;
119 121
120extern 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
122Examples 126Examples
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
255Stooping the debug feature 259Stopping the debug feature
256-------------------------- 260--------------------------
257Example: 261Example:
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
267lcrash Interface 271crash Interface
268---------------- 272----------------
269It is planned that the dump analysis tool lcrash gets an additional command 273The ``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.
275With this tool it is possible
271to investigate the debug logs on a live system and with a memory dump after 276to investigate the debug logs on a live system and with a memory dump after
272a system crash. 277a system crash.
273 278
@@ -276,8 +281,8 @@ Investigating raw memory
276One last possibility to investigate the debug logs at a live 281One last possibility to investigate the debug logs at a live
277system and after a system crash is to look at the raw memory 282system and after a system crash is to look at the raw memory
278under VM or at the Service Element. 283under VM or at the Service Element.
279It is possible to find the anker of the debug-logs through 284It is possible to find the anchor of the debug-logs through
280the 'debug_area_first' symbol in the System map. Then one has 285the ``debug_area_first`` symbol in the System map. Then one has
281to follow the correct pointers of the data-structures defined 286to follow the correct pointers of the data-structures defined
282in debug.h and find the debug-areas in memory. 287in debug.h and find the debug-areas in memory.
283Normally modules which use the debug feature will also have 288Normally 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
286memory. 291memory.
287 292
288For this method it is recommended to use '16 * x + 4' byte (x = 0..n) 293For this method it is recommended to use '16 * x + 4' byte (x = 0..n)
289for the length of the data field in debug_register() in 294for the length of the data field in :c:func:`debug_register()` in
290order to see the debug entries well formatted. 295order to see the debug entries well formatted.
291 296
292 297
@@ -295,7 +300,7 @@ Predefined Views
295 300
296There are three predefined views: hex_ascii, raw and sprintf. 301There are three predefined views: hex_ascii, raw and sprintf.
297The hex_ascii view shows the data field in hex and ascii representation 302The 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``).
299The raw view returns a bytestream as the debug areas are stored in memory. 304The raw view returns a bytestream as the debug areas are stored in memory.
300 305
301The sprintf view formats the debug entries in the same way as the sprintf 306The 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
337A typical line of the hex_ascii view will look like the following (first line 342A typical line of the hex_ascii view will look like the following (first line
338is only for explanation and will not be displayed when 'cating' the view): 343is only for explanation and will not be displayed when 'cating' the view)::
339 344
340area time level exception cpu caller data (hex + ascii) 345 area time level exception cpu caller data (hex + ascii)
341-------------------------------------------------------------------------- 346 --------------------------------------------------------------------------
34200 00964419409:440690 1 - 00 88023fe 347 00 00964419409:440690 1 - 00 88023fe
343 348
344 349
345Defining views 350Defining views
346-------------- 351--------------
347 352
348Views are specified with the 'debug_view' structure. There are defined 353Views are specified with the 'debug_view' structure. There are defined
349callback functions which are used for reading and writing the debugfs files:: 354callback 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
360where:: 367where:
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
395existing debug entry. 404existing debug entry.
396 405
397The input_proc can be used to implement functionality when it is written to 406The input_proc can be used to implement functionality when it is written to
398the view (e.g. like with 'echo "0" > /sys/kernel/debug/s390dbf/dasd/level). 407the view (e.g. like with ``echo "0" > /sys/kernel/debug/s390dbf/dasd/level``).
399 408
400For header_proc there can be used the default function 409For header_proc there can be used the default function
401debug_dflt_header_fn() which is defined in debug.h. 410:c:func:`debug_dflt_header_fn()` which is defined in debug.h.
402and which produces the same header output as the predefined views. 411and which produces the same header output as the predefined views.
403E.g:: 412E.g::
404 413
@@ -407,7 +416,9 @@ E.g::
407In order to see how to use the callback functions check the implementation 416In order to see how to use the callback functions check the implementation
408of the default views! 417of the default views!
409 418
410Example:: 419Example:
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::
452test: 462test:
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...........