From: Michael Ellerman <mpe@ellerman.id.au>
To: stable@vger.kernel.org
Cc: linuxppc-dev@ozlabs.org
Subject: [PATCH 2/2] powerpc: Add smp_mb()s to arch_spin_unlock_wait()
Date: Thu, 11 Sep 2014 12:49:22 +1000 [thread overview]
Message-ID: <1410403762-14067-2-git-send-email-mpe@ellerman.id.au> (raw)
In-Reply-To: <1410403762-14067-1-git-send-email-mpe@ellerman.id.au>
Backported from 78e05b1421fa upstream, for stable 3.14 and 3.16.
Similar to the previous commit which described why we need to add a
barrier to arch_spin_is_locked(), we have a similar problem with
spin_unlock_wait().
We need a barrier on entry to ensure any spinlock we have previously
taken is visibly locked prior to the load of lock->slock.
It's also not clear if spin_unlock_wait() is intended to have ACQUIRE
semantics. For now be conservative and add a barrier on exit to give it
ACQUIRE semantics.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/lib/locks.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 0c9c8d7d0734..170a0346f756 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -70,12 +70,16 @@ void __rw_yield(arch_rwlock_t *rw)
void arch_spin_unlock_wait(arch_spinlock_t *lock)
{
+ smp_mb();
+
while (lock->slock) {
HMT_low();
if (SHARED_PROCESSOR)
__spin_yield(lock);
}
HMT_medium();
+
+ smp_mb();
}
EXPORT_SYMBOL(arch_spin_unlock_wait);
--
1.9.1
next prev parent reply other threads:[~2014-09-11 2:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 2:49 [PATCH 1/2] powerpc: Add smp_mb() to arch_spin_is_locked() Michael Ellerman
2014-09-11 2:49 ` Michael Ellerman [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-08-07 5:36 Michael Ellerman
2014-08-07 5:36 ` [PATCH 2/2] powerpc: Add smp_mb()s to arch_spin_unlock_wait() 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=1410403762-14067-2-git-send-email-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=linuxppc-dev@ozlabs.org \
--cc=stable@vger.kernel.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).