aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2008-09-04 04:24:14 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-14 04:36:45 -0400
commitf09ce573f57ddc35c67b39e51f34545877b30031 (patch)
tree776620a03aa55eecf5497b2a2a8027de6d819624 /kernel/trace/trace.c
parent5a90f577e5369a84b720ead42e621fcb1b8a8b21 (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>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c8
1 files changed, 5 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
3092int __ftrace_printk(unsigned long ip, const char *fmt, ...) 3093int __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);