Skip to content

Commit 10ffebb

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: fault-injection: convert docs to ReST and rename to *.rst
The conversion is actually: - add blank lines and identation in order to identify paragraphs; - fix tables markups; - add some lists markups; - mark literal blocks; - adjust title markups. At its new index.rst, let's add a :orphan: while this is not linked to the main index.rst file, in order to avoid build warnings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent f0ba437 commit 10ffebb

14 files changed

Lines changed: 352 additions & 303 deletions

File tree

Documentation/fault-injection/fault-injection.txt renamed to Documentation/fault-injection/fault-injection.rst

Lines changed: 146 additions & 135 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:orphan:
2+
3+
===============
4+
fault-injection
5+
===============
6+
7+
.. toctree::
8+
:maxdepth: 1
9+
10+
fault-injection
11+
notifier-error-inject
12+
nvme-fault-injection
13+
provoke-crashes
14+
15+
.. only:: subproject and html
16+
17+
Indices
18+
=======
19+
20+
* :ref:`genindex`

Documentation/fault-injection/notifier-error-inject.txt renamed to Documentation/fault-injection/notifier-error-inject.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ modules that can be used to test the following notifiers.
1414
PM notifier error injection module
1515
----------------------------------
1616
This feature is controlled through debugfs interface
17-
/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
17+
18+
/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
1819

1920
Possible PM notifier events to be failed are:
2021

2122
* PM_HIBERNATION_PREPARE
2223
* PM_SUSPEND_PREPARE
2324
* PM_RESTORE_PREPARE
2425

25-
Example: Inject PM suspend error (-12 = -ENOMEM)
26+
Example: Inject PM suspend error (-12 = -ENOMEM)::
2627

2728
# cd /sys/kernel/debug/notifier-error-inject/pm/
2829
# echo -12 > actions/PM_SUSPEND_PREPARE/error
@@ -32,14 +33,15 @@ Example: Inject PM suspend error (-12 = -ENOMEM)
3233
Memory hotplug notifier error injection module
3334
----------------------------------------------
3435
This feature is controlled through debugfs interface
35-
/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
36+
37+
/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
3638

3739
Possible memory notifier events to be failed are:
3840

3941
* MEM_GOING_ONLINE
4042
* MEM_GOING_OFFLINE
4143

42-
Example: Inject memory hotplug offline error (-12 == -ENOMEM)
44+
Example: Inject memory hotplug offline error (-12 == -ENOMEM)::
4345

4446
# cd /sys/kernel/debug/notifier-error-inject/memory
4547
# echo -12 > actions/MEM_GOING_OFFLINE/error
@@ -49,7 +51,8 @@ Example: Inject memory hotplug offline error (-12 == -ENOMEM)
4951
powerpc pSeries reconfig notifier error injection module
5052
--------------------------------------------------------
5153
This feature is controlled through debugfs interface
52-
/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
54+
55+
/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
5356

5457
Possible pSeries reconfig notifier events to be failed are:
5558

@@ -61,7 +64,8 @@ Possible pSeries reconfig notifier events to be failed are:
6164
Netdevice notifier error injection module
6265
----------------------------------------------
6366
This feature is controlled through debugfs interface
64-
/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
67+
68+
/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
6569

6670
Netdevice notifier events which can be failed are:
6771

@@ -75,7 +79,7 @@ Netdevice notifier events which can be failed are:
7579
* NETDEV_PRECHANGEUPPER
7680
* NETDEV_CHANGEUPPER
7781

78-
Example: Inject netdevice mtu change error (-22 == -EINVAL)
82+
Example: Inject netdevice mtu change error (-22 == -EINVAL)::
7983

8084
# cd /sys/kernel/debug/notifier-error-inject/netdev
8185
# echo -22 > actions/NETDEV_CHANGEMTU/error
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
NVMe Fault Injection
2+
====================
3+
Linux's fault injection framework provides a systematic way to support
4+
error injection via debugfs in the /sys/kernel/debug directory. When
5+
enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
6+
injected into the nvme_end_request. Users can change the default status
7+
code and no retry flag via the debugfs. The list of Generic Command
8+
Status can be found in include/linux/nvme.h
9+
10+
Following examples show how to inject an error into the nvme.
11+
12+
First, enable CONFIG_FAULT_INJECTION_DEBUG_FS kernel config,
13+
recompile the kernel. After booting up the kernel, do the
14+
following.
15+
16+
Example 1: Inject default status code with no retry
17+
---------------------------------------------------
18+
19+
::
20+
21+
mount /dev/nvme0n1 /mnt
22+
echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
23+
echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
24+
cp a.file /mnt
25+
26+
Expected Result::
27+
28+
cp: cannot stat ‘/mnt/a.file’: Input/output error
29+
30+
Message from dmesg::
31+
32+
FAULT_INJECTION: forcing a failure.
33+
name fault_inject, interval 1, probability 100, space 0, times 1
34+
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.15.0-rc8+ #2
35+
Hardware name: innotek GmbH VirtualBox/VirtualBox,
36+
BIOS VirtualBox 12/01/2006
37+
Call Trace:
38+
<IRQ>
39+
dump_stack+0x5c/0x7d
40+
should_fail+0x148/0x170
41+
nvme_should_fail+0x2f/0x50 [nvme_core]
42+
nvme_process_cq+0xe7/0x1d0 [nvme]
43+
nvme_irq+0x1e/0x40 [nvme]
44+
__handle_irq_event_percpu+0x3a/0x190
45+
handle_irq_event_percpu+0x30/0x70
46+
handle_irq_event+0x36/0x60
47+
handle_fasteoi_irq+0x78/0x120
48+
handle_irq+0xa7/0x130
49+
? tick_irq_enter+0xa8/0xc0
50+
do_IRQ+0x43/0xc0
51+
common_interrupt+0xa2/0xa2
52+
</IRQ>
53+
RIP: 0010:native_safe_halt+0x2/0x10
54+
RSP: 0018:ffffffff82003e90 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdd
55+
RAX: ffffffff817a10c0 RBX: ffffffff82012480 RCX: 0000000000000000
56+
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
57+
RBP: 0000000000000000 R08: 000000008e38ce64 R09: 0000000000000000
58+
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82012480
59+
R13: ffffffff82012480 R14: 0000000000000000 R15: 0000000000000000
60+
? __sched_text_end+0x4/0x4
61+
default_idle+0x18/0xf0
62+
do_idle+0x150/0x1d0
63+
cpu_startup_entry+0x6f/0x80
64+
start_kernel+0x4c4/0x4e4
65+
? set_init_arg+0x55/0x55
66+
secondary_startup_64+0xa5/0xb0
67+
print_req_error: I/O error, dev nvme0n1, sector 9240
68+
EXT4-fs error (device nvme0n1): ext4_find_entry:1436:
69+
inode #2: comm cp: reading directory lblock 0
70+
71+
Example 2: Inject default status code with retry
72+
------------------------------------------------
73+
74+
::
75+
76+
mount /dev/nvme0n1 /mnt
77+
echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
78+
echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
79+
echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/status
80+
echo 0 > /sys/kernel/debug/nvme0n1/fault_inject/dont_retry
81+
82+
cp a.file /mnt
83+
84+
Expected Result::
85+
86+
command success without error
87+
88+
Message from dmesg::
89+
90+
FAULT_INJECTION: forcing a failure.
91+
name fault_inject, interval 1, probability 100, space 0, times 1
92+
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.15.0-rc8+ #4
93+
Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
94+
Call Trace:
95+
<IRQ>
96+
dump_stack+0x5c/0x7d
97+
should_fail+0x148/0x170
98+
nvme_should_fail+0x30/0x60 [nvme_core]
99+
nvme_loop_queue_response+0x84/0x110 [nvme_loop]
100+
nvmet_req_complete+0x11/0x40 [nvmet]
101+
nvmet_bio_done+0x28/0x40 [nvmet]
102+
blk_update_request+0xb0/0x310
103+
blk_mq_end_request+0x18/0x60
104+
flush_smp_call_function_queue+0x3d/0xf0
105+
smp_call_function_single_interrupt+0x2c/0xc0
106+
call_function_single_interrupt+0xa2/0xb0
107+
</IRQ>
108+
RIP: 0010:native_safe_halt+0x2/0x10
109+
RSP: 0018:ffffc9000068bec0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff04
110+
RAX: ffffffff817a10c0 RBX: ffff88011a3c9680 RCX: 0000000000000000
111+
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
112+
RBP: 0000000000000001 R08: 000000008e38c131 R09: 0000000000000000
113+
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88011a3c9680
114+
R13: ffff88011a3c9680 R14: 0000000000000000 R15: 0000000000000000
115+
? __sched_text_end+0x4/0x4
116+
default_idle+0x18/0xf0
117+
do_idle+0x150/0x1d0
118+
cpu_startup_entry+0x6f/0x80
119+
start_secondary+0x187/0x1e0
120+
secondary_startup_64+0xa5/0xb0

‎Documentation/fault-injection/nvme-fault-injection.txt‎

Lines changed: 0 additions & 116 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
===============
2+
Provoke crashes
3+
===============
4+
5+
The lkdtm module provides an interface to crash or injure the kernel at
6+
predefined crashpoints to evaluate the reliability of crash dumps obtained
7+
using different dumping solutions. The module uses KPROBEs to instrument
8+
crashing points, but can also crash the kernel directly without KRPOBE
9+
support.
10+
11+
12+
You can provide the way either through module arguments when inserting
13+
the module, or through a debugfs interface.
14+
15+
Usage::
16+
17+
insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<>
18+
[cpoint_count={>0}]
19+
20+
recur_count
21+
Recursion level for the stack overflow test. Default is 10.
22+
23+
cpoint_name
24+
Crash point where the kernel is to be crashed. It can be
25+
one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
26+
FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_DISPATCH_CMD,
27+
IDE_CORE_CP, DIRECT
28+
29+
cpoint_type
30+
Indicates the action to be taken on hitting the crash point.
31+
It can be one of PANIC, BUG, EXCEPTION, LOOP, OVERFLOW,
32+
CORRUPT_STACK, UNALIGNED_LOAD_STORE_WRITE, OVERWRITE_ALLOCATION,
33+
WRITE_AFTER_FREE,
34+
35+
cpoint_count
36+
Indicates the number of times the crash point is to be hit
37+
to trigger an action. The default is 10.
38+
39+
You can also induce failures by mounting debugfs and writing the type to
40+
<mountpoint>/provoke-crash/<crashpoint>. E.g.::
41+
42+
mount -t debugfs debugfs /mnt
43+
echo EXCEPTION > /mnt/provoke-crash/INT_HARDWARE_ENTRY
44+
45+
46+
A special file is `DIRECT` which will induce the crash directly without
47+
KPROBE instrumentation. This mode is the only one available when the module
48+
is built on a kernel without KPROBEs support.

0 commit comments

Comments
 (0)