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.
10 * Memory hotplug notifier
11 * powerpc pSeries reconfig notifier
14 PM notifier error injection module
15 ----------------------------------
16 This feature is controlled through debugfs interface
17 /sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
19 Possible PM notifier events to be failed are:
21 * PM_HIBERNATION_PREPARE
25 Example: Inject PM suspend error (-12 = -ENOMEM)
27 # cd /sys/kernel/debug/notifier-error-inject/pm/
28 # echo -12 > actions/PM_SUSPEND_PREPARE/error
29 # echo mem > /sys/power/state
30 bash: echo: write error: Cannot allocate memory
32 Memory hotplug notifier error injection module
33 ----------------------------------------------
34 This feature is controlled through debugfs interface
35 /sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
37 Possible memory notifier events to be failed are:
42 Example: Inject memory hotplug offline error (-12 == -ENOMEM)
44 # cd /sys/kernel/debug/notifier-error-inject/memory
45 # echo -12 > actions/MEM_GOING_OFFLINE/error
46 # echo offline > /sys/devices/system/memory/memoryXXX/state
47 bash: echo: write error: Cannot allocate memory
49 powerpc pSeries reconfig notifier error injection module
50 --------------------------------------------------------
51 This feature is controlled through debugfs interface
52 /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
54 Possible pSeries reconfig notifier events to be failed are:
56 * PSERIES_RECONFIG_ADD
57 * PSERIES_RECONFIG_REMOVE
58 * PSERIES_DRCONF_MEM_ADD
59 * PSERIES_DRCONF_MEM_REMOVE
61 Netdevice notifier error injection module
62 ----------------------------------------------
63 This feature is controlled through debugfs interface
64 /sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
66 Netdevice notifier events which can be failed are:
72 * NETDEV_PRE_TYPE_CHANGE
75 * NETDEV_PRECHANGEUPPER
78 Example: Inject netdevice mtu change error (-22 == -EINVAL)
80 # cd /sys/kernel/debug/notifier-error-inject/netdev
81 # echo -22 > actions/NETDEV_CHANGEMTU/error
82 # ip link set eth0 mtu 1024
83 RTNETLINK answers: Invalid argument
85 For more usage examples
86 -----------------------
87 There are tools/testing/selftests using the notifier error injection features
88 for CPU and memory notifiers.
90 * tools/testing/selftests/cpu-hotplug/on-off-test.sh
91 * tools/testing/selftests/memory-hotplug/on-off-test.sh
93 These scripts first do simple online and offline tests and then do fault
94 injection tests if notifier error injection module is available.