public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Will Deacon <will.deacon@arm.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org, Davidlohr Bueso <dave@stgolabs.net>,
	Ingo Molnar <mingo@kernel.org>,
	parri.andrea@gmail.com
Subject: Re: [RFC][PATCH] locking/mcs: Fix ordering for mcs_spin_lock()
Date: Mon, 1 Feb 2016 18:24:44 +0100	[thread overview]
Message-ID: <20160201172444.GX6357@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160201165813.GH6828@arm.com>

On Mon, Feb 01, 2016 at 04:58:13PM +0000, Will Deacon wrote:
> Hi Peter,
> 
> On Mon, Feb 01, 2016 at 03:37:24PM +0100, Peter Zijlstra wrote:
> > Given the below patch; we've now got an unconditional full global
> > barrier in, does this make the MCS spinlock RCsc ?
> > 
> > The 'problem' is that this barrier can happen before we actually acquire
> > the lock. That is, if we hit arch_mcs_spin_lock_contended() _that_ will
> > be the acquire barrier and we end up with a SYNC in between unlock and
> > lock -- ie. not an smp_mb__after_unlock_lock() equivalent.
> 
> In which case, I don't think the lock will be RCsc with this change;
> you'd need an smp_mb__after_unlock_lock() after
> arch_mcs_spin_lock_contended(...) if you wanted the thing to be RCsc.

Right, I think it works for TSO, but in general it makes my head hurt.

> > This is non-critical because the MCS code isn't actually used and
> > mostly serves as documentation, a stepping stone to the more complex
> > things we've build on top of the idea.
> 
> Although I wonder how useful this is as a documentation aid now that we
> have the osq_lock.

So the OSQ thing is horribly complex, pure MCS is a nice step-stone.

      reply	other threads:[~2016-02-01 17:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 14:37 [RFC][PATCH] locking/mcs: Fix ordering for mcs_spin_lock() Peter Zijlstra
2016-02-01 16:58 ` Will Deacon
2016-02-01 17:24   ` Peter Zijlstra [this message]

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=20160201172444.GX6357@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dave@stgolabs.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=will.deacon@arm.com \
    /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