Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460078

Re: spin_lock implicit/explicit memory barrier

From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: spin_lock implicit/explicit memory barrier
Date 2016-08-11 01:00 +0200
Message-ID <s4KDE-2TN-27@gated-at.bofh.it> (permalink)
References <s4kpP-2Ta-7@gated-at.bofh.it> <s4pfP-690-1@gated-at.bofh.it> <s4Gqn-b4-97@gated-at.bofh.it> <s4ILv-1Hq-19@gated-at.bofh.it> <s4KaC-2JP-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Aug 10, 2016 at 03:23:16PM -0700, Davidlohr Bueso wrote:
> On Wed, 10 Aug 2016, Paul E. McKenney wrote:
> 
> >On Wed, Aug 10, 2016 at 08:21:22PM +0200, Manfred Spraul wrote:
> 
> >>                                                              4)
> >>spin_unlock_wait() and spin_unlock() pair
> >>http://git.cmpxchg.org/cgit.cgi/linux-mmots.git/tree/ipc/sem.c#n291
> >>http://git.cmpxchg.org/cgit.cgi/linux-mmots.git/tree/ipc/sem.c#n409
> >>The data from the simple op must be observed by the following
> >>complex op. Right now, there is still an smp_rmb() in line 300: The
> >>control barrier from the loop inside spin_unlock_wait() is upgraded
> >>to an acquire barrier by an additional smp_rmb(). Is this smp_rmb()
> >>required? If I understand commit 2c6100227116 ("locking/qspinlock:
> >>Fix spin_unlock_wait() some more") right, with this commit qspinlock
> >>handle this case without the smp_rmb(). What I don't know if powerpc
> >>is using qspinlock already, or if powerpc works without the
> >>smp_rmb(). -- Manfred|
> 
> No, ppc doesn't use qspinlocks, but as mentioned, spin_unlock_wait for
> tickets are now at least an acquire (ppc is stronger), which match that
> unlock store-release you are concerned about, this is as of 726328d92a4
> (locking/spinlock, arch: Update and fix spin_unlock_wait() implementations).
> 
> This is exactly what you are doing by upgrading the ctrl dependency
> to the acquire barrier in
> http://git.cmpxchg.org/cgit.cgi/linux-mmots.git/tree/ipc/sem.c#n291
> and therefore we don't need it explicitly -- it also makes the comment
> wrt spin_unlock_wait obsolete. Or am I'm misunderstanding you?

Ah, I was looking at 4.7 rather than current mainline.  Perhaps Manfred
was doing the same.

							Thanx, Paul

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

spin_lock implicit/explicit memory barrier Manfred Spraul <manfred@colorfullife.com> - 2016-08-09 21:00 +0200
  Re: spin_lock implicit/explicit memory barrier Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2016-08-10 02:10 +0200
    Re: spin_lock implicit/explicit memory barrier Manfred Spraul <manfred@colorfullife.com> - 2016-08-10 20:30 +0200
      Re: spin_lock implicit/explicit memory barrier Davidlohr Bueso <dave@stgolabs.net> - 2016-08-10 21:30 +0200
        Re: spin_lock implicit/explicit memory barrier "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-10 23:10 +0200
          Re: spin_lock implicit/explicit memory barrier Manfred Spraul <manfred@colorfullife.com> - 2016-08-15 22:10 +0200
            Re: spin_lock implicit/explicit memory barrier "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-15 22:30 +0200
        Re: spin_lock implicit/explicit memory barrier Boqun Feng <boqun.feng@gmail.com> - 2016-08-12 04:50 +0200
          Re: spin_lock implicit/explicit memory barrier Manfred Spraul <manfred@colorfullife.com> - 2016-08-12 20:50 +0200
            Re: spin_lock implicit/explicit memory barrier Boqun Feng <boqun.feng@gmail.com> - 2016-08-22 11:20 +0200
      Re: spin_lock implicit/explicit memory barrier "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-10 23:00 +0200
        Re: spin_lock implicit/explicit memory barrier Davidlohr Bueso <dave@stgolabs.net> - 2016-08-11 00:30 +0200
          Re: spin_lock implicit/explicit memory barrier "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-11 01:00 +0200
            Re: spin_lock implicit/explicit memory barrier Davidlohr Bueso <dave@stgolabs.net> - 2016-08-11 01:40 +0200
              Re: spin_lock implicit/explicit memory barrier Peter Zijlstra <peterz@infradead.org> - 2016-08-11 10:20 +0200
                Re: spin_lock implicit/explicit memory barrier Davidlohr Bueso <dave@stgolabs.net> - 2016-08-11 20:40 +0200
                Re: spin_lock implicit/explicit memory barrier Boqun Feng <boqun.feng@gmail.com> - 2016-08-12 05:10 +0200
                Re: spin_lock implicit/explicit memory barrier Peter Zijlstra <peterz@infradead.org> - 2016-08-19 16:10 +0200
          Re: spin_lock implicit/explicit memory barrier Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2016-08-11 02:10 +0200
    Re: spin_lock implicit/explicit memory barrier "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-10 22:00 +0200

csiph-web