[for-next][PATCH 3/4] tracing: Add internal ftrace trace_puts() for ftrace to use

From: Steven Rostedt
Date: Sun Mar 10 2013 - 11:36:23 EST


From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>

There's a few places that ftrace uses trace_printk() for internal
use, but this requires context (normal, softirq, irq, NMI) buffers
to keep things lockless. But the trace_puts() does not, as it can
write the string directly into the ring buffer. Make a internal helper
for trace_puts() and have the internal functions use that.

This way the extra context buffers are not used.

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/trace/trace.c | 8 ++++----
kernel/trace/trace.h | 11 +++++++++++
2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 1b9a791..fa740e5 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -443,16 +443,16 @@ void tracing_snapshot(void)
unsigned long flags;

if (!tr->allocated_snapshot) {
- trace_printk("*** SNAPSHOT NOT ALLOCATED ***\n");
- trace_printk("*** stopping trace here! ***\n");
+ internal_trace_puts("*** SNAPSHOT NOT ALLOCATED ***\n");
+ internal_trace_puts("*** stopping trace here! ***\n");
tracing_off();
return;
}

/* Note, snapshot can not be used when the tracer uses it */
if (tracer->use_max_tr) {
- trace_printk("*** LATENCY TRACER ACTIVE ***\n");
- trace_printk("*** Can not use snapshot (sorry) ***\n");
+ internal_trace_puts("*** LATENCY TRACER ACTIVE ***\n");
+ internal_trace_puts("*** Can not use snapshot (sorry) ***\n");
return;
}

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 98dd79d..c729843 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1034,6 +1034,17 @@ extern const char *__stop___trace_bprintk_fmt[];
void trace_printk_init_buffers(void);
void trace_printk_start_comm(void);

+/*
+ * Normal trace_printk() and friends allocates special buffers
+ * to do the manipulation, as well as saves the print formats
+ * into sections to display. But the trace infrastructure wants
+ * to use these without the added overhead at the price of being
+ * a bit slower (used mainly for warnings, where we don't care
+ * about performance). The internal_trace_puts() is for such
+ * a purpose.
+ */
+#define internal_trace_puts(str) __trace_puts(_THIS_IP_, str, strlen(str))
+
#undef FTRACE_ENTRY
#define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \
extern struct ftrace_event_call \
--
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/