Skip to content

notifier error injection

Akinobu Mita linux-mm linux-pm linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 4 repliesIn review

Changelog from the cover letter · 21 lines

* v4 (It is about 11 months since v3)
- prefix all APIs with notifier_err_inject_*
- rearrange debugfs interface
(e.g. $DEBUGFS/cpu-notifier-error-inject/CPU_DOWN_PREPARE -->
$DEBUGFS/notifier-error-inject/cpu/actions/CPU_DOWN_PREPARE/error)
- update modules to follow new interface
- add -r option for memory-notifier.sh to specify percent of offlining memory blocks

* v3
- rewrite to be kernel modules instead of initializing at late_initcall()s (it makes the diffstat look different but most code remains unchanged)
- export err_inject_notifier_block_{init,cleanup} for modules
- export pSeries_reconfig_notifier_{,un}register symbols for a module
- notifier priority can be specified as a module parameter
- add testing scripts in tools/testing/fault-injection

* v2
- "PM: Improve error code of pm_notifier_call_chain()" is now in -next
- "debugfs: add debugfs_create_int" is dropped
- put a comment in err_inject_notifier_block_init()
- only allow valid errno to be injected (-MAX_ERRNO <= errno <= 0)
- improve Kconfig help text
- make CONFIG_PM_NOTIFIER_ERROR_INJECTION visible even if PM_DEBUG is disabled
- make CONFIG_PM_NOTIFIER_ERROR_INJECTION default if PM_DEBUG is enabled

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6fault-injection: notifier error injectionlib/Kconfig.debug lib/Makefile lib/notifier-error-inject.c +1 more+148 -00 replies
2/6cpu: rewrite cpu-notifier-error-inject modulelib/Kconfig.debug lib/cpu-notifier-error-inject.c+39 -400 replies
3/6PM: PM notifier error injection modulelib/Kconfig.debug lib/Makefile lib/pm-notifier-error-inject.c+74 -01 reply
4/6memory: memory notifier error injection modulelib/Kconfig.debug lib/Makefile lib/memory-notifier-error-inject.c+72 -00 replies
5/6powerpc: pSeries reconfig notifier error injection modulelib/Kconfig.debug lib/Makefile lib/pSeries-reconfig-notifier-error-inject.c+70 -00 replies
6/6fault-injection: add notifier error injection testing scriptstools/testing/fault-injection/cpu-notifier.sh tools/testing/fault-injection/memory-notifier.sh+345 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH -v4 0/6] notifier error injection

This provides kernel modules that can be used to test the error handling of notifier call chain failures by injecting artifical errors to the following notifier chain callbacks.

* CPU notifier
* PM notifier
* memory hotplug notifier
* powerpc pSeries reconfig notifier

Example: Inject CPU offline error (-1 == -EPERM)

	# cd /sys/kernel/debug/notifier-error-inject/cpu
	# echo -1 > actions/CPU_DOWN_PREPARE/error
	# echo 0 > /sys/devices/system/cpu/cpu1/online
	bash: echo: write error: Operation not permitted

There are also handy shell scripts to test CPU and memory hotplug notifier. Note that these tests didn't detect error handling bugs on my machine but I still think this feature is usefull to test the code path which is rarely executed.

Changelog:

* v4 (It is about 11 months since v3)
- prefix all APIs with notifier_err_inject_*
- rearrange debugfs interface
(e.g. $DEBUGFS/cpu-notifier-error-inject/CPU_DOWN_PREPARE -->
$DEBUGFS/notifier-error-inject/cpu/actions/CPU_DOWN_PREPARE/error)
- update modules to follow new interface
- add -r option for memory-notifier.sh to specify percent of offlining memory blocks

* v3
- rewrite to be kernel modules instead of initializing at late_initcall()s (it makes the diffstat look different but most code remains unchanged)
- export err_inject_notifier_block_{init,cleanup} for modules
- export pSeries_reconfig_notifier_{,un}register symbols for a module
- notifier priority can be specified as a module parameter
- add testing scripts in tools/testing/fault-injection

* v2
- "PM: Improve error code of pm_notifier_call_chain()" is now in -next
- "debugfs: add debugfs_create_int" is dropped
- put a comment in err_inject_notifier_block_init()
- only allow valid errno to be injected (-MAX_ERRNO <= errno <= 0)
- improve Kconfig help text
- make CONFIG_PM_NOTIFIER_ERROR_INJECTION visible even if PM_DEBUG is disabled
- make CONFIG_PM_NOTIFIER_ERROR_INJECTION default if PM_DEBUG is enabled

Akinobu Mita (6):
fault-injection: notifier error injection
cpu: rewrite cpu-notifier-error-inject module
PM: PM notifier error injection module
memory: memory notifier error injection module
powerpc: pSeries reconfig notifier error injection module
fault-injection: add notifier error injection testing scripts

 lib/Kconfig.debug                                |   91 ++++++++++-
 lib/Makefile                                     |    5 +
 lib/cpu-notifier-error-inject.c                  |   63 +++-----
 lib/memory-notifier-error-inject.c               |   48 ++++++
 lib/notifier-error-inject.c                      |  112 ++++++++++++++
 lib/notifier-error-inject.h                      |   24 +++
 lib/pSeries-reconfig-notifier-error-inject.c     |   51 +++++++
 lib/pm-notifier-error-inject.c                   |   49 ++++++
 tools/testing/fault-injection/cpu-notifier.sh    |  169 +++++++++++++++++++++
 tools/testing/fault-injection/memory-notifier.sh |  176 ++++++++++++++++++++++
 10 files changed, 748 insertions(+), 40 deletions(-)
 create mode 100644 lib/memory-notifier-error-inject.c
 create mode 100644 lib/notifier-error-inject.c
 create mode 100644 lib/notifier-error-inject.h
 create mode 100644 lib/pSeries-reconfig-notifier-error-inject.c
 create mode 100644 lib/pm-notifier-error-inject.c
 create mode 100755 tools/testing/fault-injection/cpu-notifier.sh
 create mode 100755 tools/testing/fault-injection/memory-notifier.sh
Cc Pavel Machek <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Greg KH <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Américo Wang <[email protected]>
Cc Michael Ellerman <[email protected]>
Signature · 1 line
1.7.10.2