All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	mingo@kernel.org, will.deacon@arm.com,
	paulmck@linux.vnet.ibm.com, Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH 27/31] arch,tile: Convert smp_mb__*
Date: Wed, 19 Mar 2014 07:47:56 +0100	[thread overview]
Message-ID: <20140319065205.215604416@infradead.org> (raw)
In-Reply-To: 20140319064729.660482086@infradead.org

[-- Attachment #1: peterz-tile-smp_mb__atomic.patch --]
[-- Type: text/plain, Size: 4332 bytes --]

Implement the new smp_mb__* ops as per the old ones.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
---
 arch/tile/include/asm/atomic_32.h |   10 ----------
 arch/tile/include/asm/atomic_64.h |    6 ------
 arch/tile/include/asm/barrier.h   |   14 ++++++++++++++
 arch/tile/include/asm/bitops.h    |    1 +
 arch/tile/include/asm/bitops_32.h |    8 ++------
 arch/tile/include/asm/bitops_64.h |    4 ----
 6 files changed, 17 insertions(+), 26 deletions(-)

--- a/arch/tile/include/asm/atomic_32.h
+++ b/arch/tile/include/asm/atomic_32.h
@@ -169,16 +169,6 @@ static inline void atomic64_set(atomic64
 #define atomic64_dec_and_test(v)	(atomic64_dec_return((v)) == 0)
 #define atomic64_inc_not_zero(v)	atomic64_add_unless((v), 1LL, 0LL)
 
-/*
- * We need to barrier before modifying the word, since the _atomic_xxx()
- * routines just tns the lock and then read/modify/write of the word.
- * But after the word is updated, the routine issues an "mf" before returning,
- * and since it's a function call, we don't even need a compiler barrier.
- */
-#define smp_mb__before_atomic_dec()	smp_mb()
-#define smp_mb__before_atomic_inc()	smp_mb()
-#define smp_mb__after_atomic_dec()	do { } while (0)
-#define smp_mb__after_atomic_inc()	do { } while (0)
 
 #endif /* !__ASSEMBLY__ */
 
--- a/arch/tile/include/asm/atomic_64.h
+++ b/arch/tile/include/asm/atomic_64.h
@@ -105,12 +105,6 @@ static inline long atomic64_add_unless(a
 
 #define atomic64_inc_not_zero(v)	atomic64_add_unless((v), 1, 0)
 
-/* Atomic dec and inc don't implement barrier, so provide them if needed. */
-#define smp_mb__before_atomic_dec()	smp_mb()
-#define smp_mb__after_atomic_dec()	smp_mb()
-#define smp_mb__before_atomic_inc()	smp_mb()
-#define smp_mb__after_atomic_inc()	smp_mb()
-
 /* Define this to indicate that cmpxchg is an efficient operation. */
 #define __HAVE_ARCH_CMPXCHG
 
--- a/arch/tile/include/asm/barrier.h
+++ b/arch/tile/include/asm/barrier.h
@@ -72,6 +72,20 @@ mb_incoherent(void)
 #define mb()		fast_mb()
 #define iob()		fast_iob()
 
+#ifndef __tilegx__ /* 32 bit */
+/*
+ * We need to barrier before modifying the word, since the _atomic_xxx()
+ * routines just tns the lock and then read/modify/write of the word.
+ * But after the word is updated, the routine issues an "mf" before returning,
+ * and since it's a function call, we don't even need a compiler barrier.
+ */
+#define smp_mb__before_atomic()	smp_mb()
+#define smp_mb__after_atomic()	do { } while (0)
+#else /* 64 bit */
+#define smp_mb__before_atomic()	smp_mb()
+#define smp_mb__after_atomic()	smp_mb()
+#endif
+
 #include <asm-generic/barrier.h>
 
 #endif /* !__ASSEMBLY__ */
--- a/arch/tile/include/asm/bitops.h
+++ b/arch/tile/include/asm/bitops.h
@@ -17,6 +17,7 @@
 #define _ASM_TILE_BITOPS_H
 
 #include <linux/types.h>
+#include <asm/barrier.h>
 
 #ifndef _LINUX_BITOPS_H
 #error only <linux/bitops.h> can be included directly
--- a/arch/tile/include/asm/bitops_32.h
+++ b/arch/tile/include/asm/bitops_32.h
@@ -49,8 +49,8 @@ static inline void set_bit(unsigned nr,
  * restricted to acting on a single-word quantity.
  *
  * clear_bit() may not contain a memory barrier, so if it is used for
- * locking purposes, you should call smp_mb__before_clear_bit() and/or
- * smp_mb__after_clear_bit() to ensure changes are visible on other cpus.
+ * locking purposes, you should call smp_mb__before_atomic() and/or
+ * smp_mb__after_atomic() to ensure changes are visible on other cpus.
  */
 static inline void clear_bit(unsigned nr, volatile unsigned long *addr)
 {
@@ -121,10 +121,6 @@ static inline int test_and_change_bit(un
 	return (_atomic_xor(addr, mask) & mask) != 0;
 }
 
-/* See discussion at smp_mb__before_atomic_dec() in <asm/atomic_32.h>. */
-#define smp_mb__before_clear_bit()	smp_mb()
-#define smp_mb__after_clear_bit()	do {} while (0)
-
 #include <asm-generic/bitops/ext2-atomic.h>
 
 #endif /* _ASM_TILE_BITOPS_32_H */
--- a/arch/tile/include/asm/bitops_64.h
+++ b/arch/tile/include/asm/bitops_64.h
@@ -32,10 +32,6 @@ static inline void clear_bit(unsigned nr
 	__insn_fetchand((void *)(addr + nr / BITS_PER_LONG), ~mask);
 }
 
-#define smp_mb__before_clear_bit()	smp_mb()
-#define smp_mb__after_clear_bit()	smp_mb()
-
-
 static inline void change_bit(unsigned nr, volatile unsigned long *addr)
 {
 	unsigned long mask = (1UL << (nr % BITS_PER_LONG));



  parent reply	other threads:[~2014-03-19  6:57 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19  6:47 [PATCH 00/31] Clean up smp_mb__ barriers Peter Zijlstra
2014-03-19  6:47 ` [PATCH 01/31] ia64: Fix up smp_mb__{before,after}_clear_bit Peter Zijlstra
2014-03-19  6:47 ` [PATCH 02/31] arc,hexagon: Delete asm/barrier.h Peter Zijlstra
2014-03-19  6:47 ` [PATCH 03/31] arch: Prepare for smp_mb__{before,after}_atomic() Peter Zijlstra
2014-03-19  6:47 ` [PATCH 04/31] arch,alpha: Convert smp_mb__* Peter Zijlstra
2014-03-19  6:47 ` [PATCH 05/31] arch,arc: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 06/31] arch,arm: " Peter Zijlstra
2014-04-14 16:19   ` Will Deacon
2014-03-19  6:47 ` [PATCH 07/31] arch,arm64: " Peter Zijlstra
2014-03-21 11:54   ` Catalin Marinas
2014-03-19  6:47 ` [PATCH 08/31] arch,avr32: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 09/31] arch,blackfin: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 10/31] arch,c6x: " Peter Zijlstra
2014-04-09 15:35   ` Mark Salter
2014-03-19  6:47 ` [PATCH 11/31] arch,cris: " Peter Zijlstra
2014-03-20 11:11   ` Jesper Nilsson
2014-03-19  6:47 ` [PATCH 12/31] arch,frv: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 13/31] arch,hexagon: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 14/31] arch,ia64: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 15/31] arch,m32r: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 16/31] arch,m68k: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 17/31] arch,metag: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 18/31] arch,mips: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 19/31] arch,mn10300: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 20/31] arch,openrisc: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 21/31] arch,parisc: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 22/31] arch,powerpc: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 23/31] arch,s390: " Peter Zijlstra
2014-03-19 13:50   ` Heiko Carstens
2014-03-19  6:47 ` [PATCH 24/31] arch,score: " Peter Zijlstra
2014-03-19 18:53   ` Lennox Wu
2014-03-19  6:47 ` [PATCH 25/31] arch,sh: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 26/31] arch,sparc: " Peter Zijlstra
2014-03-19 17:54   ` David Miller
2014-03-19  6:47 ` Peter Zijlstra [this message]
2014-03-19 17:49   ` [PATCH 27/31] arch,tile: " Chris Metcalf
2014-03-19 17:49     ` Chris Metcalf
2014-03-19  6:47 ` [PATCH 28/31] arch, x86: " Peter Zijlstra
2014-03-19  6:47 ` [PATCH 29/31] arch,xtensa: " Peter Zijlstra
2014-03-19 13:11   ` Max Filippov
2014-03-19 13:30     ` Peter Zijlstra
2014-03-19  6:47 ` [PATCH 30/31] arch,doc: " Peter Zijlstra
2014-03-19 17:15   ` Paul E. McKenney
2014-03-19  6:48 ` [PATCH 31/31] arch: Mass conversion of smp_mb__* Peter Zijlstra
2014-03-19  9:55 ` [PATCH 00/31] Clean up smp_mb__ barriers David Howells
2014-03-19  9:58   ` Peter Zijlstra
2014-03-19 10:07   ` David Howells
2014-03-19 17:36 ` [PATCH 30/31] arch,doc: Convert smp_mb__* David Howells

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=20140319065205.215604416@infradead.org \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.