netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/24] make atomic_read() behave consistently on frv
@ 2007-08-09 13:41 Chris Snook
  2007-08-09 16:54 ` Chris Snook
  2007-08-10  9:23 ` David Howells
  0 siblings, 2 replies; 30+ messages in thread
From: Chris Snook @ 2007-08-09 13:41 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>

Make atomic_read() volatile on frv.  This ensures that busy-waiting
for an interrupt handler to change an atomic_t won't get compiled to an
infinite loop, consistent with SMP architectures.

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

--- linux-2.6.23-rc2-orig/include/asm-frv/atomic.h	2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.23-rc2/include/asm-frv/atomic.h	2007-08-09 06:41:48.000000000 -0400
@@ -40,7 +40,12 @@ typedef struct {
 } atomic_t;
 
 #define ATOMIC_INIT(i)		{ (i) }
-#define atomic_read(v)		((v)->counter)
+
+/*
+ * 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)
 #define atomic_set(v, i)	(((v)->counter) = (i))
 
 #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS

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

end of thread, other threads:[~2007-08-16  2:27 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 13:41 [PATCH 6/24] make atomic_read() behave consistently on frv Chris Snook
2007-08-09 16:54 ` Chris Snook
2007-08-10  9:23 ` David Howells
2007-08-10 19:54   ` Chris Snook
2007-08-11  0:54     ` Herbert Xu
2007-08-11  4:29       ` Paul E. McKenney
2007-08-13  5:15         ` Herbert Xu
2007-08-13  6:03           ` Paul E. McKenney
2007-08-14  5:34             ` Nick Piggin
2007-08-14  7:26               ` Herbert Xu
2007-08-14 17:01               ` Paul E. McKenney
2007-08-14 22:01                 ` Arnd Bergmann
2007-08-14 22:43                   ` Paul E. McKenney
2007-08-15 13:29                     ` Arnd Bergmann
2007-08-15 15:06                       ` Michael Buesch
2007-08-15 13:30                 ` Nick Piggin
2007-08-15 20:15                   ` Paul E. McKenney
2007-08-16  1:09                     ` Nick Piggin
2007-08-16  2:27                       ` Paul E. McKenney
2007-08-11  8:47   ` David Howells
2007-08-13  6:44     ` Chris Snook
2007-08-14  5:42       ` Nick Piggin
2007-08-15 18:51         ` Segher Boessenkool
2007-08-15 19:18           ` Paul E. McKenney
2007-08-15 19:46             ` Segher Boessenkool
2007-08-15 19:59               ` Paul E. McKenney
2007-08-15 20:13                 ` Segher Boessenkool
2007-08-15 20:38                   ` Paul E. McKenney
2007-08-15 21:15                     ` Segher Boessenkool
2007-08-16  1:20                       ` Nick Piggin

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