From: Daniel Bristot de Oliveira Date: Sun, 20 Feb 2022 22:49:57 +0000 (+0100) Subject: tracing: Dump stacktrace trigger to the corresponding instance X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b45bda0c859053132fc4e9ad3650ab567c3f59a1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git tracing: Dump stacktrace trigger to the corresponding instance commit ce33c845b030c9cf768370c951bc699470b09fa7 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: ae63b31e4d0e2 ("tracing: Separate out trace events from global variables") Reviewed-by: Tom Zanussi Tested-by: Tom Zanussi Signed-off-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c index 33c66fac1a31..40c1a2dd48f0 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -1196,7 +1196,14 @@ static __init int register_trigger_snapshot_cmd(void) { return 0; } static void stacktrace_trigger(struct event_trigger_data *data, void *rec) { - 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