From: Will Deacon <will.deacon@arm.com>
To: Daniel Lustig <dlustig@nvidia.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Boqun Feng <boqun.feng@gmail.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Andrea Parri <parri.andrea@gmail.com>,
Luc Maranget <luc.maranget@inria.fr>,
Jade Alglave <j.alglave@ucl.ac.uk>,
Nicholas Piggin <npiggin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
David Howells <dhowells@redhat.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Unlock-lock questions and the Linux Kernel Memory Model
Date: Fri, 1 Dec 2017 16:24:02 +0000 [thread overview]
Message-ID: <20171201162401.GI14823@arm.com> (raw)
In-Reply-To: <56ac3b6d-a898-1da0-7ccf-69a6968a923b@nvidia.com>
On Fri, Dec 01, 2017 at 08:17:04AM -0800, Daniel Lustig wrote:
> On 12/1/2017 7:32 AM, Alan Stern wrote:
> > On Fri, 1 Dec 2017, Boqun Feng wrote:
> >>> But even on a non-other-multicopy-atomic system, there has to be some
> >>> synchronization between the memory controller and P1's CPU. Otherwise,
> >>> how could the system guarantee that P1's smp_load_acquire would see the
> >>> post-increment value of y? It seems reasonable to assume that this
> >>> synchronization would also cause P1 to see x=1.
> >>>
> >>
> >> I agree with you the "reasonable" part ;-) So basically, memory
> >> controller could only do the write of AMO until P0's second write
> >> propagated to the memory controller(and because of the wmb(), P0's first
> >> write must be already propagated to the memory controller, too), so it
> >> makes sense when the write of AMO propagated from memory controller to
> >> P1, P0's first write is also propagted to P1. IOW, the write of AMO on
> >> memory controller acts at least like a release.
> >>
> >> However, some part of myself is still a little paranoid, because to my
> >> understanding, the point of AMO is to get atomic operations executing
> >> as fast as possible, so maybe, AMO has some fast path for the memory
> >> controller to forward a write to the CPU that issues the AMO, in that
> >> way, it will become unreasonable ;-)
> >
> > It's true that a hardware design in the future might behave differently
> > from current hardware. If that ever happens, we will need to rethink
> > the situation. Maybe the designers will change their hardware to make
> > it match the memory model. Or maybe the memory model will change.
>
> Do you mean all of the above in the context of increment etc, as opposed
> to swap? ARM hardware in the wild is already documented as forwarding
> SWP values to subsequent loads early, even past control dependencies.
> Paul sent this link earlier in the thread.
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0735r0.html
>
> The reason swap is special is because its store value is available to be
> forwarded even before the AMO goes out to the memory controller or
> wherever else it gets its load value from.
>
> Also, the case I described is an acquire rather than a control
> dependency, but it's similar enough that it doesn't seem completely
> unrealistic to think hardware might try to do this.
To be clear: we don't forward from a SWP to a load with Acquire semantics,
so the distinction is an important one.
Will
next prev parent reply other threads:[~2017-12-01 16:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4118cdbe-c396-08b9-a3e3-a0a6491b82fa@nvidia.com>
2017-11-27 21:16 ` Unlock-lock questions and the Linux Kernel Memory Model Alan Stern
2017-11-27 23:28 ` Daniel Lustig
2017-11-28 9:44 ` Peter Zijlstra
2017-11-28 9:58 ` Peter Zijlstra
2017-11-29 19:04 ` Daniel Lustig
2017-11-29 19:33 ` Paul E. McKenney
2017-11-29 19:44 ` Alan Stern
2017-11-30 8:55 ` Boqun Feng
2017-11-30 9:15 ` Peter Zijlstra
2017-11-30 15:46 ` Alan Stern
2017-12-01 2:46 ` Boqun Feng
2017-12-01 15:32 ` Alan Stern
2017-12-01 16:17 ` Daniel Lustig
2017-12-01 16:24 ` Will Deacon [this message]
2017-12-01 17:18 ` Alan Stern
2017-11-29 19:46 ` Peter Zijlstra
2017-11-29 19:53 ` Alan Stern
2017-11-29 20:42 ` Paul E. McKenney
2017-11-29 22:18 ` Daniel Lustig
2017-11-29 22:59 ` Paul E. McKenney
2017-11-30 15:20 ` Alan Stern
2017-11-30 16:14 ` Paul E. McKenney
2017-11-30 16:25 ` Peter Zijlstra
2017-11-30 16:39 ` Paul E. McKenney
2017-11-30 16:41 ` Will Deacon
2017-11-30 16:54 ` Paul E. McKenney
2017-11-30 17:04 ` Will Deacon
2017-11-30 17:56 ` Alan Stern
2017-11-30 10:02 ` Will Deacon
2017-11-29 19:58 ` Peter Zijlstra
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=20171201162401.GI14823@arm.com \
--to=will.deacon@arm.com \
--cc=boqun.feng@gmail.com \
--cc=dhowells@redhat.com \
--cc=dlustig@nvidia.com \
--cc=j.alglave@ucl.ac.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.maranget@inria.fr \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=parri.andrea@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.