From: Josh Triplett <josh@joshtriplett.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 17/17] RCU'd vfsmounts
Date: Thu, 3 Oct 2013 23:03:05 -0700 [thread overview]
Message-ID: <20131004060304.GA28411@leaf> (raw)
In-Reply-To: <20131004052959.GB5790@linux.vnet.ibm.com>
On Thu, Oct 03, 2013 at 10:29:59PM -0700, Paul E. McKenney wrote:
> On Thu, Oct 03, 2013 at 04:28:27PM -0700, Josh Triplett wrote:
> > On Thu, Oct 03, 2013 at 01:52:45PM -0700, Linus Torvalds wrote:
> > > On Thu, Oct 3, 2013 at 1:41 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> > > >
> > > > The problem is this:
> > > > A = 1, B = 1
> > > > CPU1:
> > > > A = 0
> > > > <full barrier>
> > > > synchronize_rcu()
> > > > read B
> > > >
> > > > CPU2:
> > > > rcu_read_lock()
> > > > B = 0
> > > > read A
>
> /me scratches his head...
>
> OK, for CPU2 to see 1 from its read from A, the corresponding RCU
> read-side critical section must have started before CPU1 did A=0. This
> means that this same RCU read-side critical section must have started
> before CPU1's synchronize_rcu(), which means that it must complete
> before that synchronize_rcu() returns. Therefore, CPU2's B=0 must
> execute before CPU1's read of B, hence that read of B must return zero.
>
> Conversely, if CPU1's read from B returns 1, we know that CPU2's
> RCU read-side critical section must not have completed until after
> CPU1's synchronize_rcu() returned, which means that the RCU read-side
> critical section must have started after that synchronize_rcu() started,
> so CPU1's assignment to A must also have already happened. Therefore,
> CPU2's read from A must return zero.
Yeah, that makes sense.
I think too much time spent staring at the *implementation* of RCU and
the exciting assumptions it has to make about barriers or memory
operations leaking out of the implementations of the RCU primitives (for
instance, the fun needed to guarantee a memory barrier on all CPUs, or
to safely use non-atomic operations inside RCU itself) makes it entirely
too difficult to look at a perfectly ordinary *use* of RCU primitives
and see the obvious. :)
- Josh Triplett
next prev parent reply other threads:[~2013-10-04 6:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 6:20 [PATCH 17/17] RCU'd vfsmounts Al Viro
[not found] ` <CA+55aFzeDP6J4ekdn4-85yoXzX3xmEp_qc3npvqepJM+MFn=6Q@mail.gmail.com>
[not found] ` <20131003105130.GE13318@ZenIV.linux.org.uk>
[not found] ` <CA+55aFzh+n_2fs=aWcT_5gnLC_pWSHqQPJeQ+fg=+Xw7ib9=dQ@mail.gmail.com>
[not found] ` <20131003174439.GG13318@ZenIV.linux.org.uk>
2013-10-03 19:06 ` Linus Torvalds
2013-10-03 19:43 ` Al Viro
2013-10-03 20:19 ` Linus Torvalds
2013-10-03 20:41 ` Al Viro
2013-10-03 20:52 ` Linus Torvalds
2013-10-03 21:14 ` Al Viro
2013-10-04 2:53 ` Al Viro
2013-10-04 8:37 ` Christoph Hellwig
2013-10-04 12:58 ` Al Viro
2013-10-04 14:00 ` Christoph Hellwig
2013-10-03 23:28 ` Josh Triplett
2013-10-03 23:51 ` Linus Torvalds
2013-10-04 0:41 ` Josh Triplett
2013-10-04 0:45 ` Linus Torvalds
2013-10-04 6:41 ` Ingo Molnar
2013-10-04 5:29 ` Paul E. McKenney
2013-10-04 6:03 ` Josh Triplett [this message]
2013-10-04 6:15 ` Paul E. McKenney
2013-10-04 7:04 ` Josh Triplett
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=20131004060304.GA28411@leaf \
--to=josh@joshtriplett.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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).