Merge tag 'ceph-for-6.4-rc1' of https://github.com/ceph/ceph-client
[linux-block.git] / Documentation / fault-injection / notifier-error-inject.rst
CommitLineData
8d438288
AM
1Notifier error injection
2========================
3
4e79162a 4Notifier error injection provides the ability to inject artificial errors to
8d438288
AM
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
8d438288
AM
9 * PM notifier
10 * Memory hotplug notifier
11 * powerpc pSeries reconfig notifier
02fff96a 12 * Netdevice notifier
8d438288 13
8d438288
AM
14PM notifier error injection module
15----------------------------------
16This feature is controlled through debugfs interface
10ffebbe
MCC
17
18 /sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
8d438288
AM
19
20Possible PM notifier events to be failed are:
21
22 * PM_HIBERNATION_PREPARE
23 * PM_SUSPEND_PREPARE
24 * PM_RESTORE_PREPARE
25
10ffebbe 26Example: Inject PM suspend error (-12 = -ENOMEM)::
8d438288
AM
27
28 # cd /sys/kernel/debug/notifier-error-inject/pm/
29 # echo -12 > actions/PM_SUSPEND_PREPARE/error
30 # echo mem > /sys/power/state
31 bash: echo: write error: Cannot allocate memory
32
33Memory hotplug notifier error injection module
34----------------------------------------------
35This feature is controlled through debugfs interface
10ffebbe
MCC
36
37 /sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
8d438288
AM
38
39Possible memory notifier events to be failed are:
40
41 * MEM_GOING_ONLINE
42 * MEM_GOING_OFFLINE
43
10ffebbe 44Example: Inject memory hotplug offline error (-12 == -ENOMEM)::
8d438288
AM
45
46 # cd /sys/kernel/debug/notifier-error-inject/memory
47 # echo -12 > actions/MEM_GOING_OFFLINE/error
48 # echo offline > /sys/devices/system/memory/memoryXXX/state
49 bash: echo: write error: Cannot allocate memory
50
51powerpc pSeries reconfig notifier error injection module
52--------------------------------------------------------
53This feature is controlled through debugfs interface
10ffebbe
MCC
54
55 /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
8d438288
AM
56
57Possible pSeries reconfig notifier events to be failed are:
58
59 * PSERIES_RECONFIG_ADD
60 * PSERIES_RECONFIG_REMOVE
61 * PSERIES_DRCONF_MEM_ADD
62 * PSERIES_DRCONF_MEM_REMOVE
63
02fff96a
NA
64Netdevice notifier error injection module
65----------------------------------------------
66This feature is controlled through debugfs interface
10ffebbe
MCC
67
68 /sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
02fff96a
NA
69
70Netdevice notifier events which can be failed are:
71
72 * NETDEV_REGISTER
73 * NETDEV_CHANGEMTU
74 * NETDEV_CHANGENAME
75 * NETDEV_PRE_UP
76 * NETDEV_PRE_TYPE_CHANGE
77 * NETDEV_POST_INIT
78 * NETDEV_PRECHANGEMTU
79 * NETDEV_PRECHANGEUPPER
c39d0454 80 * NETDEV_CHANGEUPPER
02fff96a 81
10ffebbe 82Example: Inject netdevice mtu change error (-22 == -EINVAL)::
02fff96a
NA
83
84 # cd /sys/kernel/debug/notifier-error-inject/netdev
85 # echo -22 > actions/NETDEV_CHANGEMTU/error
86 # ip link set eth0 mtu 1024
87 RTNETLINK answers: Invalid argument
88
8d438288
AM
89For more usage examples
90-----------------------
91There are tools/testing/selftests using the notifier error injection features
92for CPU and memory notifiers.
93
6a242471
ZG
94 * tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
95 * tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
8d438288
AM
96
97These scripts first do simple online and offline tests and then do fault
98injection tests if notifier error injection module is available.