[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aRtHWXzYa8ijUIDa@black.igk.intel.com>
Date: Mon, 17 Nov 2025 17:03:37 +0100
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Steven Rostedt <rostedt@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v4 1/3] tracing: Have tracer option be instance specific
On Tue, Nov 11, 2025 at 06:24:07PM -0500, Steven Rostedt wrote:
> Tracers can add specify options to modify them. This logic was added
> before instances were created and the tracer flags were global variables.
> After instances were created where a tracer may exist in more than one
> instance, the flags were not updated from being global into instance
> specific. This causes confusion with these options. For example, the
> function tracer has an option to enable function arguments:
>
> # cd /sys/kernel/tracing
> # mkdir instances/foo
> # echo function > instances/foo/current_tracer
> # echo 1 > options/func-args
> # echo function > current_tracer
> # cat trace
> [..]
> <idle>-0 [005] d..3. 1050.656187: rcu_needs_cpu() <-tick_nohz_next_event
> <idle>-0 [005] d..3. 1050.656188: get_next_timer_interrupt(basej=0x10002dbad, basem=0xf45fd7d300) <-tick_nohz_next_event
> <idle>-0 [005] d..3. 1050.656189: _raw_spin_lock(lock=0xffff8944bdf5de80) <-__get_next_timer_interrupt
> <idle>-0 [005] d..4. 1050.656190: do_raw_spin_lock(lock=0xffff8944bdf5de80) <-__get_next_timer_interrupt
> <idle>-0 [005] d..4. 1050.656191: _raw_spin_lock_nested(lock=0xffff8944bdf5f140, subclass=1) <-__get_next_timer_interrupt
> # cat instances/foo/options/func-args
> 1
> # cat instances/foo/trace
> [..]
> kworker/4:1-88 [004] ...1. 298.127735: next_zone <-refresh_cpu_vm_stats
> kworker/4:1-88 [004] ...1. 298.127736: first_online_pgdat <-refresh_cpu_vm_stats
> kworker/4:1-88 [004] ...1. 298.127738: next_online_pgdat <-refresh_cpu_vm_stats
> kworker/4:1-88 [004] ...1. 298.127739: fold_diff <-refresh_cpu_vm_stats
> kworker/4:1-88 [004] ...1. 298.127741: round_jiffies_relative <-vmstat_update
> [..]
>
> The above shows that setting "func-args" in the top level instance also
> set it in the instance "foo", but since the interface of the trace flags
> are per instance, the update didn't take affect in the "foo" instance.
>
> Update the infrastructure to allow tracers to add a "default_flags" field
> in the tracer structure that can be set instead of "flags" which will make
> the flags per instance. If a tracer needs to keep the flags global (like
> blktrace), keeping the "flags" field set will keep the old behavior.
>
> This does not update function or the function graph tracers. That will be
> handled later.
This broke clang build.
> {
> struct tracer_opt *trace_opts;
> struct trace_array *tr = m->private;
> + struct tracer_flags *flags;
> struct tracer *trace;
Now this is dangling variable. (Set but not used)
> u32 tracer_flags;
> int i;
> @@ -5152,12 +5180,14 @@ static int tracing_trace_options_show(struct seq_file *m, void *v)
> seq_printf(m, "no%s\n", trace_options[i]);
> }
>
> - trace = tr->current_trace;
> - if (!trace->flags || !trace->flags->opts)
> + flags = tr->current_trace_flags;
> + if (!flags || !flags->opts)
> return 0;
>
> - tracer_flags = tr->current_trace->flags->val;
> - trace_opts = tr->current_trace->flags->opts;
> + trace = tr->current_trace;
Removing it and this line fixes, but I'm not sure that's correct one, so feel
free to fold the change or if it will be a fix,
Reported-by: Andy Shevchenko <andriy.shevchenko@...el.com>
> + tracer_flags = flags->val;
> + trace_opts = flags->opts;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists