public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Andrea Parri <andrea.parri@amarulasolutions.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH for-4.17 1/2] arm64: Remove smp_mb() from arch_spin_is_locked()
Date: Tue, 27 Mar 2018 17:54:23 +0100	[thread overview]
Message-ID: <20180327165423.GF18435@arm.com> (raw)
In-Reply-To: <20180326141436.GA11739@andrea>

Hi Andrea,

On Mon, Mar 26, 2018 at 04:14:36PM +0200, Andrea Parri wrote:
> On Mon, Mar 26, 2018 at 11:57:05AM +0100, Will Deacon wrote:
> > On Mon, Mar 26, 2018 at 12:37:21PM +0200, Andrea Parri wrote:
> > > Commit 38b850a73034f ("arm64: spinlock: order spin_{is_locked,unlock_wait}
> > > against local locks") added an smp_mb() to arch_spin_is_locked(), in order
> > > "to ensure that the lock value is always loaded after any other locks have
> > > been taken by the current CPU", and reported one example (the "insane case"
> > > in ipc/sem.c) relying on such guarantee.
> > > 
> > > It is however understood (and not documented) that spin_is_locked() is not
> > > required to ensure such an ordering guarantee, guarantee that is currently
> > > _not_ provided by all implementations/architectures, and that callers rely-
> > > ing on such ordering should instead insert suitable memory barriers before
> > > acting on the result of spin_is_locked().
> > > 
> > > Following a recent auditing[1] of the callsites of {,raw_}spin_is_locked()
> > > revealing that none of these callers are relying on the ordering guarantee
> > > anymore, this commit removes the leading smp_mb() from this primitive thus
> > > effectively reverting 38b850a73034f.
> > > 
> > > [1] https://marc.info/?l=linux-kernel&m=151981440005264&w=2
> > 
> > What is patch 2/2 in this series? I couldn't find it in the archive.
> 
> 2/2 is this change for powerpc:
> 
>   https://marc.info/?l=linux-kernel&m=152206068707522&w=2
> 
> > 
> > Assuming that patch doesn't do it, please can you remove the comment
> > about spin_is_locked from mutex_is_locked?
> 
> I ended up with the patch below but I suspect that it's not what you had
> in mind; please let me know if you'd like me to add it into this series.

That's exactly what I meant! I think you can remove the #ifndef
queued_spin_is_locked in the same patch. If you do that:

Acked-by: Will Deacon <will.deacon@arm.com>

for the arm64 patch and the mythical core patch we've been discussing.

Will

      reply	other threads:[~2018-03-27 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 10:37 [PATCH for-4.17 1/2] arm64: Remove smp_mb() from arch_spin_is_locked() Andrea Parri
2018-03-26 10:57 ` Will Deacon
2018-03-26 14:14   ` Andrea Parri
2018-03-27 16:54     ` Will Deacon [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=20180327165423.GF18435@arm.com \
    --to=will.deacon@arm.com \
    --cc=andrea.parri@amarulasolutions.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.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