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. 95