From: Steven Rostedt <rostedt@goodmis.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 3/4] tracing: Add stack_tracer_disable/enable() functions
Date: Thu, 6 Apr 2017 14:48:03 -0400 [thread overview]
Message-ID: <20170406144803.63ee287c@gandalf.local.home> (raw)
In-Reply-To: <20170406181222.GH1600@linux.vnet.ibm.com>
On Thu, 6 Apr 2017 11:12:22 -0700
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
> On Thu, Apr 06, 2017 at 12:42:40PM -0400, Steven Rostedt wrote:
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> >
> > There are certain parts of the kernel that can not let stack tracing
> > proceed (namely in RCU), because the stack tracer uses RCU, and parts of RCU
> > internals can not handle having RCU read side locks taken.
> >
> > Add stack_tracer_disable() and stack_tracer_enable() functions to let RCU
> > stop stack tracing on the current CPU as it is in those critical sections.
>
> s/as it is in/when it is in/?
>
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>
> One quibble above, one objection below.
>
> Thanx, Paul
>
> > ---
> > include/linux/ftrace.h | 6 ++++++
> > kernel/trace/trace_stack.c | 28 ++++++++++++++++++++++++++++
> > 2 files changed, 34 insertions(+)
> >
> > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> > index ef7123219f14..40afee35565a 100644
> > --- a/include/linux/ftrace.h
> > +++ b/include/linux/ftrace.h
> > @@ -286,6 +286,12 @@ int
> > stack_trace_sysctl(struct ctl_table *table, int write,
> > void __user *buffer, size_t *lenp,
> > loff_t *ppos);
> > +
> > +void stack_tracer_disable(void);
> > +void stack_tracer_enable(void);
> > +#else
> > +static inline void stack_tracer_disable(void) { }
> > +static inline void stack_tracer_enabe(void) { }
> > #endif
> >
> > struct ftrace_func_command {
> > diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> > index 05ad2b86461e..5adbb73ec2ec 100644
> > --- a/kernel/trace/trace_stack.c
> > +++ b/kernel/trace/trace_stack.c
> > @@ -41,6 +41,34 @@ static DEFINE_MUTEX(stack_sysctl_mutex);
> > int stack_tracer_enabled;
> > static int last_stack_tracer_enabled;
> >
> > +/**
> > + * stack_tracer_disable - temporarily disable the stack tracer
> > + *
> > + * There's a few locations (namely in RCU) where stack tracing
> > + * can not be executed. This function is used to disable stack
> > + * tracing during those critical sections.
> > + *
> > + * This function will disable preemption. stack_tracer_enable()
> > + * must be called shortly after this is called.
> > + */
> > +void stack_tracer_disable(void)
> > +{
> > + preempt_disable_notrace();
>
> Interrupts are disabled in all current call points, so you don't really
> need to disable preemption. I would normally not worry, given the
> ease-of-use improvements, but some people get annoyed about even slight
> increases in idle-entry overhead.
My worry is that we add another caller that doesn't disable interrupts
or preemption.
I could add a __stack_trace_disable() that skips the disabling of
preemption, as the "__" usually denotes the call is "special".
-- Steve
>
> > + this_cpu_inc(trace_active);
> > +}
> > +
> > +/**
> > + * stack_tracer_enable - re-enable the stack tracer
> > + *
> > + * After stack_tracer_disable() is called, stack_tracer_enable()
> > + * must shortly be called afterward.
> > + */
> > +void stack_tracer_enable(void)
> > +{
> > + this_cpu_dec(trace_active);
> > + preempt_enable_notrace();
>
> Ditto...
>
> > +}
> > +
> > void stack_trace_print(void)
> > {
> > long i;
> > --
> > 2.10.2
> >
> >
next prev parent reply other threads:[~2017-04-06 18:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 16:42 [PATCH 0/4] tracing: Add usecase of synchronize_rcu_tasks() and stack_tracer_disable() Steven Rostedt
2017-04-06 16:42 ` [PATCH 1/4] ftrace: Add use of synchronize_rcu_tasks() with dynamic trampolines Steven Rostedt
2017-04-06 18:05 ` Paul E. McKenney
2017-04-06 18:13 ` Steven Rostedt
2017-04-06 20:20 ` Paul E. McKenney
2017-04-06 16:42 ` [PATCH 2/4] tracing: Replace the per_cpu() with this_cpu() in trace_stack.c Steven Rostedt
2017-04-06 16:42 ` [PATCH 3/4] tracing: Add stack_tracer_disable/enable() functions Steven Rostedt
2017-04-06 18:12 ` Paul E. McKenney
2017-04-06 18:48 ` Steven Rostedt [this message]
2017-04-06 20:21 ` Paul E. McKenney
2017-04-06 21:23 ` Steven Rostedt
2017-04-06 22:08 ` Paul E. McKenney
2017-04-06 23:57 ` Steven Rostedt
2017-04-06 16:42 ` [PATCH 4/4] rcu: Fix dyntick-idle tracing Steven Rostedt
2017-04-06 18:01 ` Paul E. McKenney
2017-04-07 4:50 ` kbuild test robot
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=20170406144803.63ee287c@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.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