kernel/trace/trace.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
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.
Fixes: 428add559b69 ("tracing: Have tracer option be instance specific")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
Change in v2:
- Fix update_tracer_options() to update all instances.
- Update tracer_options_updated after update all instances.
---
kernel/trace/trace.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8ae95800592d..4a6784057855 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -10231,11 +10231,16 @@ static __init int __update_tracer_options(struct trace_array *tr)
return ret;
}
-static __init void update_tracer_options(struct trace_array *tr)
+static __init void update_tracer_options(void)
{
+ struct trace_array *tr;
+
guard(mutex)(&trace_types_lock);
+
+ list_for_each_entry(tr, &ftrace_trace_arrays, list)
+ __update_tracer_options(tr);
+
tracer_options_updated = true;
- __update_tracer_options(tr);
}
/* Must have trace_types_lock held */
@@ -10937,7 +10942,7 @@ static __init void tracer_init_tracefs_work_func(struct work_struct *work)
create_trace_instances(NULL);
- update_tracer_options(&global_trace);
+ update_tracer_options();
}
static __init int tracer_init_tracefs(void)
On Wed, 19 Nov 2025 09:21:34 +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.
>
Wait, this seems not updating the global instance. Let me fix it.
(ftracetest found it.)
Thanks,
> Fixes: 428add559b69 ("tracing: Have tracer option be instance specific")
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---
> Change in v2:
> - Fix update_tracer_options() to update all instances.
> - Update tracer_options_updated after update all instances.
> ---
> kernel/trace/trace.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 8ae95800592d..4a6784057855 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -10231,11 +10231,16 @@ static __init int __update_tracer_options(struct trace_array *tr)
> return ret;
> }
>
> -static __init void update_tracer_options(struct trace_array *tr)
> +static __init void update_tracer_options(void)
> {
> + struct trace_array *tr;
> +
> guard(mutex)(&trace_types_lock);
> +
> + list_for_each_entry(tr, &ftrace_trace_arrays, list)
> + __update_tracer_options(tr);
> +
> tracer_options_updated = true;
> - __update_tracer_options(tr);
> }
>
> /* Must have trace_types_lock held */
> @@ -10937,7 +10942,7 @@ static __init void tracer_init_tracefs_work_func(struct work_struct *work)
>
> create_trace_instances(NULL);
>
> - update_tracer_options(&global_trace);
> + update_tracer_options();
> }
>
> static __init int tracer_init_tracefs(void)
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
On Wed, 19 Nov 2025 13:39:42 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 8ae95800592d..4a6784057855 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -10231,11 +10231,16 @@ static __init int __update_tracer_options(struct trace_array *tr)
> > return ret;
> > }
> >
> > -static __init void update_tracer_options(struct trace_array *tr)
> > +static __init void update_tracer_options(void)
> > {
> > + struct trace_array *tr;
> > +
> > guard(mutex)(&trace_types_lock);
> > +
> > + list_for_each_entry(tr, &ftrace_trace_arrays, list)
> > + __update_tracer_options(tr);
> > +
> > tracer_options_updated = true;
Oops, I misunderstood this flag. This should be set *before* calling
__update_tracer_options(). Not updated.
Thanks,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
© 2016 - 2025 Red Hat, Inc.