[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1220516654.8609.200.camel@twins>
Date: Thu, 04 Sep 2008 10:24:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] ftrace: make ftrace_printk usable with the other tracers
Subject: ftrace: make ftrace_printk usable with the other tracers
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Date: Tue Sep 02 21:12:13 CEST 2008
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@...hat.com: tweak to the disable condition]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
---
kernel/trace/trace.c | 41 +++++++++++++++++++++++++++--------------
kernel/trace/trace.h | 2 ++
2 files changed, 29 insertions(+), 14 deletions(-)
Index: linux-2.6/kernel/trace/trace.c
===================================================================
--- linux-2.6.orig/kernel/trace/trace.c
+++ linux-2.6/kernel/trace/trace.c
@@ -235,6 +235,7 @@ static const char *trace_options[] = {
"block",
"stacktrace",
"sched-tree",
+ "ftrace_printk",
NULL
};
@@ -3086,9 +3098,10 @@ static __init void tracer_init_debugfs(v
int __ftrace_printk(unsigned long ip, const char *fmt, ...)
{
- struct trace_array *tr = &global_trace;
static DEFINE_SPINLOCK(trace_buf_lock);
static char trace_buf[TRACE_BUF_SIZE];
+
+ struct trace_array *tr = &global_trace;
struct trace_array_cpu *data;
struct trace_entry *entry;
unsigned long flags;
@@ -3096,7 +3109,7 @@ int __ftrace_printk(unsigned long ip, co
va_list ap;
int cpu, len = 0, write, written = 0;
- if (likely(!ftrace_function_enabled))
+ if (!(trace_flags & TRACE_ITER_PRINTK) || !tr->ctrl || tracing_disabled)
return 0;
local_irq_save(flags);
@@ -3104,7 +3117,7 @@ int __ftrace_printk(unsigned long ip, co
data = tr->data[cpu];
disabled = atomic_inc_return(&data->disabled);
- if (unlikely(disabled != 1 || !ftrace_function_enabled))
+ if (unlikely(disabled != 1))
goto out;
spin_lock(&trace_buf_lock);
Index: linux-2.6/kernel/trace/trace.h
===================================================================
--- linux-2.6.orig/kernel/trace/trace.h
+++ linux-2.6/kernel/trace/trace.h
@@ -356,6 +357,7 @@ enum trace_iterator_flags {
TRACE_ITER_BLOCK = 0x80,
TRACE_ITER_STACKTRACE = 0x100,
TRACE_ITER_SCHED_TREE = 0x200,
+ TRACE_ITER_PRINTK = 0x400,
};
#endif /* _LINUX_KERNEL_TRACE_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists