Linux Audio

Check our new training course

Loading...
v4.6
  1Notifier error injection
  2========================
  3
  4Notifier error injection provides the ability to inject artificial 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 * Netdevice notifier
 14
 15CPU notifier error injection module
 16-----------------------------------
 17This feature can be used to test the error handling of the CPU notifiers by
 18injecting artificial errors to CPU notifier chain callbacks.
 19
 20If the notifier call chain should be failed with some events notified, write
 21the error code to debugfs interface
 22/sys/kernel/debug/notifier-error-inject/cpu/actions/<notifier event>/error
 23
 24Possible CPU notifier events to be failed are:
 25
 26 * CPU_UP_PREPARE
 27 * CPU_UP_PREPARE_FROZEN
 28 * CPU_DOWN_PREPARE
 29 * CPU_DOWN_PREPARE_FROZEN
 30
 31Example1: Inject CPU offline error (-1 == -EPERM)
 32
 33	# cd /sys/kernel/debug/notifier-error-inject/cpu
 34	# echo -1 > actions/CPU_DOWN_PREPARE/error
 35	# echo 0 > /sys/devices/system/cpu/cpu1/online
 36	bash: echo: write error: Operation not permitted
 37
 38Example2: inject CPU online error (-2 == -ENOENT)
 39
 40	# echo -2 > actions/CPU_UP_PREPARE/error
 41	# echo 1 > /sys/devices/system/cpu/cpu1/online
 42	bash: echo: write error: No such file or directory
 43
 44PM notifier error injection module
 45----------------------------------
 46This feature is controlled through debugfs interface
 47/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
 48
 49Possible PM notifier events to be failed are:
 50
 51 * PM_HIBERNATION_PREPARE
 52 * PM_SUSPEND_PREPARE
 53 * PM_RESTORE_PREPARE
 54
 55Example: Inject PM suspend error (-12 = -ENOMEM)
 56
 57	# cd /sys/kernel/debug/notifier-error-inject/pm/
 58	# echo -12 > actions/PM_SUSPEND_PREPARE/error
 59	# echo mem > /sys/power/state
 60	bash: echo: write error: Cannot allocate memory
 61
 62Memory hotplug notifier error injection module
 63----------------------------------------------
 64This feature is controlled through debugfs interface
 65/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
 66
 67Possible memory notifier events to be failed are:
 68
 69 * MEM_GOING_ONLINE
 70 * MEM_GOING_OFFLINE
 71
 72Example: Inject memory hotplug offline error (-12 == -ENOMEM)
 73
 74	# cd /sys/kernel/debug/notifier-error-inject/memory
 75	# echo -12 > actions/MEM_GOING_OFFLINE/error
 76	# echo offline > /sys/devices/system/memory/memoryXXX/state
 77	bash: echo: write error: Cannot allocate memory
 78
 79powerpc pSeries reconfig notifier error injection module
 80--------------------------------------------------------
 81This feature is controlled through debugfs interface
 82/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
 83
 84Possible pSeries reconfig notifier events to be failed are:
 85
 86 * PSERIES_RECONFIG_ADD
 87 * PSERIES_RECONFIG_REMOVE
 88 * PSERIES_DRCONF_MEM_ADD
 89 * PSERIES_DRCONF_MEM_REMOVE
 90
 91Netdevice notifier error injection module
 92----------------------------------------------
 93This feature is controlled through debugfs interface
 94/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
 95
 96Netdevice notifier events which can be failed are:
 97
 98 * NETDEV_REGISTER
 99 * NETDEV_CHANGEMTU
100 * NETDEV_CHANGENAME
101 * NETDEV_PRE_UP
102 * NETDEV_PRE_TYPE_CHANGE
103 * NETDEV_POST_INIT
104 * NETDEV_PRECHANGEMTU
105 * NETDEV_PRECHANGEUPPER
106 * NETDEV_CHANGEUPPER
107
108Example: Inject netdevice mtu change error (-22 == -EINVAL)
109
110	# cd /sys/kernel/debug/notifier-error-inject/netdev
111	# echo -22 > actions/NETDEV_CHANGEMTU/error
112	# ip link set eth0 mtu 1024
113	RTNETLINK answers: Invalid argument
114
115For more usage examples
116-----------------------
117There are tools/testing/selftests using the notifier error injection features
118for CPU and memory notifiers.
119
120 * tools/testing/selftests/cpu-hotplug/on-off-test.sh
121 * tools/testing/selftests/memory-hotplug/on-off-test.sh
122
123These scripts first do simple online and offline tests and then do fault
124injection tests if notifier error injection module is available.
v4.17
 1Notifier error injection
 2========================
 3
 4Notifier error injection provides the ability to inject artificial 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 * PM notifier
10 * Memory hotplug notifier
11 * powerpc pSeries reconfig notifier
12 * Netdevice notifier
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
14PM notifier error injection module
15----------------------------------
16This feature is controlled through debugfs interface
17/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
18
19Possible PM notifier events to be failed are:
20
21 * PM_HIBERNATION_PREPARE
22 * PM_SUSPEND_PREPARE
23 * PM_RESTORE_PREPARE
24
25Example: Inject PM suspend error (-12 = -ENOMEM)
26
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
31
32Memory hotplug notifier error injection module
33----------------------------------------------
34This feature is controlled through debugfs interface
35/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
36
37Possible memory notifier events to be failed are:
38
39 * MEM_GOING_ONLINE
40 * MEM_GOING_OFFLINE
41
42Example: Inject memory hotplug offline error (-12 == -ENOMEM)
43
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
48
49powerpc pSeries reconfig notifier error injection module
50--------------------------------------------------------
51This feature is controlled through debugfs interface
52/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
53
54Possible pSeries reconfig notifier events to be failed are:
55
56 * PSERIES_RECONFIG_ADD
57 * PSERIES_RECONFIG_REMOVE
58 * PSERIES_DRCONF_MEM_ADD
59 * PSERIES_DRCONF_MEM_REMOVE
60
61Netdevice notifier error injection module
62----------------------------------------------
63This feature is controlled through debugfs interface
64/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
65
66Netdevice notifier events which can be failed are:
67
68 * NETDEV_REGISTER
69 * NETDEV_CHANGEMTU
70 * NETDEV_CHANGENAME
71 * NETDEV_PRE_UP
72 * NETDEV_PRE_TYPE_CHANGE
73 * NETDEV_POST_INIT
74 * NETDEV_PRECHANGEMTU
75 * NETDEV_PRECHANGEUPPER
76 * NETDEV_CHANGEUPPER
77
78Example: Inject netdevice mtu change error (-22 == -EINVAL)
79
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
84
85For more usage examples
86-----------------------
87There are tools/testing/selftests using the notifier error injection features
88for CPU and memory notifiers.
89
90 * tools/testing/selftests/cpu-hotplug/on-off-test.sh
91 * tools/testing/selftests/memory-hotplug/on-off-test.sh
92
93These scripts first do simple online and offline tests and then do fault
94injection tests if notifier error injection module is available.