Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: gregkh@linuxfoundation.org, John David Anglin <dave.anglin@bell.net>
Cc: deller@gmx.de, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] parisc: Remove unnecessary barriers from spinlock.h" failed to apply to 4.14-stable tree
Date: Wed, 22 Aug 2018 14:55:16 +0200	[thread overview]
Message-ID: <20180822125516.GA30105@ls3530> (raw)
In-Reply-To: <1534937348152134@kroah.com>

* gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>:
> The patch below does not apply to the 4.14-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.


Upstream commit ID 3b885ac1dc35b87a39ee176a6c7e2af9c789d8b8 was tagged
to be backported to v4.0+.

It applied cleanly to v4.17 and v4.18.
It did not applied to v4.14 and below (to v4.0).

Here is the backport which should apply.
Thanks!
Helge

diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h
index e32936cd7f10..7031483b110c 100644
--- a/arch/parisc/include/asm/spinlock.h
+++ b/arch/parisc/include/asm/spinlock.h
@@ -26,7 +26,6 @@ static inline void arch_spin_lock_flags(arch_spinlock_t *x,
 {
 	volatile unsigned int *a;
 
-	mb();
 	a = __ldcw_align(x);
 	while (__ldcw(a) == 0)
 		while (*a == 0)
@@ -36,16 +35,15 @@ static inline void arch_spin_lock_flags(arch_spinlock_t *x,
 				local_irq_disable();
 			} else
 				cpu_relax();
-	mb();
 }
 
 static inline void arch_spin_unlock(arch_spinlock_t *x)
 {
 	volatile unsigned int *a;
-	mb();
+
 	a = __ldcw_align(x);
-	*a = 1;
 	mb();
+	*a = 1;
 }
 
 static inline int arch_spin_trylock(arch_spinlock_t *x)
@@ -53,10 +51,8 @@ static inline int arch_spin_trylock(arch_spinlock_t *x)
 	volatile unsigned int *a;
 	int ret;
 
-	mb();
 	a = __ldcw_align(x);
         ret = __ldcw(a) != 0;
-	mb();
 
 	return ret;
 }


> 
> ------------------ original commit in Linus's tree ------------------
> 
> From 3b885ac1dc35b87a39ee176a6c7e2af9c789d8b8 Mon Sep 17 00:00:00 2001
> From: John David Anglin <dave.anglin@bell.net>
> Date: Sun, 12 Aug 2018 16:31:17 -0400
> Subject: [PATCH] parisc: Remove unnecessary barriers from spinlock.h
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Now that mb() is an instruction barrier, it will slow performance if we issue
> unnecessary barriers.
> 
> The spinlock defines have a number of unnecessary barriers.ᅵ The __ldcw()
> define is both a hardware and compiler barrier.ᅵ The mb() barriers in the
> routines using __ldcw() serve no purpose.
> 
> The only barrier needed is the one in arch_spin_unlock().ᅵ We need to ensure
> all accesses are complete prior to releasing the lock.
> 
> Signed-off-by: John David Anglin <dave.anglin@bell.net>
> Cc: stable@vger.kernel.org # 4.0+
> Signed-off-by: Helge Deller <deller@gmx.de>

  reply	other threads:[~2018-08-22 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 11:29 FAILED: patch "[PATCH] parisc: Remove unnecessary barriers from spinlock.h" failed to apply to 4.14-stable tree gregkh
2018-08-22 12:55 ` Helge Deller [this message]
2018-08-22 13:37   ` Greg KH

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=20180822125516.GA30105@ls3530 \
    --to=deller@gmx.de \
    --cc=dave.anglin@bell.net \
    --cc=gregkh@linuxfoundation.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