From 3b48cfdc788cf38fa55a453b2c8c7736fe2f2054 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 22 Aug 2018 15:39:24 +0200 Subject: [PATCH] 4.9-stable patches added patches: parisc-remove-unnecessary-barriers-from-spinlock.h.patch --- ...unnecessary-barriers-from-spinlock.h.patch | 71 +++++++++++++++++++ queue-4.9/series | 1 + 2 files changed, 72 insertions(+) create mode 100644 queue-4.9/parisc-remove-unnecessary-barriers-from-spinlock.h.patch diff --git a/queue-4.9/parisc-remove-unnecessary-barriers-from-spinlock.h.patch b/queue-4.9/parisc-remove-unnecessary-barriers-from-spinlock.h.patch new file mode 100644 index 00000000000..c42c1caa1be --- /dev/null +++ b/queue-4.9/parisc-remove-unnecessary-barriers-from-spinlock.h.patch @@ -0,0 +1,71 @@ +From 3b885ac1dc35b87a39ee176a6c7e2af9c789d8b8 Mon Sep 17 00:00:00 2001 +From: John David Anglin +Date: Sun, 12 Aug 2018 16:31:17 -0400 +Subject: parisc: Remove unnecessary barriers from spinlock.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: John David Anglin + +commit 3b885ac1dc35b87a39ee176a6c7e2af9c789d8b8 upstream. + +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 +Cc: stable@vger.kernel.org # 4.0+ +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman + +--- + arch/parisc/include/asm/spinlock.h | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +--- 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( + { + 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( + 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 + volatile unsigned int *a; + int ret; + +- mb(); + a = __ldcw_align(x); + ret = __ldcw(a) != 0; +- mb(); + + return ret; + } diff --git a/queue-4.9/series b/queue-4.9/series index 1405d30d5fc..848987841a9 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -122,3 +122,4 @@ parisc-remove-ordered-stores-from-syscall.s.patch xfrm_user-prevent-leaking-2-bytes-of-kernel-memory.patch netfilter-conntrack-dccp-treat-sync-syncack-as-invalid-if-no-prior-state.patch packet-refine-ring-v3-block-size-test-to-hold-one-frame.patch +parisc-remove-unnecessary-barriers-from-spinlock.h.patch -- 2.47.3