linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Show the tracer options in boot-time created instance
@ 2025-11-18  7:49 Masami Hiramatsu (Google)
  2025-11-18 18:34 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu (Google) @ 2025-11-18  7:49 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	linux-kernel, linux-trace-kernel

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Since tracer_init_tracefs_work_func() only updates the tracer options
for the global_trace, the instances created by the kernel cmdline
do not have those options.

Fix to update tracer options for those boot-time created instances
to show those options.

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Fixes: f20a580627f43 ("ftrace: Allow instances to use function tracing")
---
 kernel/trace/trace.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8ae95800592d..2e87060e1d5a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -10903,6 +10903,7 @@ static struct notifier_block trace_module_nb = {
 
 static __init void tracer_init_tracefs_work_func(struct work_struct *work)
 {
+	struct trace_array *tr;
 
 	event_trace_init();
 
@@ -10937,7 +10938,8 @@ static __init void tracer_init_tracefs_work_func(struct work_struct *work)
 
 	create_trace_instances(NULL);
 
-	update_tracer_options(&global_trace);
+	list_for_each_entry(tr, &ftrace_trace_arrays, list)
+		update_tracer_options(tr);
 }
 
 static __init int tracer_init_tracefs(void)


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

* Re: [PATCH] tracing: Show the tracer options in boot-time created instance
  2025-11-18  7:49 [PATCH] tracing: Show the tracer options in boot-time created instance Masami Hiramatsu (Google)
@ 2025-11-18 18:34 ` Steven Rostedt
  2025-11-19  0:06   ` Masami Hiramatsu
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2025-11-18 18:34 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: Mark Rutland, Mathieu Desnoyers, Andrew Morton, linux-kernel,
	linux-trace-kernel

On Tue, 18 Nov 2025 16:49:50 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Since tracer_init_tracefs_work_func() only updates the tracer options
> for the global_trace, the instances created by the kernel cmdline
> do not have those options.
> 
> Fix to update tracer options for those boot-time created instances
> to show those options.
> 
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> Fixes: f20a580627f43 ("ftrace: Allow instances to use function tracing")

Actually, I think this should be:

Fixes: 428add559b69 ("tracing: Have tracer option be instance specific")

As it broke when we made function tracer options no longer global.

> ---
>  kernel/trace/trace.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 8ae95800592d..2e87060e1d5a 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -10903,6 +10903,7 @@ static struct notifier_block trace_module_nb = {
>  
>  static __init void tracer_init_tracefs_work_func(struct work_struct *work)
>  {
> +	struct trace_array *tr;
>  
>  	event_trace_init();
>  
> @@ -10937,7 +10938,8 @@ static __init void tracer_init_tracefs_work_func(struct work_struct *work)
>  
>  	create_trace_instances(NULL);
>  
> -	update_tracer_options(&global_trace);
> +	list_for_each_entry(tr, &ftrace_trace_arrays, list)
> +		update_tracer_options(tr);
>  }
>  
>  static __init int tracer_init_tracefs(void)

Since update_trace_options() is only called by this function, instead of
doing the loop here, change the function to be:

static __init void update_tracer_options(void)
{
	struct trace_array *tr;

	guard(mutex)(&trace_types_lock);
	tracer_options_updated = true;
	list_for_each_entry(tr, &ftrace_trace_arrays, list)
		__update_tracer_options(tr);
}

Thanks,

-- Steve

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

* Re: [PATCH] tracing: Show the tracer options in boot-time created instance
  2025-11-18 18:34 ` Steven Rostedt
@ 2025-11-19  0:06   ` Masami Hiramatsu
  0 siblings, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2025-11-19  0:06 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Mark Rutland, Mathieu Desnoyers, Andrew Morton, linux-kernel,
	linux-trace-kernel

On Tue, 18 Nov 2025 13:34:34 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 18 Nov 2025 16:49:50 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > 
> > Since tracer_init_tracefs_work_func() only updates the tracer options
> > for the global_trace, the instances created by the kernel cmdline
> > do not have those options.
> > 
> > Fix to update tracer options for those boot-time created instances
> > to show those options.
> > 
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > Fixes: f20a580627f43 ("ftrace: Allow instances to use function tracing")
> 
> Actually, I think this should be:
> 
> Fixes: 428add559b69 ("tracing: Have tracer option be instance specific")
> 
> As it broke when we made function tracer options no longer global.
> 

OK, let me change it.

> > ---
> >  kernel/trace/trace.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 8ae95800592d..2e87060e1d5a 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -10903,6 +10903,7 @@ static struct notifier_block trace_module_nb = {
> >  
> >  static __init void tracer_init_tracefs_work_func(struct work_struct *work)
> >  {
> > +	struct trace_array *tr;
> >  
> >  	event_trace_init();
> >  
> > @@ -10937,7 +10938,8 @@ static __init void tracer_init_tracefs_work_func(struct work_struct *work)
> >  
> >  	create_trace_instances(NULL);
> >  
> > -	update_tracer_options(&global_trace);
> > +	list_for_each_entry(tr, &ftrace_trace_arrays, list)
> > +		update_tracer_options(tr);
> >  }
> >  
> >  static __init int tracer_init_tracefs(void)
> 
> Since update_trace_options() is only called by this function, instead of
> doing the loop here, change the function to be:
> 
> static __init void update_tracer_options(void)
> {
> 	struct trace_array *tr;
> 
> 	guard(mutex)(&trace_types_lock);
> 	tracer_options_updated = true;
> 	list_for_each_entry(tr, &ftrace_trace_arrays, list)
> 		__update_tracer_options(tr);
> }

OK. Let me send v2.

Thanks,

> 
> Thanks,
> 
> -- Steve
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

end of thread, other threads:[~2025-11-19  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-18  7:49 [PATCH] tracing: Show the tracer options in boot-time created instance Masami Hiramatsu (Google)
2025-11-18 18:34 ` Steven Rostedt
2025-11-19  0:06   ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).