notifier error injection
Subsystems (9)
v2 cover notifier error injection
This provides the ability to inject artifical errors to the following notifier chain callbacks. It is useful to test the error handling of notifier call chain failures.
* CPU notifier
* PM notifier
* memory hotplug notifier
* powerpc pSeries reconfig notifier
We already have cpu-notifier-error-inject.ko module providing such functionality for the CPU notifier. However, this patch set adds common basic functions and consistent debugfs interface for them.
Each of the files in the directory represents an event which can be failed and contains the error code. If the notifier call chain should be failed with some events notified, write the error code to the files.
Example: Inject CPU offline error (-1 == -EPERM)
# cd /sys/kernel/debug/cpu-notifier-error-inject # echo -1 > CPU_UP_PREPARE # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted
Changelog:
* 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 (5):
fault-injection: notifier error injection
cpu: CPU notifier error injection
PM: PM notifier error injection
memory: memory notifier error injection
powerpc: pSeries reconfig notifier error injection
Documentation/feature-removal-schedule.txt | 8 +++ arch/powerpc/platforms/pseries/reconfig.c | 31 +++++++++++ drivers/base/memory.c | 29 ++++++++++ include/linux/notifier.h | 25 +++++++++ kernel/cpu.c | 31 +++++++++++ kernel/notifier.c | 81 ++++++++++++++++++++++++++++ kernel/power/main.c | 30 ++++++++++ lib/Kconfig.debug | 71 ++++++++++++++++++++++++ 8 files changed, 306 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.4.4
PATCH v2 1/5 fault-injection: notifier error injection
The notifier error injection provides the ability to inject artifical errors to specified notifier chain callbacks. It is useful to test the error handling of notifier call chain failures.
This adds common basic functions to define which type of events can be fail and to initialize the debugfs interface to control what error code should be returned and which event should be failed.
---
* v2
- put a comment in err_inject_notifier_block_init()
- only allow valid errno to be injected (-MAX_ERRNO <= errno <= 0)
include/linux/notifier.h | 25 ++++++++++++++ kernel/notifier.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 11 ++++++ 3 files changed, 117 insertions(+), 0 deletions(-)
include/linux/notifier.h +25 -0
@@ -278,5 +278,30 @@ extern struct blocking_notifier_head reboot_notifier_list;#define VT_UPDATE 0x0004/* A bigger update occurred */ #define VT_PREWRITE 0x0005/* A char is about to be written to the console */ +#ifdef CONFIG_NOTIFIER_ERROR_INJECTION + +struct err_inject_notifier_action { +unsigned long val; +int error; +const char *name; +}; + +#define ERR_INJECT_NOTIFIER_ACTION (action) \ + .name = #action, .val = (action), + +struct err_inject_notifier_block { +struct notifier_block nb; +struct dentry *dir; +struct err_inject_notifier_action actions[]; +/* The last slot must be terminated with zero sentinel */ +}; + +extern int err_inject_notifier_block_init (struct err_inject_notifier_block *enb, +const char *name,int priority); +extern void err_inject_notifier_block_cleanup ( +struct err_inject_notifier_block *enb); + +#endif /* CONFIG_NOTIFIER_ERROR_INJECTION */ +#endif /* __KERNEL__ */ #endif /* _LINUX_NOTIFIER_H */
kernel/notifier.c +81 -0
90 lines not on this page · raw message
lib/Kconfig.debug +11 -0
@@ -1018,6 +1018,17 @@ config LKDTM Documentation on how to use the module can be found in Documentation/fault-injection/provoke-crashes.txt +config NOTIFIER_ERROR_INJECTION + bool "Notifier error injection" + depends on DEBUG_KERNEL + select DEBUG_FS + help + This option provides the ability to inject artifical errors to + specified notifier chain callbacks. It is useful to test the error + handling of notifier call chain failures. + + Say N if unsure. + config CPU_NOTIFIER_ERROR_INJECT tristate "CPU notifier error injection module" depends on HOTPLUG_CPU && DEBUG_KERNEL
Signature · 1 line
1.7.4.4
PATCH v2 1/5 fault-injection: notifier error injection
In reply to Akinobu MitaThe notifier error injection provides the ability to inject artifical errors to specified notifier chain callbacks. It is useful to test the error handling of notifier call chain failures.
This adds common basic functions to define which type of events can be fail and to initialize the debugfs interface to control what error code should be returned and which event should be failed.
---
* v2
- put a comment in err_inject_notifier_block_init()
- only allow valid errno to be injected (-MAX_ERRNO <= errno <= 0)
include/linux/notifier.h | 25 ++++++++++++++ kernel/notifier.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 11 ++++++ 3 files changed, 117 insertions(+), 0 deletions(-)
include/linux/notifier.h +25 -0
@@ -278,5 +278,30 @@ extern struct blocking_notifier_head reboot_notifier_list;#define VT_UPDATE 0x0004/* A bigger update occurred */ #define VT_PREWRITE 0x0005/* A char is about to be written to the console */ +#ifdef CONFIG_NOTIFIER_ERROR_INJECTION + +struct err_inject_notifier_action { +unsigned long val; +int error; +const char *name; +}; + +#define ERR_INJECT_NOTIFIER_ACTION (action) \ + .name = #action, .val = (action), + +struct err_inject_notifier_block { +struct notifier_block nb; +struct dentry *dir; +struct err_inject_notifier_action actions[]; +/* The last slot must be terminated with zero sentinel */ +}; + +extern int err_inject_notifier_block_init (struct err_inject_notifier_block *enb, +const char *name,int priority); +extern void err_inject_notifier_block_cleanup ( +struct err_inject_notifier_block *enb); + +#endif /* CONFIG_NOTIFIER_ERROR_INJECTION */ +#endif /* __KERNEL__ */ #endif /* _LINUX_NOTIFIER_H */
kernel/notifier.c +81 -0
90 lines not on this page · raw message
lib/Kconfig.debug +11 -0
@@ -1018,6 +1018,17 @@ config LKDTM Documentation on how to use the module can be found in Documentation/fault-injection/provoke-crashes.txt +config NOTIFIER_ERROR_INJECTION + bool "Notifier error injection" + depends on DEBUG_KERNEL + select DEBUG_FS + help + This option provides the ability to inject artifical errors to + specified notifier chain callbacks. It is useful to test the error + handling of notifier call chain failures. + + Say N if unsure. + config CPU_NOTIFIER_ERROR_INJECT tristate "CPU notifier error injection module" depends on HOTPLUG_CPU && DEBUG_KERNEL
Signature · 1 line
1.7.4.4
PATCH v2 2/5 cpu: CPU notifier error injection
In reply to Akinobu MitaThis provides the ability to inject artifical errors to CPU notifier chain callbacks. It is controlled through debugfs interface under /sys/kernel/debug/cpu-notifier-error-inject/
Each of the files in the directory represents an event which can be failed and contains the error code. If the notifier call chain should be failed with some events notified, write the error code to the files.
Example1: inject CPU offline error (-1 == -EPERM)
# echo -1 > /sys/kernel/debug/cpu-notifier-error-inject/CPU_UP_PREPARE # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted
Example2: inject CPU online error (-2 == -ENOENT)
# echo -2 > /sys/kernel/debug/cpu-notifier-error-inject/CPU_DOWN_PREPARE # echo 1 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: No such file or directory
This also schedules cpu-notifier-error-inject.ko module for removal in favor of more generic interface.
---
* v2
- improve Kconfig help text
Documentation/feature-removal-schedule.txt | 8 +++++++ kernel/cpu.c | 31 ++++++++++++++++++++++++++++ lib/Kconfig.debug | 20 ++++++++++++++++++ 3 files changed, 59 insertions(+), 0 deletions(-)
Documentation/feature-removal-schedule.txt +8 -0
@@ -583,3 +583,11 @@ Why: Superseded by the UVCIOC_CTRL_QUERY ioctl. Who: Laurent Pinchart <[email protected]> ---------------------------- + +What: Support for CPU_NOTIFIER_ERROR_INJECT (cpu-notifier-error-inject.ko) +When: 3.3 +Why: Replaced with more generic debugfs interface in + /sys/kernel/debug/cpu-notifier-error-inject/ +Who: Akinobu Mita <[email protected]> + +----------------------------
kernel/cpu.c +31 -0
@@ -170,6 +170,37 @@ void __ref unregister_cpu_notifier(struct notifier_block *nb) }EXPORT_SYMBOL (unregister_cpu_notifier); +#ifdef CONFIG_CPU_NOTIFIER_ERROR_INJECTION + +static struct err_inject_notifier_block err_inject_cpu_notifier = { + .actions = { + {ERR_INJECT_NOTIFIER_ACTION (CPU_UP_PREPARE ) }, + {ERR_INJECT_NOTIFIER_ACTION (CPU_UP_PREPARE_FROZEN ) }, + {ERR_INJECT_NOTIFIER_ACTION (CPU_DOWN_PREPARE ) }, + {ERR_INJECT_NOTIFIER_ACTION (CPU_DOWN_PREPARE_FROZEN ) }, + {} + } +}; + +static int __init err_inject_cpu_notifier_init (void ) +{ +int err; + + err =err_inject_notifier_block_init (&err_inject_cpu_notifier, +"cpu-notifier-error-inject" ,-1 ); +if (err) +return err; + + err =register_hotcpu_notifier (&err_inject_cpu_notifier.nb); +if (err) +err_inject_notifier_block_cleanup (&err_inject_cpu_notifier); + +return err; +} +late_initcall (err_inject_cpu_notifier_init); + +#endif /* CONFIG_CPU_NOTIFIER_ERROR_INJECTION */ +static inline void check_for_tasks (int cpu) {struct task_struct *p;
lib/Kconfig.debug +20 -0
@@ -1029,6 +1029,26 @@ config NOTIFIER_ERROR_INJECTION Say N if unsure. +config CPU_NOTIFIER_ERROR_INJECTION + bool "CPU notifier error injection" + depends on HOTPLUG_CPU && NOTIFIER_ERROR_INJECTION + help + This option provides the ability to inject artifical errors to + CPU notifier chain callbacks. It is controlled through debugfs + interface under /sys/kernel/debug/cpu-notifier-error-inject/ + + Each of the files in the directory represents an event which can be + failed and contains the error code. If the notifier call chain + should be failed with some events notified, write the error code to + the files. + + Example: Inject CPU offline error (-1 == -EPERM) + + # cd /sys/kernel/debug/cpu-notifier-error-inject + # echo -1 > CPU_UP_PREPARE + # echo 0 > /sys/devices/system/cpu/cpu1/online + bash: echo: write error: Operation not permitted + config CPU_NOTIFIER_ERROR_INJECT tristate "CPU notifier error injection module" depends on HOTPLUG_CPU && DEBUG_KERNEL
Signature · 1 line
1.7.4.4
Re: [PATCH v2 2/5] cpu: CPU notifier error injection
On Mon, Jul 18, 2011 at 9:16 AM, Akinobu Mita <[email protected]> wrote:
...
Quoted 8 lines
Documentation/feature-removal-schedule.txt +0
-0@@ -583,3 +583,11 @@ Why: Superseded by the UVCIOC_CTRL_QUERY ioctl.Who: Laurent Pinchart <[email protected]>
----------------------------
Documentation/feature-removal-schedule.txt Why: Superseded by the UVCIOC_CTRL_QUERY ioctl. · line 591
Quoted 6 lines
Documentation/feature-removal-schedule.txt +6
-0+ +What: Support for CPU_NOTIFIER_ERROR_INJECT (cpu-notifier-error-inject.ko) +When: 3.3 +Why: Replaced with more generic debugfs interface in + /sys/kernel/debug/cpu-notifier-error-inject/ +Who: Akinobu Mita <[email protected]>
Hi, Akinobu,
I think it is okay to just remove it by this patchset, no need to defer it.
Re: [PATCH v2 2/5] cpu: CPU notifier error injection
2011/7/18 Américo Wang <[email protected]>:
Quoted 19 lines · Akinobu Mita
...
Quoted 8 lines
Documentation/feature-removal-schedule.txt +0
-0@@ -583,3 +583,11 @@ Why: Superseded by the UVCIOC_CTRL_QUERY ioctl.Who: Laurent Pinchart <[email protected]>
----------------------------
Documentation/feature-removal-schedule.txt Why: Superseded by the UVCIOC_CTRL_QUERY ioctl. · line 591
Quoted 6 lines
Documentation/feature-removal-schedule.txt +6
-0+ +What: Support for CPU_NOTIFIER_ERROR_INJECT (cpu-notifier-error-inject.ko) +When: 3.3 +Why: Replaced with more generic debugfs interface in + /sys/kernel/debug/cpu-notifier-error-inject/ +Who: Akinobu Mita <[email protected]>Hi, Akinobu,
Quoted 1 line
I think it is okay to just remove it by this patchset, no need to defer it.
The only drawback is that new machanism has no way to specify notifier priority and the priority is hard-coded to be -1. So it can only inject error at the tail of notifier chain.
My plan to fix that was the kernel parameters. But it's not flexible as it needs to reboot for changing the priority.
So I'm now considering keeping this kernel module style instead of initializing in late_initcall().
PATCH v2 3/5 PM: PM notifier error injection
In reply to Akinobu MitaThis provides the ability to inject artifical errors to PM notifier chain callbacks. It is controlled through debugfs interface under /sys/kernel/debug/pm-notifier-error-inject/
Each of the files in the directory represents an event which can be failed and contains the error code. If the notifier call chain should be failed with some events notified, write the error code to the files.
Example: Inject PM suspend error (-12 = -ENOMEM)
# cd /sys/kernel/debug/pm-notifier-error-inject # echo -12 > PM_SUSPEND_PREPARE # echo mem > /sys/power/state bash: echo: write error: Cannot allocate memory
---
* v2
- 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
kernel/power/main.c | 30 ++++++++++++++++++++++++++++++ lib/Kconfig.debug | 16 ++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-)
kernel/power/main.c +30 -0
@@ -42,6 +42,36 @@ int pm_notifier_call_chain(unsigned long val)return notifier_to_errno (ret); } +#ifdef CONFIG_PM_NOTIFIER_ERROR_INJECTION + +static struct err_inject_notifier_block err_inject_pm_notifier = { + .actions = { + {ERR_INJECT_NOTIFIER_ACTION (PM_HIBERNATION_PREPARE ) }, + {ERR_INJECT_NOTIFIER_ACTION (PM_SUSPEND_PREPARE ) }, + {ERR_INJECT_NOTIFIER_ACTION (PM_RESTORE_PREPARE ) }, + {} + } +}; + +static int __init err_inject_pm_notifier_init (void ) +{ +int err; + + err =err_inject_notifier_block_init (&err_inject_pm_notifier, +"pm-notifier-error-inject" ,-1 ); +if (err) +return err; + + err =register_pm_notifier (&err_inject_pm_notifier.nb); +if (err) +err_inject_notifier_block_cleanup (&err_inject_pm_notifier); + +return err; +} +late_initcall (err_inject_pm_notifier_init); + +#endif /* CONFIG_PM_NOTIFIER_ERROR_INJECTION */ +/* If set, devices may be suspended and resumed asynchronously. */ int pm_async_enabled =1 ;
lib/Kconfig.debug +16 -0
@@ -1049,6 +1049,22 @@ config CPU_NOTIFIER_ERROR_INJECTION # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted +config PM_NOTIFIER_ERROR_INJECTION + bool "PM notifier error injection" + depends on PM && NOTIFIER_ERROR_INJECTION + default PM_DEBUG + help + This option provides the ability to inject artifical errors to + PM notifier chain callbacks. It is controlled through debugfs + interface. + + Example: Inject PM suspend error (-12 = -ENOMEM) + + # cd /sys/kernel/debug/pm-notifier-error-inject + # echo -12 > PM_SUSPEND_PREPARE + # echo mem > /sys/power/state + bash: echo: write error: Cannot allocate memory + config CPU_NOTIFIER_ERROR_INJECT tristate "CPU notifier error injection module" depends on HOTPLUG_CPU && DEBUG_KERNEL
Signature · 1 line
1.7.4.4
PATCH v2 3/5 PM: PM notifier error injection
In reply to Akinobu MitaThis provides the ability to inject artifical errors to PM notifier chain callbacks. It is controlled through debugfs interface under /sys/kernel/debug/pm-notifier-error-inject/
Each of the files in the directory represents an event which can be failed and contains the error code. If the notifier call chain should be failed with some events notified, write the error code to the files.
Example: Inject PM suspend error (-12 = -ENOMEM)
# cd /sys/kernel/debug/pm-notifier-error-inject # echo -12 > PM_SUSPEND_PREPARE # echo mem > /sys/power/state bash: echo: write error: Cannot allocate memory
---
* v2
- 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
kernel/power/main.c | 30 ++++++++++++++++++++++++++++++ lib/Kconfig.debug | 16 ++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-)
kernel/power/main.c +30 -0
@@ -42,6 +42,36 @@ int pm_notifier_call_chain(unsigned long val)return notifier_to_errno (ret); } +#ifdef CONFIG_PM_NOTIFIER_ERROR_INJECTION + +static struct err_inject_notifier_block err_inject_pm_notifier = { + .actions = { + {ERR_INJECT_NOTIFIER_ACTION (PM_HIBERNATION_PREPARE ) }, + {ERR_INJECT_NOTIFIER_ACTION (PM_SUSPEND_PREPARE ) }, + {ERR_INJECT_NOTIFIER_ACTION (PM_RESTORE_PREPARE ) }, + {} + } +}; + +static int __init err_inject_pm_notifier_init (void ) +{ +int err; + + err =err_inject_notifier_block_init (&err_inject_pm_notifier, +"pm-notifier-error-inject" ,-1 ); +if (err) +return err; + + err =register_pm_notifier (&err_inject_pm_notifier.nb); +if (err) +err_inject_notifier_block_cleanup (&err_inject_pm_notifier); + +return err; +} +late_initcall (err_inject_pm_notifier_init); + +#endif /* CONFIG_PM_NOTIFIER_ERROR_INJECTION */ +/* If set, devices may be suspended and resumed asynchronously. */ int pm_async_enabled =1 ;
lib/Kconfig.debug +16 -0
@@ -1049,6 +1049,22 @@ config CPU_NOTIFIER_ERROR_INJECTION # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted +config PM_NOTIFIER_ERROR_INJECTION + bool "PM notifier error injection" + depends on PM && NOTIFIER_ERROR_INJECTION + default PM_DEBUG + help + This option provides the ability to inject artifical errors to + PM notifier chain callbacks. It is controlled through debugfs + interface. + + Example: Inject PM suspend error (-12 = -ENOMEM) + + # cd /sys/kernel/debug/pm-notifier-error-inject + # echo -12 > PM_SUSPEND_PREPARE + # echo mem > /sys/power/state + bash: echo: write error: Cannot allocate memory + config CPU_NOTIFIER_ERROR_INJECT tristate "CPU notifier error injection module" depends on HOTPLUG_CPU && DEBUG_KERNEL
Signature · 1 line
1.7.4.4
PATCH v2 4/5 memory: memory notifier error injection
In reply to Akinobu MitaThis provides the ability to inject artifical errors to memory hotplug notifier chain callbacks. It is controlled through debugfs interface under /sys/kernel/debug/memory-notifier-error-inject/
Each of the files in the directory represents an event which can be failed and contains the error code. If the notifier call chain should be failed with some events notified, write the error code to the files.
Example: Inject memory hotplug offline error (-12 == -ENOMEM)
# cd /sys/kernel/debug/memory-notifier-error-inject # echo -12 > MEM_GOING_OFFLINE # echo offline > /sys/devices/system/memory/memoryXXX/state bash: echo: write error: Cannot allocate memory
---
* v2
- improve Kconfig help text
drivers/base/memory.c | 29 +++++++++++++++++++++++++++++ lib/Kconfig.debug | 15 +++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-)
drivers/base/memory.c +29 -0
@@ -89,6 +89,35 @@ void unregister_memory_isolate_notifier(struct notifier_block *nb) }EXPORT_SYMBOL (unregister_memory_isolate_notifier); +#ifdef CONFIG_MEMORY_NOTIFIER_ERROR_INJECTION + +static struct err_inject_notifier_block err_inject_memory_notifier = { + .actions = { + {ERR_INJECT_NOTIFIER_ACTION (MEM_GOING_ONLINE ) }, + {ERR_INJECT_NOTIFIER_ACTION (MEM_GOING_OFFLINE ) }, + {} + } +}; + +static int __init err_inject_memory_notifier_init (void ) +{ +int err; + + err =err_inject_notifier_block_init (&err_inject_memory_notifier, +"memory-notifier-error-inject" ,-1 ); +if (err) +return err; + + err =register_memory_notifier (&err_inject_memory_notifier.nb); +if (err) +err_inject_notifier_block_cleanup (&err_inject_memory_notifier); + +return err; +} +late_initcall (err_inject_memory_notifier_init); + +#endif /* CONFIG_MEMORY_NOTIFIER_ERROR_INJECTION */ +/* * register_memory - Setup a sysfs device for a memory block */
lib/Kconfig.debug +15 -0
@@ -1065,6 +1065,21 @@ config PM_NOTIFIER_ERROR_INJECTION # echo mem > /sys/power/state bash: echo: write error: Cannot allocate memory +config MEMORY_NOTIFIER_ERROR_INJECTION + bool "Memory hotplug notifier error injection" + depends on MEMORY_HOTPLUG_SPARSE && NOTIFIER_ERROR_INJECTION + help + This option provides the ability to inject artifical errors to + memory hotplug notifier chain callbacks. It is controlled through + debugfs interface. + + Example: Inject memory hotplug offline error (-12 == -ENOMEM) + + # cd /sys/kernel/debug/memory-notifier-error-inject + # echo -12 > MEM_GOING_OFFLINE + # echo offline > /sys/devices/system/memory/memoryXXX/state + bash: echo: write error: Cannot allocate memory + config CPU_NOTIFIER_ERROR_INJECT tristate "CPU notifier error injection module" depends on HOTPLUG_CPU && DEBUG_KERNEL
Signature · 8 lines
1.7.4.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 5/5 powerpc: pSeries reconfig notifier error injection
In reply to Akinobu MitaThis provides the ability to inject artifical errors to pSeries reconfig notifier chain callbacks. It is controlled through debugfs interface under /sys/kernel/debug/pSeries-reconfig-notifier-error-inject/
Each of the files in the directory represents an event which can be failed and contains the error code. If the notifier call chain should be failed with some events notified, write the error code to the files.
---
- Nothing changed from v1
arch/powerpc/platforms/pseries/reconfig.c | 31 +++++++++++++++++++++++++++++ lib/Kconfig.debug | 9 ++++++++ 2 files changed, 40 insertions(+), 0 deletions(-)
arch/powerpc/platforms/pseries/reconfig.c +31 -0
@@ -117,6 +117,37 @@ int pSeries_reconfig_notify(unsigned long action, void *p)return notifier_to_errno (err); } +#ifdef CONFIG_PSERIES_RECONFIG_NOTIFIER_ERROR_INJECTION + +static struct err_inject_notifier_block err_inject_reconfig_nb = { + .actions = { + {ERR_INJECT_NOTIFIER_ACTION (PSERIES_RECONFIG_ADD ) }, + {ERR_INJECT_NOTIFIER_ACTION (PSERIES_RECONFIG_REMOVE ) }, + {ERR_INJECT_NOTIFIER_ACTION (PSERIES_DRCONF_MEM_ADD ) }, + {ERR_INJECT_NOTIFIER_ACTION (PSERIES_DRCONF_MEM_REMOVE ) }, + {} + } +}; + +static int __init err_inject_reconfig_notifier_init (void ) +{ +int err; + + err =err_inject_notifier_block_init (&err_inject_reconfig_nb, +"pSeries-reconfig-notifier-error-inject" ,-1 ); +if (err) +return err; + + err =pSeries_reconfig_notifier_register (&err_inject_reconfig_nb.nb); +if (err) +err_inject_notifier_block_cleanup (&err_inject_reconfig_nb); + +return err; +} +late_initcall (err_inject_reconfig_notifier_init); + +#endif /* CONFIG_PSERIES_RECONFIG_NOTIFIER_ERROR_INJECTION */ +static int pSeries_reconfig_add_node (const char *path,struct property *proplist) {struct device_node *np;
lib/Kconfig.debug +9 -0
@@ -1080,6 +1080,15 @@ config MEMORY_NOTIFIER_ERROR_INJECTION # echo offline > /sys/devices/system/memory/memoryXXX/state bash: echo: write error: Cannot allocate memory +config PSERIES_RECONFIG_NOTIFIER_ERROR_INJECTION + bool "pSeries reconfig notifier error injection" + depends on PPC_PSERIES && NOTIFIER_ERROR_INJECTION + help + This option provides the ability to inject artifical errors to + pSeries reconfig notifier chain callbacks. It is controlled + through debugfs interface under + /sys/kernel/debug/pSeries-reconfig-notifier-error-inject/ + config CPU_NOTIFIER_ERROR_INJECT tristate "CPU notifier error injection module" depends on HOTPLUG_CPU && DEBUG_KERNEL
Signature · 1 line
1.7.4.4
Andrew Morton
maintainerQuoted 3 lines · On Mon, 18 Jul 2011 10:16:01 +0900 Akinobu Mita <[email protected]> wrote:
This provides the ability to inject artifical errors to the following notifier chain callbacks. It is useful to test the error handling of notifier call chain failures.
That all looks very nice, but I wonder how many people are actually using these things. The injection framework itself doesn't seem to have had a lot of uptake.
I wonder if we could improve things by adding an easy-to-run testing script which identifies all the available error-injection inputs, exercises them and then reports on the result?
Such a script would logically reside under ./tests/fault-injection/, but we still don't have a tests/ directory. Which perhaps tells us something ;)
On Fri, Jul 22, 2011 at 5:37 AM, Andrew Morton
<[email protected]> wrote:
...
Quoted 3 lines
Such a script would logically reside under ./tests/fault-injection/, but we still don't have a tests/ directory. Which perhaps tells us something ;)
We have tools/testing/. :)
2011/7/22 Andrew Morton <[email protected]>:
Quoted 11 lines
Quoted 3 lines · On Mon, 18 Jul 2011 10:16:01 +0900 Akinobu Mita <[email protected]> wrote:
This provides the ability to inject artifical errors to the following notifier chain callbacks. It is useful to test the error handling of notifier call chain failures.
That all looks very nice, but I wonder how many people are actually using these things. The injection framework itself doesn't seem to have had a lot of uptake.
Quoted 7 lines
I wonder if we could improve things by adding an easy-to-run testing script which identifies all the available error-injection inputs, exercises them and then reports on the result?
Such a script would logically reside under ./tests/fault-injection/, but we still don't have a tests/ directory. Which perhaps tells us something ;)
Sounds goood. I'll create shell script that detects hot-pluggable CPU or memory block and runs quick tests.
BTW, the patchset has been rewritten to be kernel modules rather than initializing at late_initcall()s. The reason for switching to kernel modules is to provide an easy way to specify notifier priority as module parameter. I'll send newer patchset soon.