aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/fault-injection
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2012-07-30 17:43:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:22 -0400
commit8d438288145f19f253a82ca71290b44fce79e23f (patch)
tree521c1086079ed8fb78aa622cf19bdbcfd53cbe12 /Documentation/fault-injection
parent1d151c337d79fa3de88654d2514f58fbd916a8e0 (diff)
fault-injection: notifier error injection
This patchset provides kernel modules that can be used to test the error handling of notifier call chain failures by injecting artifical errors to the following notifier chain callbacks. * CPU notifier * PM notifier * memory hotplug notifier * powerpc pSeries reconfig notifier Example: Inject CPU offline error (-1 == -EPERM) # cd /sys/kernel/debug/notifier-error-inject/cpu # echo -1 > actions/CPU_DOWN_PREPARE/error # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted The patchset also adds cpu and memory hotplug tests to tools/testing/selftests These tests first do simple online and offline test and then do fault injection tests if notifier error injection module is available. This patch: The notifier error injection provides the ability to inject artifical errors to specified notifier chain callbacks. It is useful to test the error handling of notifier call chain failures. This adds common basic functions to define which type of events can be fail and to initialize the debugfs interface to control what error code should be returned and which event should be failed. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Greg KH <greg@kroah.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <michael@ellerman.id.au> Cc: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/fault-injection')
-rw-r--r--Documentation/fault-injection/notifier-error-inject.txt99
1 files changed, 99 insertions, 0 deletions
diff --git a/Documentation/fault-injection/notifier-error-inject.txt b/Documentation/fault-injection/notifier-error-inject.txt
new file mode 100644
index 000000000000..c83526c364e5
--- /dev/null
+++ b/Documentation/fault-injection/notifier-error-inject.txt
@@ -0,0 +1,99 @@
1Notifier error injection
2========================
3
4Notifier error injection provides the ability to inject artifical errors to
5specified notifier chain callbacks. It is useful to test the error handling of
6notifier call chain failures which is rarely executed. There are kernel
7modules 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
14CPU notifier error injection module
15-----------------------------------
16This feature can be used to test the error handling of the CPU notifiers by
17injecting artifical errors to CPU notifier chain callbacks.
18
19If the notifier call chain should be failed with some events notified, write
20the error code to debugfs interface
21/sys/kernel/debug/notifier-error-inject/cpu/actions/<notifier event>/error
22
23Possible 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
30Example1: 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
37Example2: 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
43PM notifier error injection module
44----------------------------------
45This feature is controlled through debugfs interface
46/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
47
48Possible PM notifier events to be failed are:
49
50 * PM_HIBERNATION_PREPARE
51 * PM_SUSPEND_PREPARE
52 * PM_RESTORE_PREPARE
53
54Example: 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
61Memory hotplug notifier error injection module
62----------------------------------------------
63This feature is controlled through debugfs interface
64/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
65
66Possible memory notifier events to be failed are:
67
68 * MEM_GOING_ONLINE
69 * MEM_GOING_OFFLINE
70
71Example: 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
78powerpc pSeries reconfig notifier error injection module
79--------------------------------------------------------
80This feature is controlled through debugfs interface
81/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
82
83Possible 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
90For more usage examples
91-----------------------
92There are tools/testing/selftests using the notifier error injection features
93for 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
98These scripts first do simple online and offline tests and then do fault
99injection tests if notifier error injection module is available.