1 Notifier error injection
2 ========================
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.
11 * Memory hotplug notifier
12 * powerpc pSeries reconfig notifier
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.
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
23 Possible CPU notifier events to be failed are:
26 * CPU_UP_PREPARE_FROZEN
28 * CPU_DOWN_PREPARE_FROZEN
30 Example1: Inject CPU offline error (-1 == -EPERM)
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
37 Example2: inject CPU online error (-2 == -ENOENT)
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
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
48 Possible PM notifier events to be failed are:
50 * PM_HIBERNATION_PREPARE
54 Example: Inject PM suspend error (-12 = -ENOMEM)
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
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
66 Possible memory notifier events to be failed are:
71 Example: Inject memory hotplug offline error (-12 == -ENOMEM)
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
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
83 Possible pSeries reconfig notifier events to be failed are:
85 * PSERIES_RECONFIG_ADD
86 * PSERIES_RECONFIG_REMOVE
87 * PSERIES_DRCONF_MEM_ADD
88 * PSERIES_DRCONF_MEM_REMOVE
90 For more usage examples
91 -----------------------
92 There are tools/testing/selftests using the notifier error injection features
93 for CPU and memory notifiers.
95 * tools/testing/selftests/cpu-hotplug/on-off-test.sh
96 * tools/testing/selftests/memory-hotplug/on-off-test.sh
98 These scripts first do simple online and offline tests and then do fault
99 injection tests if notifier error injection module is available.