Skip to content

Commit

Permalink
tracing: Dump stacktrace trigger to the corresponding instance
Browse files Browse the repository at this point in the history
commit ce33c84 upstream.

The stacktrace event trigger is not 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.

Link: https://lkml.kernel.org/r/afbb0b4f18ba92c276865bc97204d438473f4ebc.1645396236.git.bristot@kernel.org

Cc: stable@vger.kernel.org
Fixes: ae63b31 ("tracing: Separate out trace events from global variables")
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Tested-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Daniel Bristot de Oliveira authored and gregkh committed Apr 27, 2022
1 parent 69848f9 commit 5e8446e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kernel/trace/trace_events_trigger.c
Expand Up @@ -1219,7 +1219,14 @@ static void
stacktrace_trigger(struct event_trigger_data *data, void *rec,
struct ring_buffer_event *event)
{
trace_dump_stack(STACK_SKIP);
struct trace_event_file *file = data->private_data;
unsigned long flags;

if (file) {
local_save_flags(flags);
__trace_stack(file->tr, flags, STACK_SKIP, preempt_count());
} else
trace_dump_stack(STACK_SKIP);
}

static void
Expand Down

0 comments on commit 5e8446e

Please sign in to comment.