Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: peterz@infradead.org
Cc: Matthew Wilcox <willy@infradead.org>,
Alan Stern <stern@rowland.harvard.edu>,
Dave Chinner <david@fromorbit.com>,
Eric Biggers <ebiggers@kernel.org>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-fsdevel@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>,
Andrea Parri <parri.andrea@gmail.com>,
Boqun Feng <boqun.feng@gmail.com>,
Daniel Lustig <dlustig@nvidia.com>,
"Darrick J . Wong" <darrick.wong@oracle.com>,
David Howells <dhowells@redhat.com>,
Jade Alglave <j.alglave@ucl.ac.uk>,
Luc Maranget <luc.maranget@inria.fr>,
Nicholas Piggin <npiggin@gmail.com>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH] tools/memory-model: document the "one-time init" pattern
Date: Mon, 20 Jul 2020 15:06:51 -0700 [thread overview]
Message-ID: <20200720220651.GV9247@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20200720164850.GF119549@hirez.programming.kicks-ass.net>
On Mon, Jul 20, 2020 at 06:48:50PM +0200, peterz@infradead.org wrote:
> On Mon, Jul 20, 2020 at 09:04:34AM -0700, Paul E. McKenney wrote:
> > 2. If we were to say "unlock" instead of "release", consistency
> > would demand that we also say "lock" instead of "acquire".
> > But "lock" is subtlely different than "acquire", and there is
> > a history of people requesting further divergence.
>
> This, acquire/release are RCpc, while (with the exception of Power)
> LOCK/UNLOCK are RCsc.
>
> ( Or did we settle on RCtso for our release/acquire order? I have vague
> memories of a long-ish thread, but seem to have forgotten the outcome,
> if any. )
>
> Lots of subtlety and head-aches right about there. Anyway, it would be
> awesome if we can get Power into the RCsc locking camp :-)
I will let you take that one up with the Power folks.
But I should give an example of a current difference between lock and
acquire, and just to spread the blame, I will pick on an architecture
other than Power. ;-)
With lock acquisition, the following orders the access to X and Z:
WRITE_ONCE(X, 1);
spin_lock(&my_lock);
smp_mb__after_lock();
r1 = READ_ONCE(Z);
But if we replace the lock acquisition with a load acquire, there are
no ordering guarantees for the accesses to X and Z:
WRITE_ONCE(X, 1);
r2 = smp_load_acquire(&Y);
smp_mb__after_lock(); // Yeah, there is no lock. ;-)
r3 = READ_ONCE(Z);
There -is- ordering between the accesses to Y and Z, but not to X and Z.
This is not a theoretical issue. The x86 platform really can reorder
the access to X to follow that of both Y and Z.
So the memory-model divergence between lock acquisition and acquire
loads is very real in the here and now.
Thanx, Paul
next prev parent reply other threads:[~2020-07-20 22:06 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 4:44 Eric Biggers
2020-07-17 5:49 ` Sedat Dilek
2020-07-17 12:35 ` Matthew Wilcox
2020-07-17 14:26 ` Alan Stern
2020-07-17 17:47 ` Matthew Wilcox
2020-07-17 17:51 ` Alan Stern
2020-07-18 1:02 ` Eric Biggers
2020-07-27 12:51 ` Matthew Wilcox
2020-07-17 21:05 ` Darrick J. Wong
2020-07-18 0:44 ` Darrick J. Wong
2020-07-18 1:38 ` Eric Biggers
2020-07-18 2:13 ` Matthew Wilcox
2020-07-18 5:28 ` Eric Biggers
2020-07-18 14:35 ` Alan Stern
2020-07-20 2:07 ` Dave Chinner
2020-07-20 9:00 ` Peter Zijlstra
2020-07-27 15:17 ` Alan Stern
2020-07-27 15:28 ` Matthew Wilcox
2020-07-27 16:01 ` Paul E. McKenney
2020-07-27 16:31 ` Alan Stern
2020-07-27 16:59 ` Matthew Wilcox
2020-07-27 19:13 ` Alan Stern
2020-07-17 20:53 ` Darrick J. Wong
2020-07-18 0:58 ` Eric Biggers
2020-07-18 1:25 ` Alan Stern
2020-07-18 1:40 ` Matthew Wilcox
2020-07-18 2:00 ` Dave Chinner
2020-07-18 14:21 ` Alan Stern
2020-07-18 2:00 ` Eric Biggers
2020-07-18 1:42 ` Dave Chinner
2020-07-18 14:08 ` Alan Stern
2020-07-20 1:33 ` Dave Chinner
2020-07-20 14:52 ` Alan Stern
2020-07-20 15:37 ` Darrick J. Wong
2020-07-20 15:39 ` Matthew Wilcox
2020-07-20 16:04 ` Paul E. McKenney
2020-07-20 16:48 ` peterz
2020-07-20 22:06 ` Paul E. McKenney [this message]
2020-07-20 16:12 ` Alan Stern
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=20200720220651.GV9247@paulmck-ThinkPad-P72 \
--to=paulmck@kernel.org \
--cc=akiyks@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=dhowells@redhat.com \
--cc=dlustig@nvidia.com \
--cc=ebiggers@kernel.org \
--cc=j.alglave@ucl.ac.uk \
--cc=linux-arch@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.maranget@inria.fr \
--cc=npiggin@gmail.com \
--cc=parri.andrea@gmail.com \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--subject='Re: [PATCH] tools/memory-model: document the "one-time init" pattern' \
/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
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).