[PATCH 3/5] tracing/events: add rcu locking around trace event prints

From: Steven Rostedt
Date: Wed Apr 15 2009 - 22:20:23 EST


From: Steven Rostedt <srostedt@xxxxxxxxxx>

Some trace events need to have a way to print out data that his
allocated, but will be freed later. Using a function that can allocate
memory, and free it with call_rcu, can be useful.

This patch adds rcu locking around the print part of the TRACE_EVENT
macro to facilitate this.

Reported-by: Theodore Tso <tytso@xxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
include/trace/ftrace.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 60c5323..6fb06bd 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -62,7 +62,9 @@
*
* field = (typeof(field))entry;
*
+ * rcu_read_lock();
* ret = trace_seq_printf(s, <TP_printk> "\n");
+ * rcu_read_unlock();
* if (!ret)
* return TRACE_TYPE_PARTIAL_LINE;
*
@@ -99,7 +101,9 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
\
field = (typeof(field))entry; \
\
+ rcu_read_lock(); \
ret = trace_seq_printf(s, #call ": " print); \
+ rcu_read_unlock(); \
if (!ret) \
return TRACE_TYPE_PARTIAL_LINE; \
\
--
1.6.2.1

--
--
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/