Skip to contentSkip to conversation

tracing: Dump stacktrace trigger to the corresponding instance

PATCH In review Daniel Bristot de Oliveira 2 participants 3 messages Feb 20, 2022 – Feb 24, 2022 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Dump stacktrace trigger to the corresponding instance

The stacktrace event trigger is dumping the stacktrace to the instance where it was enabled, but to the global "instance."

Use the private_data, pointing to the trigger file, to figure out the corresponding trace instance, and use it in the trigger action, like snapshot_trigger does.

Cc Steven Rostedt <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Tom Zanussi <[email protected]>
---
 kernel/trace/trace_events_trigger.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/trace/trace_events_trigger.c +6 -1
index d00fee705f9c..e0d50c9577f3 100644
@@ -1540,7 +1540,12 @@ stacktrace_trigger(struct event_trigger_data *data,
 		   struct trace_buffer *buffer,  void *rec,
 		   struct ring_buffer_event *event)
 {
-	trace_dump_stack(STACK_SKIP);
+	struct trace_event_file *file = data->private_data;
+
+	if (file)
+		__trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP);
+	else
+		trace_dump_stack(STACK_SKIP);
 }
 
 static void
Signature · 1 line
2.34.1
#1 lore raw
Quoted 2 lines · Daniel Bristot de Oliveira

The stacktrace event trigger is dumping the stacktrace to the instance where it was enabled, but to the global "instance."

Oops,

The stacktrace event trigger is *NOT* dumping...

-- Daniel

Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Daniel Bristot de Oliveira

Hi Daniel,

Quoted 35 lines · Daniel Bristot de Oliveira

The stacktrace event trigger is dumping the stacktrace to the instance
where it was enabled, but to the global "instance."

Use the private_data, pointing to the trigger file, to figure out the corresponding trace instance, and use it in the trigger action, like snapshot_trigger does.

Cc Steven Rostedt <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Tom Zanussi <[email protected]>
---
 kernel/trace/trace_events_trigger.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/trace/trace_events_trigger.c +6 -1
index d00fee705f9c..e0d50c9577f3 100644
@@ -1540,7 +1540,12 @@ stacktrace_trigger(struct event_trigger_data
 *data,
 		   struct trace_buffer *buffer,  void *rec,
 		   struct ring_buffer_event *event)
 {
-	trace_dump_stack(STACK_SKIP);
+	struct trace_event_file *file = data->private_data;
+
+	if (file)
+		__trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP);
+	else
+		trace_dump_stack(STACK_SKIP);
 }
 
Quoted 1 line

static void

Looks good to me.

Thanks,

Tom