From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org,
jolsa@kernel.org, "Paul E . McKenney" <paulmck@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] ftrace: make extra rcu_is_watching() validation check optional
Date: Wed, 3 Apr 2024 09:40:48 +0900 [thread overview]
Message-ID: <20240403094048.3a443fbeeed551f11c1970d8@kernel.org> (raw)
In-Reply-To: <20240401224733.7a9bcbb6@gandalf.local.home>
On Mon, 1 Apr 2024 22:47:33 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Mon, 1 Apr 2024 19:29:46 -0700
> Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
>
> > On Mon, Apr 1, 2024 at 5:38 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > >
> > > On Mon, 1 Apr 2024 12:09:18 -0400
> > > Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > > On Mon, 1 Apr 2024 20:25:52 +0900
> > > > Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> > > >
> > > > > > Masami,
> > > > > >
> > > > > > Are you OK with just keeping it set to N.
> > > > >
> > > > > OK, if it is only for the debugging, I'm OK to set N this.
> > > > >
> > > > > >
> > > > > > We could have other options like PROVE_LOCKING enable it.
> > > > >
> > > > > Agreed (but it should say this is a debug option)
> > > >
> > > > It does say "Validate" which to me is a debug option. What would you
> > > > suggest?
> > >
> > > I think the help message should have "This is for debugging ftrace."
> > >
> >
> > Sent v2 with adjusted wording, thanks!
>
> You may want to wait till Masami and I agree ;-)
>
> Masami,
>
> But it isn't really for "debugging", it's for validating. That is, it
> doesn't give us any information to debug ftrace. It only validates if it is
> executed properly. In other words, I never want to be asked "How can I use
> this option to debug ftrace?"
>
> For example, we also have:
>
> "Verify ring buffer time stamp deltas"
>
> that makes sure the time stamps of the ring buffer are not buggy.
>
> And there's:
>
> "Verify compile time sorting of ftrace functions"
>
> Which is also used to make sure things are working properly.
>
> Neither of the above says they are for "debugging", even though they are
> more useful for debugging than this option.
>
> I'm not sure saying this is "debugging ftrace" is accurate. It may help
> debug ftrace if it is called outside of an RCU location, which has a
> 1 in 100,000,000,000 chance of causing an actual bug, as the race window is
> extremely small.
>
> Now if it is also called outside of instrumentation, that will likely trigger
> other warnings even without this code, and this will not be needed to debug
> that.
>
> ftrace has all sorts of "verifiers" that is used to make sure things are
> working properly. And yes, you can consider it as "debugging". But I would
> not consider this an option to enable if ftrace was broken, and you are
> looking into why it is broken.
>
> To me, this option is only to verify that ftrace (and other users of
> ftrace_test_recursion_trylock()) are not called outside of RCU, as if they
> are, it can cause a race. But it also has a noticeable overhead when enabled.
OK, for me, this last sentence is preferred for the help message. That explains
what this is for.
All callbacks that attach to the function tracing have some sort
of protection against recursion. This option is only to verify that
ftrace (and other users of ftrace_test_recursion_trylock()) are not
called outside of RCU, as if they are, it can cause a race.
But it also has a noticeable overhead when enabled.
BTW, how much overhead does this introduce? and the race case a kernel crash?
or just messed up the ftrace buffer?
Thank you,
>
> -- Steve
>
>
> -- Steve
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-04-03 0:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-22 16:03 [PATCH] ftrace: make extra rcu_is_watching() validation check optional Andrii Nakryiko
2024-03-25 2:38 ` Masami Hiramatsu
2024-03-25 16:56 ` Andrii Nakryiko
2024-03-25 22:13 ` Steven Rostedt
2024-03-26 16:16 ` Andrii Nakryiko
2024-03-26 19:01 ` Steven Rostedt
2024-03-29 16:39 ` Andrii Nakryiko
2024-04-01 11:25 ` Masami Hiramatsu
2024-04-01 16:09 ` Steven Rostedt
2024-04-02 0:38 ` Masami Hiramatsu
2024-04-02 2:29 ` Andrii Nakryiko
2024-04-02 2:47 ` Steven Rostedt
2024-04-03 0:40 ` Masami Hiramatsu [this message]
2024-04-03 0:54 ` Steven Rostedt
2024-04-03 4:00 ` Andrii Nakryiko
2024-04-03 5:21 ` Andrii Nakryiko
2024-04-03 13:55 ` Steven Rostedt
2024-04-06 3:41 ` Masami Hiramatsu
2024-04-06 16:06 ` Andrii Nakryiko
2024-04-03 13:53 ` 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=20240403094048.3a443fbeeed551f11c1970d8@kernel.org \
--to=mhiramat@kernel.org \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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).