From: Mathieu Desnoyers Date: Mon, 5 Dec 2011 23:37:50 +0000 (-0500) Subject: Merge branch 'master' into urcu/ht-shrink X-Git-Tag: v0.7.0~43^2~21 X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=commitdiff_plain;h=6e464eba97cf74320fe4e2b8da6dbe5039582948;hp=5a2141a73185fb1aaaceb73f8239a7efb81c16e6 Merge branch 'master' into urcu/ht-shrink Conflicts: Makefile.am urcu-bp.c --- diff --git a/ChangeLog b/ChangeLog index 30e7b41..b387acd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-11-03 Userspace RCU 0.6.6 + * qsbr vs call_rcu : remove exit assertion + * Rename likely/unlikely to caa_likely/caa_unlikely + * Reinsert missing test_urcu_*.c files (missing in rename) + * rename test_qsbr to test_urcu_qsbr + * urcu-pointer: fix rcu_set_pointer unset return value + * Enhance API.txt documentation, add to Makefile as EXTRA_DIST + 2011-09-29 Userspace RCU 0.6.5 * call_rcu: Document call_rcu requirements * call_rcu: fix error handling of malloc error diff --git a/Makefile.am b/Makefile.am index 91a9fd1..e1bf095 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,8 @@ EXTRA_DIST = $(top_srcdir)/urcu/arch/*.h $(top_srcdir)/urcu/uatomic/*.h \ README LICENSE compat_arch_x86.c \ urcu-call-rcu-impl.h urcu-defer-impl.h \ rculfhash-internal.h \ - ChangeLog API.txt + ChangeLog API.txt \ + $(top_srcdir)/tests/*.sh if COMPAT_ARCH COMPAT=compat_arch_@ARCHTYPE@.c diff --git a/README b/README index e3800fa..ce25e3a 100644 --- a/README +++ b/README @@ -44,6 +44,21 @@ supported, with the following exceptions: - Alpha, ia64 and ARM architectures depend on 4.x gcc with atomic builtins support. +For developers using the git tree: + +This source tree is based on the autotools suite from GNU to simplify +portability. Here are some things you should have on your system in order to +compile the git repository tree : + +- GNU autotools (automake >=1.10, autoconf >=2.50, autoheader >=2.50) + (make sure your system wide "automake" points to a recent version!) +- GNU Libtool >=2.2 + (for more information, go to http://www.gnu.org/software/autoconf/) + +If you get the tree from the repository, you will need to use the "bootstrap" +script in the root of the tree. It calls all the GNU tools needed to prepare the +tree configuration. + QUICK START GUIDE ----------------- diff --git a/configure.ac b/configure.ac index 68dc190..ce06254 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([userspace-rcu], [0.6.5], [mathieu dot desnoyers at efficios dot com]) +AC_INIT([userspace-rcu],[0.6.6],[mathieu dot desnoyers at efficios dot com]) # Following the numbering scheme proposed by libtool for the library version # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html @@ -30,7 +30,7 @@ AH_TEMPLATE([CONFIG_RCU_ARM_HAVE_DMB], [Use the dmb instruction is available for # Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET -AC_PROG_LIBTOOL +LT_INIT # Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE @@ -48,6 +48,7 @@ case $host_cpu in i486) ARCHTYPE="x86";; i586) ARCHTYPE="x86";; i686) ARCHTYPE="x86";; + amd64) ARCHTYPE="x86";; x86_64) ARCHTYPE="x86";; powerpc) ARCHTYPE="ppc" ;; ppc64) ARCHTYPE="ppc" ;; @@ -64,21 +65,17 @@ esac if test "x$ARCHTYPE" = "xarm" ; then AC_MSG_CHECKING([checking for dmb instruction]) -AC_TRY_COMPILE( -[ -], -[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +]], [[ asm volatile("dmb":::"memory"); -], -[ +]])],[ AC_MSG_RESULT([yes]) AC_DEFINE([CONFIG_RCU_ARM_HAVE_DMB], [1]) -] -, -[ + +],[ AC_MSG_RESULT([no]) -] -) + +]) fi UATOMICSRC=urcu/uatomic/$ARCHTYPE.h @@ -103,26 +100,22 @@ fi ] AC_MSG_CHECKING([sys_futex()]) -AC_TRY_COMPILE( -[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include -], -[ +]], [[ #ifndef __NR_futex #error "futexes not available" #endif -], -[ +]])],[ AC_MSG_RESULT([yes]) AC_DEFINE([CONFIG_RCU_HAVE_FUTEX], [1]) compat_futex_test=0 -] -, -[ + +],[ AC_MSG_RESULT([no]) compat_futex_test=1 -] -) + +]) AM_CONDITIONAL([COMPAT_FUTEX], [ test "x$compat_futex_test" = "x1" ]) diff --git a/urcu-bp.c b/urcu-bp.c index 3b2062d..912e9b2 100644 --- a/urcu-bp.c +++ b/urcu-bp.c @@ -421,6 +421,29 @@ void rcu_bp_after_fork_child(void) assert(!ret); } +void *rcu_dereference_sym_bp(void *p) +{ + return _rcu_dereference(p); +} + +void *rcu_set_pointer_sym_bp(void **p, void *v) +{ + cmm_wmb(); + return uatomic_set(p, v); +} + +void *rcu_xchg_pointer_sym_bp(void **p, void *v) +{ + cmm_wmb(); + return uatomic_xchg(p, v); +} + +void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new) +{ + cmm_wmb(); + return uatomic_cmpxchg(p, old, _new); +} + DEFINE_RCU_FLAVOR() #include "urcu-call-rcu-impl.h" diff --git a/urcu-bp.h b/urcu-bp.h index efb5dca..3623f35 100644 --- a/urcu-bp.h +++ b/urcu-bp.h @@ -37,12 +37,6 @@ #include #include -/* - * See urcu-pointer.h and urcu/static/urcu-pointer.h for pointer - * publication headers. - */ -#include - #ifdef __cplusplus extern "C" { #endif @@ -57,6 +51,12 @@ extern "C" { * rcu_unregister_thread() should be called before the thread exits. */ +/* + * See urcu-pointer.h and urcu/static/urcu-pointer.h for pointer + * publication headers. + */ +#include + #ifdef _LGPL_SOURCE #include @@ -75,6 +75,11 @@ extern "C" { #define rcu_read_lock_bp _rcu_read_lock #define rcu_read_unlock_bp _rcu_read_unlock +#define rcu_dereference_bp rcu_dereference +#define rcu_cmpxchg_pointer_bp rcu_cmpxchg_pointer +#define rcu_xchg_pointer_bp rcu_xchg_pointer +#define rcu_set_pointer_bp rcu_set_pointer + #else /* !_LGPL_SOURCE */ /* @@ -82,8 +87,54 @@ extern "C" { * See LGPL-only urcu/static/urcu-pointer.h for documentation. */ -extern void rcu_read_lock(void); -extern void rcu_read_unlock(void); +extern void rcu_read_lock(void) + __attribute__((weak)); +extern void rcu_read_unlock(void) + __attribute__((weak)); + +extern void *rcu_dereference_sym_bp(void *p) + __attribute__((weak)); +#define rcu_dereference_bp(p) \ + ({ \ + typeof(p) _________p1 = URCU_FORCE_CAST(typeof(p), \ + rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \ + (_________p1); \ + }) + +extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new) + __attribute__((weak)); +#define rcu_cmpxchg_pointer_bp(p, old, _new) \ + ({ \ + typeof(*(p)) _________pold = (old); \ + typeof(*(p)) _________pnew = (_new); \ + typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \ + rcu_cmpxchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p),\ + _________pold, \ + _________pnew)); \ + (_________p1); \ + }) + +extern void *rcu_xchg_pointer_sym_bp(void **p, void *v) + __attribute__((weak)); +#define rcu_xchg_pointer_bp(p, v) \ + ({ \ + typeof(*(p)) _________pv = (v); \ + typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \ + rcu_xchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ + _________pv)); \ + (_________p1); \ + }) + +extern void *rcu_set_pointer_sym_bp(void **p, void *v) + __attribute__((weak)); +#define rcu_set_pointer_bp(p, v) \ + ({ \ + typeof(*(p)) _________pv = (v); \ + typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \ + rcu_set_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \ + _________pv)); \ + (_________p1); \ + }) #endif /* !_LGPL_SOURCE */ diff --git a/urcu-call-rcu.h b/urcu-call-rcu.h index 8df44ef..b109f4e 100644 --- a/urcu-call-rcu.h +++ b/urcu-call-rcu.h @@ -86,6 +86,8 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp); int create_all_cpu_call_rcu_data(unsigned long flags); void free_all_cpu_call_rcu_data(void); +void call_rcu_before_fork(void); +void call_rcu_after_fork_parent(void); void call_rcu_after_fork_child(void); #ifdef __cplusplus