fault-injection: add CPU notifier error injection module

I used this module to test the series of modification to the cpu notifiers
code.

Example1: inject CPU offline error (-1 == -EPERM)

	# modprobe cpu-notifier-error-inject cpu_down_prepare_error=-1
	# echo 0 > /sys/devices/system/cpu/cpu1/online
	bash: echo: write error: Operation not permitted

Example2: inject CPU online error (-2 == -ENOENT)

	# modprobe cpu-notifier-error-inject cpu_up_prepare_error=-2
	# echo 1 > /sys/devices/system/cpu/cpu1/online
	bash: echo: write error: No such file or directory

[akpm@linux-foundation.org: fix Kconfig help text]
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Akinobu Mita
2010-05-26 14:43:36 -07:00
committed by Linus Torvalds
parent 55af6bb509
commit c9d221f86e
3 changed files with 76 additions and 0 deletions

View File

@@ -898,6 +898,18 @@ config LKDTM
Documentation on how to use the module can be found in
Documentation/fault-injection/provoke-crashes.txt
config CPU_NOTIFIER_ERROR_INJECT
tristate "CPU notifier error injection module"
depends on HOTPLUG_CPU && DEBUG_KERNEL
help
This option provides a kernel module that can be used to test
the error handling of the cpu notifiers
To compile this code as a module, choose M here: the module will
be called cpu-notifier-error-inject.
If unsure, say N.
config FAULT_INJECTION
bool "Fault-injection framework"
depends on DEBUG_KERNEL