aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2007-02-20 16:57:56 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-20 20:10:14 -0500
commit1df49008f4ddec9d4f6862b47ea5bdba82078aa4 (patch)
treeaf5c77fa8de93a8d48654a4c30c2418e7993a3e7 /lib
parent94412a96c4553255bda7a232a349059dd7543338 (diff)
[PATCH] fault injection: split up stacktrace filter Kconfig option
There is no prompt for CONFIG_STACKTRACE, so FAULT_INJECTION cannot be selected without LOCKDEP enabled. (found by Paolo 'Blaisorblade' Giarrusso) In order to fix such broken Kconfig dependency, this patch splits up the stacktrace filter support for fault injection by new Kconfig option, which enables to use fault injection on the architecture which doesn't have general stacktrace support. Cc: "Paolo 'Blaisorblade' Giarrusso" <blaisorblade@yahoo.it> 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>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug10
-rw-r--r--lib/fault-inject.c41
2 files changed, 29 insertions, 22 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 4448f91b865c..3f3e7403dcac 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -411,8 +411,6 @@ config LKDTM
411config FAULT_INJECTION 411config FAULT_INJECTION
412 bool "Fault-injection framework" 412 bool "Fault-injection framework"
413 depends on DEBUG_KERNEL 413 depends on DEBUG_KERNEL
414 depends on STACKTRACE
415 select FRAME_POINTER
416 help 414 help
417 Provide fault-injection framework. 415 Provide fault-injection framework.
418 For more details, see Documentation/fault-injection/. 416 For more details, see Documentation/fault-injection/.
@@ -440,3 +438,11 @@ config FAULT_INJECTION_DEBUG_FS
440 depends on FAULT_INJECTION && SYSFS && DEBUG_FS 438 depends on FAULT_INJECTION && SYSFS && DEBUG_FS
441 help 439 help
442 Enable configuration of fault-injection capabilities via debugfs. 440 Enable configuration of fault-injection capabilities via debugfs.
441
442config FAULT_INJECTION_STACKTRACE_FILTER
443 bool "stacktrace filter for fault-injection capabilities"
444 depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
445 select STACKTRACE
446 select FRAME_POINTER
447 help
448 Provide stacktrace filter for fault-injection capabilities
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index b5a90fc056d3..0fabd12c39d7 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -55,7 +55,7 @@ static bool fail_task(struct fault_attr *attr, struct task_struct *task)
55 55
56#define MAX_STACK_TRACE_DEPTH 32 56#define MAX_STACK_TRACE_DEPTH 32
57 57
58#if defined(CONFIG_STACKTRACE) 58#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
59 59
60static bool fail_stacktrace(struct fault_attr *attr) 60static bool fail_stacktrace(struct fault_attr *attr)
61{ 61{
@@ -90,17 +90,10 @@ static bool fail_stacktrace(struct fault_attr *attr)
90 90
91static inline bool fail_stacktrace(struct fault_attr *attr) 91static inline bool fail_stacktrace(struct fault_attr *attr)
92{ 92{
93 static bool firsttime = true; 93 return true;
94
95 if (firsttime) {
96 printk(KERN_WARNING
97 "This architecture does not implement save_stack_trace()\n");
98 firsttime = false;
99 }
100 return false;
101} 94}
102 95
103#endif 96#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */
104 97
105/* 98/*
106 * This code is stolen from failmalloc-1.0 99 * This code is stolen from failmalloc-1.0
@@ -217,6 +210,8 @@ void cleanup_fault_attr_dentries(struct fault_attr *attr)
217 debugfs_remove(attr->dentries.task_filter_file); 210 debugfs_remove(attr->dentries.task_filter_file);
218 attr->dentries.task_filter_file = NULL; 211 attr->dentries.task_filter_file = NULL;
219 212
213#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
214
220 debugfs_remove(attr->dentries.stacktrace_depth_file); 215 debugfs_remove(attr->dentries.stacktrace_depth_file);
221 attr->dentries.stacktrace_depth_file = NULL; 216 attr->dentries.stacktrace_depth_file = NULL;
222 217
@@ -232,6 +227,8 @@ void cleanup_fault_attr_dentries(struct fault_attr *attr)
232 debugfs_remove(attr->dentries.reject_end_file); 227 debugfs_remove(attr->dentries.reject_end_file);
233 attr->dentries.reject_end_file = NULL; 228 attr->dentries.reject_end_file = NULL;
234 229
230#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */
231
235 if (attr->dentries.dir) 232 if (attr->dentries.dir)
236 WARN_ON(!simple_empty(attr->dentries.dir)); 233 WARN_ON(!simple_empty(attr->dentries.dir));
237 234
@@ -269,6 +266,13 @@ int init_fault_attr_dentries(struct fault_attr *attr, const char *name)
269 attr->dentries.task_filter_file = debugfs_create_bool("task-filter", 266 attr->dentries.task_filter_file = debugfs_create_bool("task-filter",
270 mode, dir, &attr->task_filter); 267 mode, dir, &attr->task_filter);
271 268
269 if (!attr->dentries.probability_file || !attr->dentries.interval_file ||
270 !attr->dentries.times_file || !attr->dentries.space_file ||
271 !attr->dentries.verbose_file || !attr->dentries.task_filter_file)
272 goto fail;
273
274#ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER
275
272 attr->dentries.stacktrace_depth_file = 276 attr->dentries.stacktrace_depth_file =
273 debugfs_create_ul_MAX_STACK_TRACE_DEPTH( 277 debugfs_create_ul_MAX_STACK_TRACE_DEPTH(
274 "stacktrace-depth", mode, dir, &attr->stacktrace_depth); 278 "stacktrace-depth", mode, dir, &attr->stacktrace_depth);
@@ -285,18 +289,15 @@ int init_fault_attr_dentries(struct fault_attr *attr, const char *name)
285 attr->dentries.reject_end_file = 289 attr->dentries.reject_end_file =
286 debugfs_create_ul("reject-end", mode, dir, &attr->reject_end); 290 debugfs_create_ul("reject-end", mode, dir, &attr->reject_end);
287 291
288 292 if (!attr->dentries.stacktrace_depth_file ||
289 if (!attr->dentries.probability_file || !attr->dentries.interval_file 293 !attr->dentries.require_start_file ||
290 || !attr->dentries.times_file || !attr->dentries.space_file 294 !attr->dentries.require_end_file ||
291 || !attr->dentries.verbose_file || !attr->dentries.task_filter_file 295 !attr->dentries.reject_start_file ||
292 || !attr->dentries.stacktrace_depth_file 296 !attr->dentries.reject_end_file)
293 || !attr->dentries.require_start_file
294 || !attr->dentries.require_end_file
295 || !attr->dentries.reject_start_file
296 || !attr->dentries.reject_end_file
297 )
298 goto fail; 297 goto fail;
299 298
299#endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */
300
300 return 0; 301 return 0;
301fail: 302fail:
302 cleanup_fault_attr_dentries(attr); 303 cleanup_fault_attr_dentries(attr);