Based on kernel version 4.16.1. Page generated on 2018-04-09 11:53 EST.
1 Notifier error injection 2 ======================== 3 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. 8 9 * PM notifier 10 * Memory hotplug notifier 11 * powerpc pSeries reconfig notifier 12 * Netdevice notifier 13 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 18 19 Possible PM notifier events to be failed are: 20 21 * PM_HIBERNATION_PREPARE 22 * PM_SUSPEND_PREPARE 23 * PM_RESTORE_PREPARE 24 25 Example: 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 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 36 37 Possible memory notifier events to be failed are: 38 39 * MEM_GOING_ONLINE 40 * MEM_GOING_OFFLINE 41 42 Example: 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 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 53 54 Possible 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 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 65 66 Netdevice 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 78 Example: 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 85 For more usage examples 86 ----------------------- 87 There are tools/testing/selftests using the notifier error injection features 88 for 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 93 These scripts first do simple online and offline tests and then do fault 94 injection tests if notifier error injection module is available.