notifier-error-inject.rst 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. Notifier error injection
  2. ========================
  3. Notifier error injection provides the ability to inject artificial errors to
  4. specified notifier chain callbacks. It is useful to test the error handling of
  5. notifier call chain failures which is rarely executed. There are kernel
  6. modules that can be used to test the following notifiers.
  7. * PM notifier
  8. * Memory hotplug notifier
  9. * powerpc pSeries reconfig notifier
  10. * Netdevice notifier
  11. PM notifier error injection module
  12. ----------------------------------
  13. This feature is controlled through debugfs interface
  14. /sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
  15. Possible PM notifier events to be failed are:
  16. * PM_HIBERNATION_PREPARE
  17. * PM_SUSPEND_PREPARE
  18. * PM_RESTORE_PREPARE
  19. Example: Inject PM suspend error (-12 = -ENOMEM)::
  20. # cd /sys/kernel/debug/notifier-error-inject/pm/
  21. # echo -12 > actions/PM_SUSPEND_PREPARE/error
  22. # echo mem > /sys/power/state
  23. bash: echo: write error: Cannot allocate memory
  24. Memory hotplug notifier error injection module
  25. ----------------------------------------------
  26. This feature is controlled through debugfs interface
  27. /sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
  28. Possible memory notifier events to be failed are:
  29. * MEM_GOING_ONLINE
  30. * MEM_GOING_OFFLINE
  31. Example: Inject memory hotplug offline error (-12 == -ENOMEM)::
  32. # cd /sys/kernel/debug/notifier-error-inject/memory
  33. # echo -12 > actions/MEM_GOING_OFFLINE/error
  34. # echo offline > /sys/devices/system/memory/memoryXXX/state
  35. bash: echo: write error: Cannot allocate memory
  36. powerpc pSeries reconfig notifier error injection module
  37. --------------------------------------------------------
  38. This feature is controlled through debugfs interface
  39. /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
  40. Possible pSeries reconfig notifier events to be failed are:
  41. * PSERIES_RECONFIG_ADD
  42. * PSERIES_RECONFIG_REMOVE
  43. * PSERIES_DRCONF_MEM_ADD
  44. * PSERIES_DRCONF_MEM_REMOVE
  45. Netdevice notifier error injection module
  46. ----------------------------------------------
  47. This feature is controlled through debugfs interface
  48. /sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
  49. Netdevice notifier events which can be failed are:
  50. * NETDEV_REGISTER
  51. * NETDEV_CHANGEMTU
  52. * NETDEV_CHANGENAME
  53. * NETDEV_PRE_UP
  54. * NETDEV_PRE_TYPE_CHANGE
  55. * NETDEV_POST_INIT
  56. * NETDEV_PRECHANGEMTU
  57. * NETDEV_PRECHANGEUPPER
  58. * NETDEV_CHANGEUPPER
  59. Example: Inject netdevice mtu change error (-22 == -EINVAL)::
  60. # cd /sys/kernel/debug/notifier-error-inject/netdev
  61. # echo -22 > actions/NETDEV_CHANGEMTU/error
  62. # ip link set eth0 mtu 1024
  63. RTNETLINK answers: Invalid argument
  64. For more usage examples
  65. -----------------------
  66. There are tools/testing/selftests using the notifier error injection features
  67. for CPU and memory notifiers.
  68. * tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
  69. * tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
  70. These scripts first do simple online and offline tests and then do fault
  71. injection tests if notifier error injection module is available.