lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add ACCESS_ONCE() to avoid compiler splitting assignments
@ 2013-01-15 18:19 Paul E. McKenney
  2013-01-15 23:56 ` [lttng-dev] " Mathieu Desnoyers
  0 siblings, 1 reply; 6+ messages in thread
From: Paul E. McKenney @ 2013-01-15 18:19 UTC (permalink / raw)
  To: lttng-dev, linux-kernel, rp
  Cc: mathieu.desnoyers, laijs, shemminger, stern, khlebnikov

As noted by Konstantin Khlebnikov, gcc can split assignment of
constants to long variables (https://lkml.org/lkml/2013/1/15/141),
though assignment of NULL (0) is OK.  Assuming that a gcc bug is
fixed (http://gcc.gnu.org/bugzilla/attachment.cgi?id=29169&action=diff
has a patch), making the store be volatile keeps gcc from splitting.

This commit therefore applies ACCESS_ONCE() to CMM_STORE_SHARED(),
which is the underlying primitive used by rcu_assign_pointer().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/urcu/system.h b/urcu/system.h
index 2a45f22..7a1887e 100644
--- a/urcu/system.h
+++ b/urcu/system.h
@@ -49,7 +49,7 @@
  */
 #define CMM_STORE_SHARED(x, v)		\
 	({				\
-		__typeof__(x) _v = _CMM_STORE_SHARED(x, v);	\
+		__typeof__(x) CMM_ACCESS_ONCE(_v) = _CMM_STORE_SHARED(x, v);	\
 		cmm_smp_wmc();		\
 		_v;			\
 	})

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

end of thread, other threads:[~2013-01-25 13:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 18:19 [PATCH] Add ACCESS_ONCE() to avoid compiler splitting assignments Paul E. McKenney
2013-01-15 23:56 ` [lttng-dev] " Mathieu Desnoyers
2013-01-16 12:50   ` Mathieu Desnoyers
2013-01-19 19:17     ` Paul E. McKenney
2013-01-20 20:51       ` Mathieu Desnoyers
2013-01-25 13:53         ` Paul E. McKenney

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