From: Andrea Parri <andrea.parri@amarulasolutions.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Andrea Parri <andrea.parri@amarulasolutions.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH for-4.17 2/2] powerpc: Remove smp_mb() from arch_spin_is_locked()
Date: Mon, 26 Mar 2018 12:37:47 +0200 [thread overview]
Message-ID: <1522060667-7034-1-git-send-email-andrea.parri@amarulasolutions.com> (raw)
Commit 51d7d5205d338 ("powerpc: Add smp_mb() to arch_spin_is_locked()")
added an smp_mb() to arch_spin_is_locked(), in order to ensure that
Thread 0 Thread 1
spin_lock(A); spin_lock(B);
r0 = spin_is_locked(B) r1 = spin_is_locked(A);
never ends up with r0 = r1 = 0, and reported one example (in ipc/sem.c)
relying on such guarantee.
It's however understood (and undocumented) that spin_is_locked() is not
required to ensure such ordering guarantee, guarantee that is currently
_not_ provided by all implementations/arch, and that callers relying on
such ordering should instead use suitable memory barriers before acting
on the result of spin_is_locked().
Following a recent auditing[1] of the callers of {,raw_}spin_is_locked()
revealing that none of them are relying on this guarantee anymore, this
commit removes the leading smp_mb() from the primitive thus effectively
reverting 51d7d5205d338.
[1] https://marc.info/?l=linux-kernel&m=151981440005264&w=2
Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
---
arch/powerpc/include/asm/spinlock.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index b9ebc3085fb79..ecc141e3f1a73 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -67,7 +67,6 @@ static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock)
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
{
- smp_mb();
return !arch_spin_value_unlocked(*lock);
}
--
2.7.4
next reply other threads:[~2018-03-26 10:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 10:37 Andrea Parri [this message]
2018-03-27 0:06 ` [PATCH for-4.17 2/2] powerpc: Remove smp_mb() from arch_spin_is_locked() Benjamin Herrenschmidt
2018-03-27 10:25 ` Andrea Parri
2018-03-27 11:33 ` Benjamin Herrenschmidt
2018-03-27 13:13 ` Andrea Parri
2018-03-27 21:51 ` Benjamin Herrenschmidt
2018-03-28 9:17 ` Andrea Parri
2018-03-28 5:25 ` Michael Ellerman
2018-03-28 11:04 ` Peter Zijlstra
2018-03-28 11:08 ` Peter Zijlstra
2018-04-04 10:28 ` Michael Ellerman
2018-04-04 10:28 ` Michael Ellerman
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=1522060667-7034-1-git-send-email-andrea.parri@amarulasolutions.com \
--to=andrea.parri@amarulasolutions.com \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--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;
as well as URLs for NNTP newsgroup(s).