From: Namhyung Kim <namhyung@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
stable <stable@vger.kernel.org>
Subject: Re: [for-next][PATCH 7/8] fgraph: Handle a case where a tracer ignores set_graph_notrace
Date: Tue, 13 Dec 2016 02:09:04 +0900 [thread overview]
Message-ID: <20161212170903.GC4142@danjae.aot.lge.com> (raw)
In-Reply-To: <20161212114920.252e8b31@gandalf.local.home>
On Mon, Dec 12, 2016 at 11:49:20AM -0500, Steven Rostedt wrote:
> On Tue, 13 Dec 2016 01:30:01 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
>
>
> > Sorry to miss updating those tracers. I guess it's no more necessary once
> > the patch 8 is applied so that functions in the notrace filter will not be
> > recorded.
> >
> > Or maybe we need to change the prepare_ftrace_return() so that the
> > graph_entry callback should be called after ftrace_push_return_trace() as
> > some archs do.
>
> I plan on updating fgraph in general so this should all be handled then.
ok
>
> >
> > >
> > > Have the print functions handle cases where a tracer still records functions
> > > even when they are in set_graph_notrace.
> >
> > I think it'd be better (or consistent, at least) not printing negative index
> > records rather than showing entry only.
>
> I thought about this too, but I'm more concerned about it not crashing
> the kernel than to show a proper trace. The fix will just make sure it
> doesn't crash.
ok
>
> >
> > >
> > > Also add warnings if the depth is below zero before accessing the array.
> > >
> > > Note, the function graph logic will still prevent the return of these
> > > functions from being recorded, which means that they will be left hanging
> > > without a return. For example:
> > >
> > > # echo '*spin*' > set_graph_notrace
> > > # echo 1 > options/display-graph
> > > # echo wakeup > current_tracer
> > > # cat trace
> > > [...]
> > > _raw_spin_lock() {
> > > preempt_count_add() {
> > > do_raw_spin_lock() {
> > > update_rq_clock();
> > >
> > > Where it should look like:
> > >
> > > _raw_spin_lock() {
> > > preempt_count_add();
> > > do_raw_spin_lock();
> > > }
> > > update_rq_clock();
> >
> > If set_graph_notrace works correctly, it should be just:
> >
> > update_rq_clock();
>
> Which is what it should look like after patch 8. But I didn't mark 8 as
> stable as that's more of a feature. As wakeup and irqsoff doesn't use
> notrace yet. Yeah, notrace may break it a bit, but since this is the
> first someone noticed it, I don't think it's used much.
>
> I wanted the simplest fix for stable.
I think a simpler fix is just to return when it sees a negative record..
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 52fb1e21b86b..2fb73c2e35b5 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -844,7 +844,7 @@ print_graph_entry_leaf(struct trace_iterator *iter,
/* If a graph tracer ignored set_graph_notrace */
if (call->depth < -1)
- call->depth += FTRACE_NOTRACE_DEPTH;
+ return TRACE_TYPE_HANDLED;
/*
* Comments display at + 1 to depth. Since
@@ -887,7 +887,7 @@ print_graph_entry_nested(struct trace_iterator *iter,
/* If a graph tracer ignored set_graph_notrace */
if (call->depth < -1)
- call->depth += FTRACE_NOTRACE_DEPTH;
+ return TRACE_TYPE_HANDLED;
cpu_data = per_cpu_ptr(data->cpu_data, cpu);
cpu_data->depth = call->depth;
Thanks,
Namhyung
next prev parent reply other threads:[~2016-12-12 17:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-09 14:26 [for-next][PATCH 0/8] tracing: Last minute updates for 4.10 Steven Rostedt
2016-12-09 14:26 ` [for-next][PATCH 1/8] tracing: Have the reg function allow to fail Steven Rostedt
2016-12-09 14:26 ` [for-next][PATCH 2/8] tracing: Do not start benchmark on boot up Steven Rostedt
2016-12-09 14:26 ` [for-next][PATCH 3/8] tracing: Have system enable return error if one of the events fail Steven Rostedt
2016-12-09 14:27 ` [for-next][PATCH 4/8] tracing: Allow benchmark to be enabled at early_initcall() Steven Rostedt
2016-12-09 14:27 ` [for-next][PATCH 5/8] ftrace/x86_32: Set ftrace_stub to weak to prevent gcc from using short jumps to it Steven Rostedt
2016-12-09 14:27 ` [for-next][PATCH 6/8] tracing: Replace kmap with copy_from_user() in trace_marker writing Steven Rostedt
2016-12-09 14:27 ` [for-next][PATCH 7/8] fgraph: Handle a case where a tracer ignores set_graph_notrace Steven Rostedt
[not found] ` <CADWwUUbhD0ZQbg6zN-A7A+f+jToadTx63UMQESoM04B75S+hvg@mail.gmail.com>
[not found] ` <CADWwUUarxm+ACf1WqDo1B+RFCDMtGXzFYK45kbTbRm6s+QGyUA@mail.gmail.com>
2016-12-12 16:30 ` Fwd: " Namhyung Kim
2016-12-12 16:49 ` Steven Rostedt
2016-12-12 17:09 ` Namhyung Kim [this message]
2016-12-12 18:07 ` Steven Rostedt
2016-12-09 14:27 ` [for-next][PATCH 8/8] tracing/fgraph: Have wakeup and irqsoff tracers ignore graph functions too Steven Rostedt
2016-12-12 16:40 ` Namhyung Kim
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=20161212170903.GC4142@danjae.aot.lge.com \
--to=namhyung@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.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
Powered by JetHome