netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/24] make atomic_read() behave consistently on alpha
@ 2007-08-09 13:24 Chris Snook
  2007-08-09 14:32 ` Paul E. McKenney
  0 siblings, 1 reply; 36+ messages in thread
From: Chris Snook @ 2007-08-09 13:24 UTC (permalink / raw)
  To: linux-kernel, linux-arch, torvalds
  Cc: netdev, akpm, ak, heiko.carstens, davem, schwidefsky, wensong,
	horms, wjiang, cfriesen, zlynx, rpjday, jesper.juhl

From: Chris Snook <csnook@redhat.com>

Purify volatile use for atomic[64]_t on alpha.

Signed-off-by: Chris Snook <csnook@redhat.com>

--- linux-2.6.23-rc2-orig/include/asm-alpha/atomic.h	2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.23-rc2/include/asm-alpha/atomic.h	2007-08-09 09:19:00.000000000 -0400
@@ -14,18 +14,22 @@
 
 
 /*
- * Counter is volatile to make sure gcc doesn't try to be clever
- * and move things around on us. We need to use _exactly_ the address
- * the user gave us, not some alias that contains the same information.
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
  */
-typedef struct { volatile int counter; } atomic_t;
-typedef struct { volatile long counter; } atomic64_t;
+typedef struct { int counter; } atomic_t;
+typedef struct { long counter; } atomic64_t;
 
 #define ATOMIC_INIT(i)		( (atomic_t) { (i) } )
 #define ATOMIC64_INIT(i)	( (atomic64_t) { (i) } )
 
-#define atomic_read(v)		((v)->counter + 0)
-#define atomic64_read(v)	((v)->counter + 0)
+/*
+ * Casting to volatile here minimizes the need for barriers,
+ * without having to declare the type itself as volatile.
+ */
+#define atomic_read(v)		(*(volatile int *)&(v)->counter + 0)
+#define atomic64_read(v)	(*(volatile long *)&(v)->counter + 0)
 
 #define atomic_set(v,i)		((v)->counter = (i))
 #define atomic64_set(v,i)	((v)->counter = (i))

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2007-08-11  4:38 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 13:24 [PATCH 1/24] make atomic_read() behave consistently on alpha Chris Snook
2007-08-09 14:32 ` Paul E. McKenney
2007-08-09 14:53   ` Chris Snook
2007-08-09 15:04     ` Paul E. McKenney
2007-08-09 15:24       ` Chris Snook
2007-08-09 15:50         ` Segher Boessenkool
2007-08-09 16:20           ` Chris Snook
2007-08-09 18:38             ` Segher Boessenkool
2007-08-09 19:05               ` Chris Snook
2007-08-09 19:19                 ` Segher Boessenkool
2007-08-09 19:25                 ` Geert Uytterhoeven
2007-08-09 19:47                   ` Chris Snook
2007-08-09 23:02                     ` Segher Boessenkool
2007-08-09 16:10         ` Paul E. McKenney
2007-08-09 16:36           ` Chris Snook
2007-08-09 16:58             ` Paul E. McKenney
2007-08-09 17:14               ` Chris Snook
2007-08-09 17:41                 ` Paul E. McKenney
2007-08-09 18:13                   ` Chris Snook
2007-08-09 18:45                     ` Paul E. McKenney
2007-08-09 19:24                       ` Chris Snook
2007-08-10  1:28                         ` Paul E. McKenney
2007-08-10 19:49                           ` Chris Snook
2007-08-10 20:26                             ` Paul E. McKenney
2007-08-09 19:17                 ` Segher Boessenkool
2007-08-09 18:51             ` Segher Boessenkool
2007-08-09 19:30               ` Chris Snook
2007-08-10  8:21           ` Herbert Xu
2007-08-10  9:08             ` Andi Kleen
2007-08-10 15:02               ` Paul E. McKenney
2007-08-10 20:07             ` Segher Boessenkool
2007-08-11  0:00               ` Herbert Xu
2007-08-11  0:38                 ` Segher Boessenkool
2007-08-11  0:43                   ` Herbert Xu
2007-08-11  0:50                     ` Segher Boessenkool
2007-08-11  4:38                   ` Valdis.Kletnieks

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).