brintos

brintos / linux-shallow public Read only

0
0
Text · 3.1 KiB · fdf2dc4 Raw
99 lines · plain
1Notifier error injection2========================3 4Notifier error injection provides the ability to inject artificial errors to5specified notifier chain callbacks. It is useful to test the error handling of6notifier call chain failures which is rarely executed.  There are kernel7modules that can be used to test the following notifiers.8 9 * PM notifier10 * Memory hotplug notifier11 * powerpc pSeries reconfig notifier12 * Netdevice notifier13 14PM notifier error injection module15----------------------------------16This feature is controlled through debugfs interface17 18  /sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error19 20Possible PM notifier events to be failed are:21 22 * PM_HIBERNATION_PREPARE23 * PM_SUSPEND_PREPARE24 * PM_RESTORE_PREPARE25 26Example: Inject PM suspend error (-12 = -ENOMEM)::27 28	# cd /sys/kernel/debug/notifier-error-inject/pm/29	# echo -12 > actions/PM_SUSPEND_PREPARE/error30	# echo mem > /sys/power/state31	bash: echo: write error: Cannot allocate memory32 33Memory hotplug notifier error injection module34----------------------------------------------35This feature is controlled through debugfs interface36 37  /sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error38 39Possible memory notifier events to be failed are:40 41 * MEM_GOING_ONLINE42 * MEM_GOING_OFFLINE43 44Example: Inject memory hotplug offline error (-12 == -ENOMEM)::45 46	# cd /sys/kernel/debug/notifier-error-inject/memory47	# echo -12 > actions/MEM_GOING_OFFLINE/error48	# echo offline > /sys/devices/system/memory/memoryXXX/state49	bash: echo: write error: Cannot allocate memory50 51powerpc pSeries reconfig notifier error injection module52--------------------------------------------------------53This feature is controlled through debugfs interface54 55  /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error56 57Possible pSeries reconfig notifier events to be failed are:58 59 * PSERIES_RECONFIG_ADD60 * PSERIES_RECONFIG_REMOVE61 * PSERIES_DRCONF_MEM_ADD62 * PSERIES_DRCONF_MEM_REMOVE63 64Netdevice notifier error injection module65----------------------------------------------66This feature is controlled through debugfs interface67 68  /sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error69 70Netdevice notifier events which can be failed are:71 72 * NETDEV_REGISTER73 * NETDEV_CHANGEMTU74 * NETDEV_CHANGENAME75 * NETDEV_PRE_UP76 * NETDEV_PRE_TYPE_CHANGE77 * NETDEV_POST_INIT78 * NETDEV_PRECHANGEMTU79 * NETDEV_PRECHANGEUPPER80 * NETDEV_CHANGEUPPER81 82Example: Inject netdevice mtu change error (-22 == -EINVAL)::83 84	# cd /sys/kernel/debug/notifier-error-inject/netdev85	# echo -22 > actions/NETDEV_CHANGEMTU/error86	# ip link set eth0 mtu 102487	RTNETLINK answers: Invalid argument88 89For more usage examples90-----------------------91There are tools/testing/selftests using the notifier error injection features92for CPU and memory notifiers.93 94 * tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh95 * tools/testing/selftests/memory-hotplug/mem-on-off-test.sh96 97These scripts first do simple online and offline tests and then do fault98injection tests if notifier error injection module is available.99