aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-08-02 10:32:10 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:34:42 -0400
commitccb469a198cffac94a7eea0b69f715f06e2ddf15 (patch)
treea4de18987f64f115373a22379eef17d6d30ce9b8
parent2b6080f28c7cc3efc8625ab71495aae89aeb63a0 (diff)
tracing: Pass the ftrace_file to the buffer lock reserve code
Pass the struct ftrace_event_file *ftrace_file to the trace_event_buffer_lock_reserve() (new function that replaces the trace_current_buffer_lock_reserver()). The ftrace_file holds a pointer to the trace_array that is in use. In the case of multiple buffers with different trace_arrays, this allows different events to be recorded into different buffers. Also fixed some of the stale comments in include/trace/ftrace.h Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--include/linux/ftrace_event.h7
-rw-r--r--include/trace/ftrace.h9
-rw-r--r--kernel/trace/trace.c12
3 files changed, 24 insertions, 4 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c7191d482f98..fd28c170c597 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -128,6 +128,13 @@ enum print_line_t {
128void tracing_generic_entry_update(struct trace_entry *entry, 128void tracing_generic_entry_update(struct trace_entry *entry,
129 unsigned long flags, 129 unsigned long flags,
130 int pc); 130 int pc);
131struct ftrace_event_file;
132
133struct ring_buffer_event *
134trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer,
135 struct ftrace_event_file *ftrace_file,
136 int type, unsigned long len,
137 unsigned long flags, int pc);
131struct ring_buffer_event * 138struct ring_buffer_event *
132trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer, 139trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
133 int type, unsigned long len, 140 int type, unsigned long len,
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 191d9661e277..e5d140a91fd7 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -414,7 +414,8 @@ static inline notrace int ftrace_get_offsets_##call( \
414 * 414 *
415 * static void ftrace_raw_event_<call>(void *__data, proto) 415 * static void ftrace_raw_event_<call>(void *__data, proto)
416 * { 416 * {
417 * struct ftrace_event_call *event_call = __data; 417 * struct ftrace_event_file *ftrace_file = __data;
418 * struct ftrace_event_call *event_call = ftrace_file->event_call;
418 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; 419 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
419 * struct ring_buffer_event *event; 420 * struct ring_buffer_event *event;
420 * struct ftrace_raw_<call> *entry; <-- defined in stage 1 421 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
@@ -428,7 +429,7 @@ static inline notrace int ftrace_get_offsets_##call( \
428 * 429 *
429 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); 430 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
430 * 431 *
431 * event = trace_current_buffer_lock_reserve(&buffer, 432 * event = trace_event_buffer_lock_reserve(&buffer, ftrace_file,
432 * event_<call>->event.type, 433 * event_<call>->event.type,
433 * sizeof(*entry) + __data_size, 434 * sizeof(*entry) + __data_size,
434 * irq_flags, pc); 435 * irq_flags, pc);
@@ -440,7 +441,7 @@ static inline notrace int ftrace_get_offsets_##call( \
440 * __array macros. 441 * __array macros.
441 * 442 *
442 * if (!filter_current_check_discard(buffer, event_call, entry, event)) 443 * if (!filter_current_check_discard(buffer, event_call, entry, event))
443 * trace_current_buffer_unlock_commit(buffer, 444 * trace_nowake_buffer_unlock_commit(buffer,
444 * event, irq_flags, pc); 445 * event, irq_flags, pc);
445 * } 446 * }
446 * 447 *
@@ -533,7 +534,7 @@ ftrace_raw_event_##call(void *__data, proto) \
533 \ 534 \
534 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 535 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
535 \ 536 \
536 event = trace_current_buffer_lock_reserve(&buffer, \ 537 event = trace_event_buffer_lock_reserve(&buffer, ftrace_file, \
537 event_call->event.type, \ 538 event_call->event.type, \
538 sizeof(*entry) + __data_size, \ 539 sizeof(*entry) + __data_size, \
539 irq_flags, pc); \ 540 irq_flags, pc); \
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 91fe40905828..29bff72f97ef 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1294,6 +1294,18 @@ void trace_buffer_unlock_commit(struct ring_buffer *buffer,
1294EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit); 1294EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit);
1295 1295
1296struct ring_buffer_event * 1296struct ring_buffer_event *
1297trace_event_buffer_lock_reserve(struct ring_buffer **current_rb,
1298 struct ftrace_event_file *ftrace_file,
1299 int type, unsigned long len,
1300 unsigned long flags, int pc)
1301{
1302 *current_rb = ftrace_file->tr->buffer;
1303 return trace_buffer_lock_reserve(*current_rb,
1304 type, len, flags, pc);
1305}
1306EXPORT_SYMBOL_GPL(trace_event_buffer_lock_reserve);
1307
1308struct ring_buffer_event *
1297trace_current_buffer_lock_reserve(struct ring_buffer **current_rb, 1309trace_current_buffer_lock_reserve(struct ring_buffer **current_rb,
1298 int type, unsigned long len, 1310 int type, unsigned long len,
1299 unsigned long flags, int pc) 1311 unsigned long flags, int pc)