]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - Documentation/fault-injection/notifier-error-inject.txt
PCI: layerscape: Add support for LS1043a and LS2080a
[karo-tx-linux.git] / Documentation / fault-injection / notifier-error-inject.txt
1 Notifier error injection
2 ========================
3
4 Notifier error injection provides the ability to inject artificial errors to
5 specified notifier chain callbacks. It is useful to test the error handling of
6 notifier call chain failures which is rarely executed.  There are kernel
7 modules that can be used to test the following notifiers.
8
9  * CPU notifier
10  * PM notifier
11  * Memory hotplug notifier
12  * powerpc pSeries reconfig notifier
13
14 CPU notifier error injection module
15 -----------------------------------
16 This feature can be used to test the error handling of the CPU notifiers by
17 injecting artificial errors to CPU notifier chain callbacks.
18
19 If the notifier call chain should be failed with some events notified, write
20 the error code to debugfs interface
21 /sys/kernel/debug/notifier-error-inject/cpu/actions/<notifier event>/error
22
23 Possible CPU notifier events to be failed are:
24
25  * CPU_UP_PREPARE
26  * CPU_UP_PREPARE_FROZEN
27  * CPU_DOWN_PREPARE
28  * CPU_DOWN_PREPARE_FROZEN
29
30 Example1: Inject CPU offline error (-1 == -EPERM)
31
32         # cd /sys/kernel/debug/notifier-error-inject/cpu
33         # echo -1 > actions/CPU_DOWN_PREPARE/error
34         # echo 0 > /sys/devices/system/cpu/cpu1/online
35         bash: echo: write error: Operation not permitted
36
37 Example2: inject CPU online error (-2 == -ENOENT)
38
39         # echo -2 > actions/CPU_UP_PREPARE/error
40         # echo 1 > /sys/devices/system/cpu/cpu1/online
41         bash: echo: write error: No such file or directory
42
43 PM notifier error injection module
44 ----------------------------------
45 This feature is controlled through debugfs interface
46 /sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
47
48 Possible PM notifier events to be failed are:
49
50  * PM_HIBERNATION_PREPARE
51  * PM_SUSPEND_PREPARE
52  * PM_RESTORE_PREPARE
53
54 Example: Inject PM suspend error (-12 = -ENOMEM)
55
56         # cd /sys/kernel/debug/notifier-error-inject/pm/
57         # echo -12 > actions/PM_SUSPEND_PREPARE/error
58         # echo mem > /sys/power/state
59         bash: echo: write error: Cannot allocate memory
60
61 Memory hotplug notifier error injection module
62 ----------------------------------------------
63 This feature is controlled through debugfs interface
64 /sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
65
66 Possible memory notifier events to be failed are:
67
68  * MEM_GOING_ONLINE
69  * MEM_GOING_OFFLINE
70
71 Example: Inject memory hotplug offline error (-12 == -ENOMEM)
72
73         # cd /sys/kernel/debug/notifier-error-inject/memory
74         # echo -12 > actions/MEM_GOING_OFFLINE/error
75         # echo offline > /sys/devices/system/memory/memoryXXX/state
76         bash: echo: write error: Cannot allocate memory
77
78 powerpc pSeries reconfig notifier error injection module
79 --------------------------------------------------------
80 This feature is controlled through debugfs interface
81 /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
82
83 Possible pSeries reconfig notifier events to be failed are:
84
85  * PSERIES_RECONFIG_ADD
86  * PSERIES_RECONFIG_REMOVE
87  * PSERIES_DRCONF_MEM_ADD
88  * PSERIES_DRCONF_MEM_REMOVE
89
90 For more usage examples
91 -----------------------
92 There are tools/testing/selftests using the notifier error injection features
93 for CPU and memory notifiers.
94
95  * tools/testing/selftests/cpu-hotplug/on-off-test.sh
96  * tools/testing/selftests/memory-hotplug/on-off-test.sh
97
98 These scripts first do simple online and offline tests and then do fault
99 injection tests if notifier error injection module is available.