From mboxrd@z Thu Jan 1 00:00:00 1970 From: pbonzini@redhat.com (Paolo Bonzini) Date: Thu, 17 Jun 2010 03:55:47 -0400 (EDT) Subject: [ltt-dev] [PATCH tip/core/rcu 1/4] Add header files supporting gcc __sync_ primitives In-Reply-To: <1276750080-9086-1-git-send-email-paulmck@linux.vnet.ibm.com> Message-ID: <1936029737.362931276761347025.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com> +#define CACHE_LINE_SIZE 128 +#define mb() __sync_synchronize() These are provided by arch_generic.h, aren't they? In particular, CACHE_LINE_SIZE should be updated there from 64 to 128 if we deem that value to be better. diff --git a/urcu/uatomic_arch_gcc.h b/urcu/uatomic_arch_gcc.h new file mode 100644 index 0000000..df208bd --- /dev/null +++ b/urcu/uatomic_arch_gcc.h @@ -0,0 +1,48 @@ +/* xchg */ +#define uatomic_xchg(addr, v) __sync_lock_test_and_set(addr, v) __sync_lock_test_and_set may only support v==1, and is only an acquire barrier, so I think it's better to just use the definition in uatomic_arch_generic.h. +/* cmpxchg */ +#define uatomic_cmpxchg(addr, old, _new) \ + __sync_val_compare_and_swap(addr, old, _new) + +/* uatomic_add_return */ +#define uatomic_add_return(addr, v) __sync_add_and_fetch(addr, v) These are also provided by uatomic_arch_generic.h. Paolo