mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing: Dump stacktrace trigger to the corresponding instance
@ 2022-02-20 22:49 Daniel Bristot de Oliveira
  2022-02-20 23:45 ` Daniel Bristot de Oliveira
  2022-02-24 15:41 ` Tom Zanussi
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-02-20 22:49 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Daniel Bristot de Oliveira, linux-kernel, Ingo Molnar, Tom Zanussi

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 <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 kernel/trace/trace_events_trigger.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index d00fee705f9c..e0d50c9577f3 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: Dump stacktrace trigger to the corresponding instance
  2022-02-20 22:49 [PATCH] tracing: Dump stacktrace trigger to the corresponding instance Daniel Bristot de Oliveira
@ 2022-02-20 23:45 ` Daniel Bristot de Oliveira
  2022-02-24 15:41 ` Tom Zanussi
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-02-20 23:45 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Ingo Molnar, Tom Zanussi

On 2/20/22 23:49, Daniel Bristot de Oliveira wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: Dump stacktrace trigger to the corresponding instance
  2022-02-20 22:49 [PATCH] tracing: Dump stacktrace trigger to the corresponding instance Daniel Bristot de Oliveira
  2022-02-20 23:45 ` Daniel Bristot de Oliveira
@ 2022-02-24 15:41 ` Tom Zanussi
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Zanussi @ 2022-02-24 15:41 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira, Steven Rostedt; +Cc: linux-kernel, Ingo Molnar

Hi Daniel,

On Sun, 2022-02-20 at 23:49 +0100, Daniel Bristot de Oliveira wrote:
> 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 <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Tom Zanussi <zanussi@kernel.org>
> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
> ---
>  kernel/trace/trace_events_trigger.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_events_trigger.c
> b/kernel/trace/trace_events_trigger.c
> index d00fee705f9c..e0d50c9577f3 100644
> --- a/kernel/trace/trace_events_trigger.c
> +++ b/kernel/trace/trace_events_trigger.c
> @@ -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


Looks good to me.

Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Tested-by: Tom Zanussi <zanussi@kernel.org>

Thanks,

Tom





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-24 15:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-20 22:49 [PATCH] tracing: Dump stacktrace trigger to the corresponding instance Daniel Bristot de Oliveira
2022-02-20 23:45 ` Daniel Bristot de Oliveira
2022-02-24 15:41 ` Tom Zanussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®