diff options
author | Peter Zijlstra <peterz@infradead.org> | 2008-09-04 04:24:14 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-14 04:36:45 -0400 |
commit | f09ce573f57ddc35c67b39e51f34545877b30031 (patch) | |
tree | 776620a03aa55eecf5497b2a2a8027de6d819624 | |
parent | 5a90f577e5369a84b720ead42e621fcb1b8a8b21 (diff) |
ftrace: make ftrace_printk usable with the other tracers
Currently ftrace_printk only works with the ftrace tracer, switch it to an
iter_ctrl setting so we can make us of them with other tracers too.
[rostedt@redhat.com: tweak to the disable condition]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/trace.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d24101cfc425..8a00d6c5c0f5 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -235,6 +235,7 @@ static const char *trace_options[] = { | |||
235 | "block", | 235 | "block", |
236 | "stacktrace", | 236 | "stacktrace", |
237 | "sched-tree", | 237 | "sched-tree", |
238 | "ftrace_printk", | ||
238 | NULL | 239 | NULL |
239 | }; | 240 | }; |
240 | 241 | ||
@@ -3091,9 +3092,10 @@ static __init void tracer_init_debugfs(void) | |||
3091 | 3092 | ||
3092 | int __ftrace_printk(unsigned long ip, const char *fmt, ...) | 3093 | int __ftrace_printk(unsigned long ip, const char *fmt, ...) |
3093 | { | 3094 | { |
3094 | struct trace_array *tr = &global_trace; | ||
3095 | static DEFINE_SPINLOCK(trace_buf_lock); | 3095 | static DEFINE_SPINLOCK(trace_buf_lock); |
3096 | static char trace_buf[TRACE_BUF_SIZE]; | 3096 | static char trace_buf[TRACE_BUF_SIZE]; |
3097 | |||
3098 | struct trace_array *tr = &global_trace; | ||
3097 | struct trace_array_cpu *data; | 3099 | struct trace_array_cpu *data; |
3098 | struct trace_entry *entry; | 3100 | struct trace_entry *entry; |
3099 | unsigned long flags; | 3101 | unsigned long flags; |
@@ -3101,7 +3103,7 @@ int __ftrace_printk(unsigned long ip, const char *fmt, ...) | |||
3101 | va_list ap; | 3103 | va_list ap; |
3102 | int cpu, len = 0, write, written = 0; | 3104 | int cpu, len = 0, write, written = 0; |
3103 | 3105 | ||
3104 | if (likely(!ftrace_function_enabled)) | 3106 | if (!(trace_flags & TRACE_ITER_PRINTK) || !tr->ctrl || tracing_disabled) |
3105 | return 0; | 3107 | return 0; |
3106 | 3108 | ||
3107 | local_irq_save(flags); | 3109 | local_irq_save(flags); |
@@ -3109,7 +3111,7 @@ int __ftrace_printk(unsigned long ip, const char *fmt, ...) | |||
3109 | data = tr->data[cpu]; | 3111 | data = tr->data[cpu]; |
3110 | disabled = atomic_inc_return(&data->disabled); | 3112 | disabled = atomic_inc_return(&data->disabled); |
3111 | 3113 | ||
3112 | if (unlikely(disabled != 1 || !ftrace_function_enabled)) | 3114 | if (unlikely(disabled != 1)) |
3113 | goto out; | 3115 | goto out; |
3114 | 3116 | ||
3115 | spin_lock(&trace_buf_lock); | 3117 | spin_lock(&trace_buf_lock); |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 50b6d7a6f01a..5f54c875c8be 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -356,6 +356,7 @@ enum trace_iterator_flags { | |||
356 | TRACE_ITER_BLOCK = 0x80, | 356 | TRACE_ITER_BLOCK = 0x80, |
357 | TRACE_ITER_STACKTRACE = 0x100, | 357 | TRACE_ITER_STACKTRACE = 0x100, |
358 | TRACE_ITER_SCHED_TREE = 0x200, | 358 | TRACE_ITER_SCHED_TREE = 0x200, |
359 | TRACE_ITER_PRINTK = 0x400, | ||
359 | }; | 360 | }; |
360 | 361 | ||
361 | #endif /* _LINUX_KERNEL_TRACE_H */ | 362 | #endif /* _LINUX_KERNEL_TRACE_H */ |