public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@kernel.org,
	"Luis Claudio R. Goncalves" <lclaudio@uudg.org>,
	Oleg Nesterov <oleg@tv-sign.ru>
Subject: Re: [PATCH 2/3] function-graph: enable the stack after initialization of other variables
Date: Wed, 3 Jun 2009 08:35:08 -0700	[thread overview]
Message-ID: <20090603153508.GC6640@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0906021528210.14994@gandalf.stny.rr.com>

On Tue, Jun 02, 2009 at 03:30:14PM -0400, Steven Rostedt wrote:
> 
> On Tue, 2 Jun 2009, Frederic Weisbecker wrote:
> > > diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> > > index d28687e..baeb5fe 100644
> > > --- a/kernel/trace/trace_functions_graph.c
> > > +++ b/kernel/trace/trace_functions_graph.c
> > > @@ -65,6 +65,12 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth)
> > >  	if (!current->ret_stack)
> > >  		return -EBUSY;
> > >  
> > > +	/*
> > > +	 * We must make sure the ret_stack is tested before we read
> > > +	 * anything else.
> > > +	 */
> > > +	smp_rmb();
> > 
> > 
> > Isn't this part a too much costly for very traced function?
> 
> I was thinking that, but otherwise we still have the problem. It is a read 
> barrier which I don't think is as costly as a write or full barrier. But 
> because we have the if statement, perhaps a "read_barrier_depends" can do?

Although this would work on some CPU architectures (x86, s390, Power,
and perhaps a few others), it would break on those weakly ordered systems
that do not respect control dependencies.

One approach would be to use another level of indirection.  If this new
pointer is NULL, you return EBUSY.  Make this new pointer reference
the updated fields (tracing_graph_pause, trace_overrun, and so on).
This could point into the same data structure -- it is not necessary to
actually allocate a new chunk of memory.

Then you can use the existing rcu_assign_pointer() and rcu_dereference()
primitives.

Does this approach help at all?

							Thanx, Paul

> [ added Paul McKenney because he's good with barriers ]
> 
> -- Steve
> 
> 
> > 
> > 
> > > +
> > >  	/* The return trace stack is full */
> > >  	if (current->curr_ret_stack == FTRACE_RETFUNC_DEPTH - 1) {
> > >  		atomic_inc(&current->trace_overrun);
> > > -- 
> > > 1.6.3.1
> > > 
> > > -- 
> > 
> > 

  reply	other threads:[~2009-06-03 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02 18:30 [PATCH 0/3] [GIT PULL][urgent] function-graph: memory leak and race fixes Steven Rostedt
2009-06-02 18:30 ` [PATCH 1/3] function-graph: only allocate init tasks if it was not already done Steven Rostedt
2009-06-02 18:30 ` [PATCH 2/3] function-graph: enable the stack after initialization of other variables Steven Rostedt
2009-06-02 19:02   ` Frederic Weisbecker
2009-06-02 19:30     ` Steven Rostedt
2009-06-03 15:35       ` Paul E. McKenney [this message]
2009-06-02 18:30 ` [PATCH 3/3] function-graph: add memory barriers for accessing tasks ret_stack 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=20090603153508.GC6640@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=lclaudio@uudg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=rostedt@goodmis.org \
    --cc=stable@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