From: Boqun Feng <boqun.feng@gmail.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Manfred Spraul <manfred@colorfullife.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Susanne Spraul <1vier1@web.de>,
parri.andrea@gmail.com
Subject: Re: spin_lock implicit/explicit memory barrier
Date: Fri, 12 Aug 2016 10:59:46 +0800 [thread overview]
Message-ID: <20160812025946.GA6290@tardis.cn.ibm.com> (raw)
In-Reply-To: <20160811183106.GA18261@linux-80c1.suse>
[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]
On Thu, Aug 11, 2016 at 11:31:06AM -0700, Davidlohr Bueso wrote:
> On Thu, 11 Aug 2016, Peter Zijlstra wrote:
>
> > On Wed, Aug 10, 2016 at 04:29:22PM -0700, Davidlohr Bueso wrote:
> >
> > > (1) As Manfred suggested, have a patch 1 that fixes the race against mainline
> > > with the redundant smp_rmb, then apply a second patch that gets rid of it
> > > for mainline, but only backport the original patch 1 down to 3.12.
> >
> > I have not followed the thread closely, but this seems like the best
> > option. Esp. since 726328d92a42 ("locking/spinlock, arch: Update and fix
> > spin_unlock_wait() implementations") is incomplete, it relies on at
> > least 6262db7c088b ("powerpc/spinlock: Fix spin_unlock_wait()") to sort
> > PPC.
>
> Yeah, and we'd also need the arm bits; which reminds me, aren't alpha
> ldl_l/stl_c sequences also exposed to this delaying of the publishing
> when a non-owner peeks at the lock? Right now sysv sem's would be busted
> when doing either is_locked or unlock_wait, shouldn't these be pimped up
> to full smp_mb()s?
>
You are talking about a similar problem as this one:
http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1018307.html
right?
The trick of this problem is whether the barrier or operation in
spin_lock() could order the STORE part of the lock-acquire with memory
operations in critical sections.
On PPC, we use lwsync, which doesn't order STORE->LOAD, so there is
problem. On ARM64 and qspinlock in x86, there are similiar reasons.
But if an arch implements its spin_lock() with a full barrier, even
though the atomic is implemented by ll/sc, the STORE part of which can't
be reordered with memory operations in the critcal sections. I think
maybe that's the case for alpha(and also for ARM32).
Regards,
Boqun
> Thanks,
> Davidlohr
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-08-12 2:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 18:52 Manfred Spraul
2016-08-10 0:05 ` Benjamin Herrenschmidt
2016-08-10 18:21 ` Manfred Spraul
2016-08-10 19:17 ` Davidlohr Bueso
2016-08-10 21:00 ` Paul E. McKenney
2016-08-15 20:06 ` Manfred Spraul
2016-08-15 20:28 ` Paul E. McKenney
2016-08-12 2:47 ` Boqun Feng
2016-08-12 18:43 ` Manfred Spraul
2016-08-22 9:15 ` Boqun Feng
2016-08-10 20:52 ` Paul E. McKenney
2016-08-10 22:23 ` Davidlohr Bueso
2016-08-10 22:58 ` Paul E. McKenney
2016-08-10 23:29 ` Davidlohr Bueso
2016-08-11 8:11 ` Peter Zijlstra
2016-08-11 18:31 ` Davidlohr Bueso
2016-08-12 2:59 ` Boqun Feng [this message]
2016-08-19 14:01 ` Peter Zijlstra
2016-08-10 23:59 ` Benjamin Herrenschmidt
2016-08-10 18:33 ` Paul E. McKenney
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=20160812025946.GA6290@tardis.cn.ibm.com \
--to=boqun.feng@gmail.com \
--cc=1vier1@web.de \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=mpe@ellerman.id.au \
--cc=parri.andrea@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.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
Powered by JetHome