linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ian Rogers <irogers@google.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-perf-users@vger.kernel.org, agordeev@linux.ibm.com,
	gor@linux.ibm.com, sumanthk@linux.ibm.com, hca@linux.ibm.com,
	Alexander Egorenkov <egorenar@linux.ibm.com>
Subject: Re: [PATCH] perf ftrace: Restore to original trace settings on exit
Date: Thu, 15 May 2025 11:18:13 -0700	[thread overview]
Message-ID: <aCYv5U5u238pH1uq@google.com> (raw)
In-Reply-To: <aCYSEMrXIwptT0d6@x1>

Hello,

On Thu, May 15, 2025 at 01:10:56PM -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, May 15, 2025 at 08:34:07AM +0200, Thomas Richter wrote:
> > Executing perf ftrace commands ftrace, profile and latency
> > leave tracing disabled as can seen in this output:
> > 
> >  # echo 1 > /sys/kernel/debug/tracing/tracing_on
> >  # cat /sys/kernel/debug/tracing/tracing_on
> >  1
> >  # perf ftrace trace --graph-opts depth=5 sleep 0.1 > /dev/null
> >  # cat /sys/kernel/debug/tracing/tracing_on
> >  0
> >  #
>  
> > The tracing_on file is not restored to its value before the command.
> > Fix this behavior and restore the trace setting to what
> > is was before the invocation of the command.
> > On Fedora 41 and 42 tracing is turned on by default.
> 
> This looks fragile as it takes a snapshot in time of what are the files
> in some particular directory to save them and then restore it at the
> end.
> 
> The tool may at some point in the future go and touch other (added in
> the future) files in that directory, etc.
> 
> I _think_ that instead we should move to use some "session mode" ftrace,
> which I _think_ is already available for quite some time, i.e. instead
> of touching the global ftrace files (which probably are there for
> historical reasons), we should use, lemme find the reference...
> 
> I think the keyword to lookup is /sys/kernel/debug/tracing/instances/
> 
> Ian did a lot of work on having 'perf test' run shell tests in parallel,
> so we need to think about ways of allowing for that by not touching
> global state.
> 
> tldr; great idea, avoid global state.

Right, by using an tracing instance, you don't need to worry about the
original states.

Thanks,
Namhyung


      reply	other threads:[~2025-05-15 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-15  6:34 [PATCH] perf ftrace: Restore to original trace settings on exit Thomas Richter
2025-05-15 16:10 ` Arnaldo Carvalho de Melo
2025-05-15 18:18   ` Namhyung Kim [this message]

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=aCYv5U5u238pH1uq@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=egorenar@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=tmricht@linux.ibm.com \
    /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).