linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Steven Rostedt <rostedt@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v4 1/3] tracing: Have tracer option be instance specific
Date: Mon, 17 Nov 2025 17:03:37 +0100	[thread overview]
Message-ID: <aRtHWXzYa8ijUIDa@black.igk.intel.com> (raw)
In-Reply-To: <20251111232429.305317942@kernel.org>

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@intel.com>

> +	tracer_flags = flags->val;
> +	trace_opts = flags->opts;

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-11-17 16:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 23:24 [PATCH v4 0/3] tracing: Fix tracer options per instance Steven Rostedt
2025-11-11 23:24 ` [PATCH v4 1/3] tracing: Have tracer option be instance specific Steven Rostedt
2025-11-17 16:03   ` Andy Shevchenko [this message]
2025-11-17 16:32     ` Steven Rostedt
2025-11-11 23:24 ` [PATCH v4 2/3] tracing: Have function tracer define options per instance Steven Rostedt
2025-11-11 23:24 ` [PATCH v4 3/3] tracing: Have function graph " Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aRtHWXzYa8ijUIDa@black.igk.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).