Skip to content

Commit 4708abc

Browse files
committed
tracing: Use the ring-buffer nesting to allow synthetic events to be traced
Synthetic events can be done within the recording of other events. Notify the ring buffer via ring_buffer_nest_start() and ring_buffer_nest_end() that this is intended and not to block it due to its recursion protection. Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 8e01206 commit 4708abc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

kernel/trace/trace_events_hist.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ static notrace void trace_event_raw_event_synth(void *__data,
640640
struct trace_event_file *trace_file = __data;
641641
struct synth_trace_event *entry;
642642
struct trace_event_buffer fbuffer;
643+
struct ring_buffer *buffer;
643644
struct synth_event *event;
644645
unsigned int i, n_u64;
645646
int fields_size = 0;
@@ -651,10 +652,17 @@ static notrace void trace_event_raw_event_synth(void *__data,
651652

652653
fields_size = event->n_u64 * sizeof(u64);
653654

655+
/*
656+
* Avoid ring buffer recursion detection, as this event
657+
* is being performed within another event.
658+
*/
659+
buffer = trace_file->tr->trace_buffer.buffer;
660+
ring_buffer_nest_start(buffer);
661+
654662
entry = trace_event_buffer_reserve(&fbuffer, trace_file,
655663
sizeof(*entry) + fields_size);
656664
if (!entry)
657-
return;
665+
goto out;
658666

659667
for (i = 0, n_u64 = 0; i < event->n_fields; i++) {
660668
if (event->fields[i]->is_string) {
@@ -670,6 +678,8 @@ static notrace void trace_event_raw_event_synth(void *__data,
670678
}
671679

672680
trace_event_buffer_commit(&fbuffer);
681+
out:
682+
ring_buffer_nest_end(buffer);
673683
}
674684

675685
static void free_synth_event_print_fmt(struct trace_event_call *call)

0 commit comments

Comments
 (0)