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


Groups > linux.kernel > #1210346 > unrolled thread

Re: [RFC PATCH v2] memory-barriers: remove smp_mb__after_unlock_lock()

Started byMichael Ellerman <mpe@ellerman.id.au>
First post2015-08-20 11:50 +0200
Last post2015-08-26 06:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH v2] memory-barriers: remove  smp_mb__after_unlock_lock() Michael Ellerman <mpe@ellerman.id.au> - 2015-08-20 11:50 +0200
    Re: [RFC PATCH v2] memory-barriers: remove  smp_mb__after_unlock_lock() Will Deacon <will.deacon@arm.com> - 2015-08-20 18:00 +0200
      Re: [RFC PATCH v2] memory-barriers: remove  smp_mb__after_unlock_lock() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-08-26 02:30 +0200
        Re: [RFC PATCH v2] memory-barriers: remove  smp_mb__after_unlock_lock() Michael Ellerman <mpe@ellerman.id.au> - 2015-08-26 06:10 +0200

#1210346 — Re: [RFC PATCH v2] memory-barriers: remove smp_mb__after_unlock_lock()

FromMichael Ellerman <mpe@ellerman.id.au>
Date2015-08-20 11:50 +0200
SubjectRe: [RFC PATCH v2] memory-barriers: remove smp_mb__after_unlock_lock()
Message-ID<pZuDU-15a-1@gated-at.bofh.it>
On Tue, 2015-08-18 at 09:37 +0100, Will Deacon wrote:
> On Tue, Aug 18, 2015 at 02:50:55AM +0100, Michael Ellerman wrote:
> > On Mon, 2015-08-17 at 09:57 +0100, Will Deacon wrote:
> > > On Mon, Aug 17, 2015 at 07:15:01AM +0100, Paul E. McKenney wrote:
> > > > On Mon, Aug 17, 2015 at 02:06:07PM +1000, Michael Ellerman wrote:
> > > > > On Wed, 2015-08-12 at 08:43 -0700, Paul E. McKenney wrote:
> > > > > I thought the end result of this thread was that we didn't *need* to change the
> > > > > powerpc lock semantics? Or did I read it wrong?
> > > > > 
> > > > > ie. the docs now say that RELEASE+ACQUIRE is not a full barrier, which is
> > > > > consistent with our current implementation.
> > > > 
> > > > That change happened about 1.5 years ago, and I thought that the
> > > > current discussion was about reversing it, based in part on the
> > > > recent powerpc benchmarks of locking primitives with and without the
> > > > sync instruction.  But regardless, I clearly cannot remove either the
> > > > smp_mb__after_unlock_lock() or the powerpc definition of it to be smp_mb()
> > > > if powerpc unlock/lock is not strengthened.
> > > 
> > > Yup. Peter and I would really like to get rid of smp_mb__after_unlock_lock
> > > entirely, which would mean strengthening the ppc spinlocks. Moving the
> > > barrier primitive into RCU is a good step to prevent more widespread usage
> > > of the barrier, but we'd really like to go further if the performance impact
> > > is deemed acceptable (which is what this thread is about).
> > 
> > OK, sorry for completely missing the point, too many balls in the air here.
> 
> No problem!
> 
> > I'll do some benchmarks and see what we come up with.
> 
> Thanks, that sounds great. FWIW, there are multiple ways of implementing
> the patch (i.e. whether you strengthen lock or unlock). I had a crack at
> something here, but it's not tested:
> 
>   http://marc.info/?l=linux-arch&m=143758379023849&w=2

Thanks.

I notice you are not changing PPC_RELEASE_BARRIER, but only the spin unlock
code. But from my reading of the docs we need to make sure any UNLOCK+LOCK is a
full barrier, not just spin unlock/lock?

So don't we need to worry about some of the other locks as well? At least
rwlock, and mutex fast path?

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1210601

FromWill Deacon <will.deacon@arm.com>
Date2015-08-20 18:00 +0200
Message-ID<pZApX-YM-1@gated-at.bofh.it>
In reply to#1210346
On Thu, Aug 20, 2015 at 10:45:05AM +0100, Michael Ellerman wrote:
> On Tue, 2015-08-18 at 09:37 +0100, Will Deacon wrote:
> > On Tue, Aug 18, 2015 at 02:50:55AM +0100, Michael Ellerman wrote:
> > > On Mon, 2015-08-17 at 09:57 +0100, Will Deacon wrote:
> > > > On Mon, Aug 17, 2015 at 07:15:01AM +0100, Paul E. McKenney wrote:
> > > > > On Mon, Aug 17, 2015 at 02:06:07PM +1000, Michael Ellerman wrote:
> > > > > > On Wed, 2015-08-12 at 08:43 -0700, Paul E. McKenney wrote:
> > > > > > I thought the end result of this thread was that we didn't *need* to change the
> > > > > > powerpc lock semantics? Or did I read it wrong?
> > > > > > 
> > > > > > ie. the docs now say that RELEASE+ACQUIRE is not a full barrier, which is
> > > > > > consistent with our current implementation.
> > > > > 
> > > > > That change happened about 1.5 years ago, and I thought that the
> > > > > current discussion was about reversing it, based in part on the
> > > > > recent powerpc benchmarks of locking primitives with and without the
> > > > > sync instruction.  But regardless, I clearly cannot remove either the
> > > > > smp_mb__after_unlock_lock() or the powerpc definition of it to be smp_mb()
> > > > > if powerpc unlock/lock is not strengthened.
> > > > 
> > > > Yup. Peter and I would really like to get rid of smp_mb__after_unlock_lock
> > > > entirely, which would mean strengthening the ppc spinlocks. Moving the
> > > > barrier primitive into RCU is a good step to prevent more widespread usage
> > > > of the barrier, but we'd really like to go further if the performance impact
> > > > is deemed acceptable (which is what this thread is about).
> > > 
> > > OK, sorry for completely missing the point, too many balls in the air here.
> > 
> > No problem!
> > 
> > > I'll do some benchmarks and see what we come up with.
> > 
> > Thanks, that sounds great. FWIW, there are multiple ways of implementing
> > the patch (i.e. whether you strengthen lock or unlock). I had a crack at
> > something here, but it's not tested:
> > 
> >   http://marc.info/?l=linux-arch&m=143758379023849&w=2
> 
> Thanks.
> 
> I notice you are not changing PPC_RELEASE_BARRIER, but only the spin unlock
> code. But from my reading of the docs we need to make sure any UNLOCK+LOCK is a
> full barrier, not just spin unlock/lock?
> 
> So don't we need to worry about some of the other locks as well? At least
> rwlock, and mutex fast path?

Hmm, that's a good question. I notice that you don't do any of the SYNC_IO
stuff for any locks other than spinlocks but I don't know whether
smp_mb__after_unlock_lock is similarly limited in scope.

Paul?

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1213460

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2015-08-26 02:30 +0200
Message-ID<q1wLf-69E-9@gated-at.bofh.it>
In reply to#1210601
On Thu, Aug 20, 2015 at 04:56:04PM +0100, Will Deacon wrote:
> On Thu, Aug 20, 2015 at 10:45:05AM +0100, Michael Ellerman wrote:
> > On Tue, 2015-08-18 at 09:37 +0100, Will Deacon wrote:
> > > On Tue, Aug 18, 2015 at 02:50:55AM +0100, Michael Ellerman wrote:
> > > > On Mon, 2015-08-17 at 09:57 +0100, Will Deacon wrote:
> > > > > On Mon, Aug 17, 2015 at 07:15:01AM +0100, Paul E. McKenney wrote:
> > > > > > On Mon, Aug 17, 2015 at 02:06:07PM +1000, Michael Ellerman wrote:
> > > > > > > On Wed, 2015-08-12 at 08:43 -0700, Paul E. McKenney wrote:
> > > > > > > I thought the end result of this thread was that we didn't *need* to change the
> > > > > > > powerpc lock semantics? Or did I read it wrong?
> > > > > > > 
> > > > > > > ie. the docs now say that RELEASE+ACQUIRE is not a full barrier, which is
> > > > > > > consistent with our current implementation.
> > > > > > 
> > > > > > That change happened about 1.5 years ago, and I thought that the
> > > > > > current discussion was about reversing it, based in part on the
> > > > > > recent powerpc benchmarks of locking primitives with and without the
> > > > > > sync instruction.  But regardless, I clearly cannot remove either the
> > > > > > smp_mb__after_unlock_lock() or the powerpc definition of it to be smp_mb()
> > > > > > if powerpc unlock/lock is not strengthened.
> > > > > 
> > > > > Yup. Peter and I would really like to get rid of smp_mb__after_unlock_lock
> > > > > entirely, which would mean strengthening the ppc spinlocks. Moving the
> > > > > barrier primitive into RCU is a good step to prevent more widespread usage
> > > > > of the barrier, but we'd really like to go further if the performance impact
> > > > > is deemed acceptable (which is what this thread is about).
> > > > 
> > > > OK, sorry for completely missing the point, too many balls in the air here.
> > > 
> > > No problem!
> > > 
> > > > I'll do some benchmarks and see what we come up with.
> > > 
> > > Thanks, that sounds great. FWIW, there are multiple ways of implementing
> > > the patch (i.e. whether you strengthen lock or unlock). I had a crack at
> > > something here, but it's not tested:
> > > 
> > >   http://marc.info/?l=linux-arch&m=143758379023849&w=2
> > 
> > Thanks.
> > 
> > I notice you are not changing PPC_RELEASE_BARRIER, but only the spin unlock
> > code. But from my reading of the docs we need to make sure any UNLOCK+LOCK is a
> > full barrier, not just spin unlock/lock?
> > 
> > So don't we need to worry about some of the other locks as well? At least
> > rwlock, and mutex fast path?
> 
> Hmm, that's a good question. I notice that you don't do any of the SYNC_IO
> stuff for any locks other than spinlocks but I don't know whether
> smp_mb__after_unlock_lock is similarly limited in scope.
> 
> Paul?

I would expect the various locks to have similar ordering characteristics.

Or am I missing something subtle here?

							Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1213529

FromMichael Ellerman <mpe@ellerman.id.au>
Date2015-08-26 06:10 +0200
Message-ID<q1Aca-2SV-7@gated-at.bofh.it>
In reply to#1213460
On Tue, 2015-08-25 at 17:27 -0700, Paul E. McKenney wrote:
> On Thu, Aug 20, 2015 at 04:56:04PM +0100, Will Deacon wrote:
> > On Thu, Aug 20, 2015 at 10:45:05AM +0100, Michael Ellerman wrote:
> > > On Tue, 2015-08-18 at 09:37 +0100, Will Deacon wrote:
> > > > 
> > > > Thanks, that sounds great. FWIW, there are multiple ways of implementing
> > > > the patch (i.e. whether you strengthen lock or unlock). I had a crack at
> > > > something here, but it's not tested:
> > > > 
> > > >   http://marc.info/?l=linux-arch&m=143758379023849&w=2
> > > 
> > > I notice you are not changing PPC_RELEASE_BARRIER, but only the spin unlock
> > > code. But from my reading of the docs we need to make sure any UNLOCK+LOCK is a
> > > full barrier, not just spin unlock/lock?
> > > 
> > > So don't we need to worry about some of the other locks as well? At least
> > > rwlock, and mutex fast path?
> > 
> > Hmm, that's a good question. I notice that you don't do any of the SYNC_IO
> > stuff for any locks other than spinlocks but I don't know whether
> > smp_mb__after_unlock_lock is similarly limited in scope.
> > 
> > Paul?
> 
> I would expect the various locks to have similar ordering characteristics.
> 
> Or am I missing something subtle here?

I don't think so.

The docs just talk about ACQUIRE/RELEASE, so I think it needs to apply to all
lock types. Or at least the list mentioned in the docs which is:

 (*) spin locks
 (*) R/W spin locks
 (*) mutexes
 (*) semaphores
 (*) R/W semaphores
 (*) RCU

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web