From: Josh Triplett <josh@joshtriplett.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org, mingo@elte.hu,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
dvhltc@us.ibm.com, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, Valdis.Kletnieks@vt.edu,
dhowells@redhat.com, Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH tip/core/rcu 1/3] ftrace: replace read_barrier_depends() with rcu_dereference_raw()
Date: Fri, 5 Mar 2010 17:45:13 -0800 [thread overview]
Message-ID: <20100306014513.GA13858@feather> (raw)
In-Reply-To: <1267838945.10871.1786.camel@gandalf.stny.rr.com>
On Fri, Mar 05, 2010 at 08:29:05PM -0500, Steven Rostedt wrote:
> On Fri, 2010-03-05 at 15:03 -0800, Paul E. McKenney wrote:
> > Replace the calls to read_barrier_depends() in ftrace_list_func() with
> > rcu_dereference_raw() to improve readability. The reason that we use
> > rcu_dereference_raw() here is that removed entries are never freed,
> > instead they are simply leaked. This is one of a very few cases where
> > use of rcu_dereference_raw() is the long-term right answer. And I don't
> > yet know of any others. ;-)
> >
> > Cc: Steven Rostedt <rostedt@goodmis.org>
>
> Acked-by: Steven Rostedt <rostedt@goodmis.org>
>
> Thanks Paul!
>
> > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > ---
>
> >
> > @@ -154,8 +159,7 @@ static int __register_ftrace_function(struct ftrace_ops *ops)
> > * the ops->next pointer is valid before another CPU sees
> > * the ops pointer included into the ftrace_list.
> > */
> > - smp_wmb();
> > - ftrace_list = ops;
> > + rcu_assign_pointer(ftrace_list, ops);
>
> [ Off topic ]
>
> I looked at rcu_assign_pointer() and it is:
>
> #define rcu_assign_pointer(p, v) \
> ({ \
> if (!__builtin_constant_p(v) || \
> ((v) != NULL)) \
> smp_wmb(); \
> (p) = (v); \
> })
>
> My question is, why that crazy if? The only time that will fail is if we
> are assigning the constant NULL to p. What makes NULL so important here?
> Can't there be a case when assigning NULL to p will require that wmb()?
The barrier ensures that the reader can't see the new p and the old
*p. Since you can't look at *NULL, that concern doesn't apply.
- Josh Triplett
next prev parent reply other threads:[~2010-03-06 1:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-05 23:02 [PATCH tip/core/rcu 0/3] rcu: ftrace&x86/mce RCU lockdep fixes, extend RCU CPU stall Paul E. McKenney
2010-03-05 23:03 ` [PATCH tip/core/rcu 1/3] ftrace: replace read_barrier_depends() with rcu_dereference_raw() Paul E. McKenney
2010-03-06 1:29 ` Steven Rostedt
2010-03-06 1:45 ` Josh Triplett [this message]
2010-03-06 1:57 ` Steven Rostedt
2010-03-06 2:15 ` Josh Triplett
2010-03-06 2:31 ` Steven Rostedt
2010-03-11 14:38 ` [tip:core/urgent] ftrace: Replace " tip-bot for Paul E. McKenney
2010-03-05 23:03 ` [PATCH tip/core/rcu 2/3] rcu: Increase RCU CPU stall timeouts if PROVE_RCU Paul E. McKenney
2010-03-11 14:38 ` [tip:core/urgent] " tip-bot for Paul E. McKenney
2010-03-05 23:03 ` [PATCH tip/core/rcu 3/3] x86/mce: fix RCU lockdep splats Paul E. McKenney
2010-03-11 14:38 ` [tip:core/urgent] x86/mce: Fix " tip-bot for Paul E. McKenney
2010-03-14 8:06 ` [tip:core/urgent] x86/mce: Fix build bug with CONFIG_PROVE_LOCKING=y && CONFIG_X86_MCE_INTEL=y tip-bot for Ingo Molnar
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=20100306014513.GA13858@feather \
--to=josh@joshtriplett.org \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhltc@us.ibm.com \
--cc=fweisbec@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=niv@us.ibm.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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