From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] ftrace: make ftrace_printk usable with the other tracers
Date: Thu, 04 Sep 2008 10:24:14 +0200 [thread overview]
Message-ID: <1220516654.8609.200.camel@twins> (raw)
In-Reply-To: <20080903214249.661170580@goodmis.org>
Subject: ftrace: make ftrace_printk usable with the other tracers
From: Peter Zijlstra <a.p.zijlstra@chello.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@redhat.com: tweak to the disable condition]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.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 */
next prev parent reply other threads:[~2008-09-04 8:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-03 21:42 [PATCH 0/2] ftrace: ftrace_printk fixes Steven Rostedt
2008-09-03 21:42 ` [PATCH 1/2] ftrace: binary and not logical for continue test Steven Rostedt
2008-09-03 21:42 ` [PATCH 2/2] ftrace: print continue index fix Steven Rostedt
2008-09-04 7:41 ` [PATCH 0/2] ftrace: ftrace_printk fixes Peter Zijlstra
2008-09-04 8:24 ` Peter Zijlstra [this message]
2008-09-04 8:24 ` [PATCH] ftrace: sched_switch: show the wakee's cpu Peter Zijlstra
2008-09-04 10:16 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1220516654.8609.200.camel@twins \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox