All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] x86: Use volatile semantics for atomic_set()
@ 2014-09-22 19:39 Pranith Kumar
  2014-09-22 20:08 ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Pranith Kumar @ 2014-09-22 19:39 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	maintainer:X86 ARCHITECTURE..., Peter Zijlstra, Paul E. McKenney,
	open list:X86 ARCHITECTURE...

All the atomic operations have volatile semantics to prevent compiler
reordering. Enforce the same semantics for atomic_set() too.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 arch/x86/include/asm/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index bf20c81..fa92e93 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -36,7 +36,7 @@ static inline int atomic_read(const atomic_t *v)
  */
 static inline void atomic_set(atomic_t *v, int i)
 {
-	v->counter = i;
+	ACCESS_ONCE(v->counter) = i;
 }
 
 /**
-- 
2.1.0


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

end of thread, other threads:[~2014-09-23  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-22 19:39 [RFC PATCH] x86: Use volatile semantics for atomic_set() Pranith Kumar
2014-09-22 20:08 ` Peter Zijlstra
2014-09-22 21:42   ` Pranith Kumar
2014-09-23  8:12     ` Peter Zijlstra

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.