From: Mathieu Desnoyers Date: Wed, 17 Aug 2011 20:42:20 +0000 (-0400) Subject: Create per RCU flavor CDS libraries X-Git-Tag: v0.6.5~50 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d4b99c015229978810319cfd42e1c9763772fad8;p=userspace-rcu.git Create per RCU flavor CDS libraries Introduce per-flavor concurrent data structure libraries for data structures depending on RCU: liburcu-cds: memb flavor (default), matches -lurcu liburcu-cds-qsbr: qsbr flavor, matches -lurcu-qsbr liburcu-cds-mb: mb flavor, matches -lurcu-mb liburcu-cds-signal, matches -lurcu-signal liburcu-cds-bp, matches -lurcu-bp liburcu-cds-common: Data structures not depending on RCU for synchronization. Signed-off-by: Mathieu Desnoyers --- diff --git a/Makefile.am b/Makefile.am index 5869c5e..cc25362 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,28 +33,39 @@ if COMPAT_FUTEX COMPAT+=compat_futex.c endif -lib_LTLIBRARIES = liburcu-cds.la liburcu.la liburcu-qsbr.la \ - liburcu-mb.la liburcu-signal.la liburcu-bp.la +lib_LTLIBRARIES = liburcu.la liburcu-qsbr.la \ + liburcu-mb.la liburcu-signal.la liburcu-bp.la \ + liburcu-cds.la liburcu-cds-qsbr.la \ + liburcu-cds-mb.la liburcu-cds-signal.la liburcu-cds-bp.la \ + liburcu-cds-common.la -liburcu_cds_la_SOURCES = wfqueue.c wfstack.c rculfqueue.c rculfstack.c \ - $(COMPAT) +liburcu_cds_common_la_SOURCES = wfqueue.c wfstack.c $(COMPAT) liburcu_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT) -liburcu_la_LIBADD = liburcu-cds.la +liburcu_la_LIBADD = liburcu-cds-common.la +liburcu_cds_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT) liburcu_qsbr_la_SOURCES = urcu-qsbr.c urcu-pointer.c $(COMPAT) -liburcu_qsbr_la_LIBADD = liburcu-cds.la +liburcu_qsbr_la_LIBADD = liburcu-cds-common.la +liburcu_cds_qsbr_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT) +liburcu_cds_qsbr_la_CFLAGS = -DRCU_QSBR liburcu_mb_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT) liburcu_mb_la_CFLAGS = -DRCU_MB -liburcu_mb_la_LIBADD = liburcu-cds.la +liburcu_mb_la_LIBADD = liburcu-cds-common.la +liburcu_cds_mb_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT) +liburcu_cds_mb_la_CFLAGS = -DRCU_MB liburcu_signal_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT) liburcu_signal_la_CFLAGS = -DRCU_SIGNAL -liburcu_signal_la_LIBADD = liburcu-cds.la +liburcu_signal_la_LIBADD = liburcu-cds-common.la +liburcu_cds_signal_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT) +liburcu_cds_signal_la_CFLAGS = -DRCU_SIGNAL liburcu_bp_la_SOURCES = urcu-bp.c urcu-pointer.c $(COMPAT) -liburcu_bp_la_LIBADD = liburcu-cds.la +liburcu_bp_la_LIBADD = liburcu-cds-common.la +liburcu_cds_bp_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT) +liburcu_cds_bp_la_CFLAGS = -DRCU_BP pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = liburcu-cds.pc liburcu.pc liburcu-bp.pc liburcu-qsbr.pc \ diff --git a/rculfqueue.c b/rculfqueue.c index 09ba9cf..09b8587 100644 --- a/rculfqueue.c +++ b/rculfqueue.c @@ -21,8 +21,14 @@ */ #define _LGPL_SOURCE -/* Use the urcu symbols to select the appropriate rcu flavor at link time */ -#include "urcu.h" + +#ifdef RCU_QSBR +# include "urcu-qsbr.h" +#elif defined(RCU_BP) +# include "urcu-bp.h" +#else +# include "urcu.h" +#endif #undef _LGPL_SOURCE /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ diff --git a/rculfstack.c b/rculfstack.c index 4a3041d..aa906af 100644 --- a/rculfstack.c +++ b/rculfstack.c @@ -22,7 +22,14 @@ /* Use the urcu symbols to select the appropriate rcu flavor at link time */ #define _LGPL_SOURCE -#include "urcu.h" + +#ifdef RCU_QSBR +# include "urcu-qsbr.h" +#elif defined(RCU_BP) +# include "urcu-bp.h" +#else +# include "urcu.h" +#endif #undef _LGPL_SOURCE /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ diff --git a/tests/Makefile.am b/tests/Makefile.am index 52b6ff9..a013c3a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -38,11 +38,16 @@ URCU_BP=$(top_srcdir)/urcu-bp.c $(top_srcdir)/urcu-pointer.c $(top_srcdir)/wfque URCU_DEFER=$(top_srcdir)/urcu.c $(top_srcdir)/urcu-pointer.c $(top_srcdir)/wfqueue.c $(COMPAT) URCU_LIB=$(top_builddir)/liburcu.la +URCU_CDS_LIB=$(top_builddir)/liburcu-cds.la URCU_QSBR_LIB=$(top_builddir)/liburcu-qsbr.la +URCU_CDS_QSBR_LIB=$(top_builddir)/liburcu-cds-qsbr.la URCU_MB_LIB=$(top_builddir)/liburcu-mb.la +URCU_CDS_MB_LIB=$(top_builddir)/liburcu-cds-mb.la URCU_SIGNAL_LIB=$(top_builddir)/liburcu-signal.la +URCU_CDS_SIGNAL_LIB=$(top_builddir)/liburcu-cds-signal.la URCU_BP_LIB=$(top_builddir)/liburcu-bp.la -URCU_CDS_LIB=$(top_builddir)/liburcu-cds.la +URCU_CDS_BP_LIB=$(top_builddir)/liburcu-cds-bp.la +URCU_CDS_COMMON_LIB=$(top_builddir)/liburcu-cds-common.la EXTRA_DIST = $(top_srcdir)/tests/api.h @@ -92,23 +97,23 @@ test_perthreadlock_SOURCES = test_perthreadlock.c $(URCU_SIGNAL) rcutorture_urcu_SOURCES = urcutorture.c rcutorture_urcu_CFLAGS = -DRCU_MEMBARRIER $(AM_CFLAGS) -rcutorture_urcu_LDADD = $(URCU) $(URCU_CDS_LIB) +rcutorture_urcu_LDADD = $(URCU) rcutorture_urcu_mb_SOURCES = urcutorture.c rcutorture_urcu_mb_CFLAGS = -DRCU_MB $(AM_CFLAGS) -rcutorture_urcu_mb_LDADD = $(URCU_MB_LIB) $(URCU_CDS_LIB) +rcutorture_urcu_mb_LDADD = $(URCU_MB_LIB) rcutorture_qsbr_SOURCES = urcutorture.c rcutorture_qsbr_CFLAGS = -DTORTURE_QSBR -DRCU_QSBR $(AM_CFLAGS) -rcutorture_qsbr_LDADD = $(URCU_QSBR_LIB) $(URCU_CDS_LIB) +rcutorture_qsbr_LDADD = $(URCU_QSBR_LIB) rcutorture_urcu_signal_SOURCES = urcutorture.c rcutorture_urcu_signal_CFLAGS = -DRCU_SIGNAL $(AM_CFLAGS) -rcutorture_urcu_signal_LDADD = $(URCU_SIGNAL_LIB) $(URCU_CDS_LIB) +rcutorture_urcu_signal_LDADD = $(URCU_SIGNAL_LIB) rcutorture_urcu_bp_SOURCES = urcutorture.c rcutorture_urcu_bp_CFLAGS = -DRCU_BP $(AM_CFLAGS) -rcutorture_urcu_bp_LDADD = $(URCU_BP_LIB) $(URCU_CDS_LIB) +rcutorture_urcu_bp_LDADD = $(URCU_BP_LIB) test_mutex_SOURCES = test_mutex.c $(URCU) @@ -155,25 +160,25 @@ test_urcu_bp_SOURCES = test_urcu_bp.c $(URCU_BP) test_urcu_bp_dynamic_link_SOURCES = test_urcu_bp.c $(URCU_BP) test_urcu_bp_dynamic_link_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) -test_urcu_lfq_SOURCES = test_urcu_lfq.c $(URCU) +test_urcu_lfq_SOURCES = test_urcu_lfq.c $(URCU) $(URCU_CDS_LIB) test_urcu_lfq_dynlink_SOURCES = test_urcu_lfq.c $(URCU) test_urcu_lfq_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) test_urcu_lfq_dynlink_LDADD = $(URCU_CDS_LIB) -test_urcu_wfq_SOURCES = test_urcu_wfq.c $(COMPAT) +test_urcu_wfq_SOURCES = test_urcu_wfq.c $(URCU_CDS_COMMON_LIB) $(COMPAT) test_urcu_wfq_dynlink_SOURCES = test_urcu_wfq.c test_urcu_wfq_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) -test_urcu_wfq_dynlink_LDADD = $(URCU_CDS_LIB) +test_urcu_wfq_dynlink_LDADD = $(URCU_CDS_COMMON_LIB) -test_urcu_lfs_SOURCES = test_urcu_lfs.c $(URCU_DEFER) +test_urcu_lfs_SOURCES = test_urcu_lfs.c $(URCU_CDS_LIB) $(URCU_DEFER) test_urcu_lfs_dynlink_SOURCES = test_urcu_lfs.c $(URCU_DEFER) test_urcu_lfs_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) test_urcu_lfs_dynlink_LDADD = $(URCU_CDS_LIB) -test_urcu_wfs_SOURCES = test_urcu_wfs.c $(COMPAT) +test_urcu_wfs_SOURCES = test_urcu_wfs.c $(URCU_CDS_COMMON_LIB) $(COMPAT) test_urcu_wfs_dynlink_SOURCES = test_urcu_wfs.c test_urcu_wfs_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS) -test_urcu_wfs_dynlink_LDADD = $(URCU_CDS_LIB) +test_urcu_wfs_dynlink_LDADD = $(URCU_CDS_COMMON_LIB) urcutorture.c: api.h diff --git a/urcu/map/urcu-bp.h b/urcu/map/urcu-bp.h index 4abe8dc..f62b5b3 100644 --- a/urcu/map/urcu-bp.h +++ b/urcu/map/urcu-bp.h @@ -64,4 +64,16 @@ #define rcu_defer_barrier rcu_defer_barrier_bp #define rcu_defer_barrier_thread rcu_defer_barrier_thread_bp +/* Concurrent Data Structures */ +#define cds_lfq_node_init_rcu cds_lfq_node_init_rcu_bp +#define cds_lfq_init_rcu cds_lfq_init_rcu_bp +#define cds_lfq_destroy_rcu cds_lfq_destroy_rcu_bp +#define cds_lfq_enqueue_rcu cds_lfq_enqueue_rcu_bp +#define cds_lfq_dequeue_rcu cds_lfq_dequeue_rcu_bp + +#define cds_lfs_node_init_rcu cds_lfs_node_init_rcu_bp +#define cds_lfs_init_rcu cds_lfs_init_rcu_bp +#define cds_lfs_push_rcu cds_lfs_push_rcu_bp +#define cds_lfs_pop_rcu cds_lfs_pop_rcu_bp + #endif /* _URCU_BP_MAP_H */ diff --git a/urcu/map/urcu-qsbr.h b/urcu/map/urcu-qsbr.h index 0d88d83..6e4a196 100644 --- a/urcu/map/urcu-qsbr.h +++ b/urcu/map/urcu-qsbr.h @@ -66,4 +66,16 @@ #define rcu_defer_barrier rcu_defer_barrier_qsbr #define rcu_defer_barrier_thread rcu_defer_barrier_thread_qsbr +/* Concurrent Data Structures */ +#define cds_lfq_node_init_rcu cds_lfq_node_init_rcu_qsbr +#define cds_lfq_init_rcu cds_lfq_init_rcu_qsbr +#define cds_lfq_destroy_rcu cds_lfq_destroy_rcu_qsbr +#define cds_lfq_enqueue_rcu cds_lfq_enqueue_rcu_qsbr +#define cds_lfq_dequeue_rcu cds_lfq_dequeue_rcu_qsbr + +#define cds_lfs_node_init_rcu cds_lfs_node_init_rcu_qsbr +#define cds_lfs_init_rcu cds_lfs_init_rcu_qsbr +#define cds_lfs_push_rcu cds_lfs_push_rcu_qsbr +#define cds_lfs_pop_rcu cds_lfs_pop_rcu_qsbr + #endif /* _URCU_QSBR_MAP_H */ diff --git a/urcu/map/urcu.h b/urcu/map/urcu.h index 5942fad..ea12f34 100644 --- a/urcu/map/urcu.h +++ b/urcu/map/urcu.h @@ -70,6 +70,18 @@ #define rcu_defer_barrier rcu_defer_barrier_memb #define rcu_defer_barrier_thread rcu_defer_barrier_thread_memb +/* Concurrent Data Structures */ +#define cds_lfq_node_init_rcu cds_lfq_node_init_rcu_memb +#define cds_lfq_init_rcu cds_lfq_init_rcu_memb +#define cds_lfq_destroy_rcu cds_lfq_destroy_rcu_memb +#define cds_lfq_enqueue_rcu cds_lfq_enqueue_rcu_memb +#define cds_lfq_dequeue_rcu cds_lfq_dequeue_rcu_memb + +#define cds_lfs_node_init_rcu cds_lfs_node_init_rcu_memb +#define cds_lfs_init_rcu cds_lfs_init_rcu_memb +#define cds_lfs_push_rcu cds_lfs_push_rcu_memb +#define cds_lfs_pop_rcu cds_lfs_pop_rcu_memb + #elif defined(RCU_SIGNAL) #define rcu_read_lock rcu_read_lock_sig @@ -102,6 +114,18 @@ #define rcu_defer_barrier rcu_defer_barrier_sig #define rcu_defer_barrier_thread rcu_defer_barrier_thread_sig +/* Concurrent Data Structures */ +#define cds_lfq_node_init_rcu cds_lfq_node_init_rcu_sig +#define cds_lfq_init_rcu cds_lfq_init_rcu_sig +#define cds_lfq_destroy_rcu cds_lfq_destroy_rcu_sig +#define cds_lfq_enqueue_rcu cds_lfq_enqueue_rcu_sig +#define cds_lfq_dequeue_rcu cds_lfq_dequeue_rcu_sig + +#define cds_lfs_node_init_rcu cds_lfs_node_init_rcu_sig +#define cds_lfs_init_rcu cds_lfs_init_rcu_sig +#define cds_lfs_push_rcu cds_lfs_push_rcu_sig +#define cds_lfs_pop_rcu cds_lfs_pop_rcu_sig + #elif defined(RCU_MB) #define rcu_read_lock rcu_read_lock_mb @@ -134,6 +158,18 @@ #define rcu_defer_barrier rcu_defer_barrier_mb #define rcu_defer_barrier_thread rcu_defer_barrier_thread_mb +/* Concurrent Data Structures */ +#define cds_lfq_node_init_rcu cds_lfq_node_init_rcu_mb +#define cds_lfq_init_rcu cds_lfq_init_rcu_mb +#define cds_lfq_destroy_rcu cds_lfq_destroy_rcu_mb +#define cds_lfq_enqueue_rcu cds_lfq_enqueue_rcu_mb +#define cds_lfq_dequeue_rcu cds_lfq_dequeue_rcu_mb + +#define cds_lfs_node_init_rcu cds_lfs_node_init_rcu_mb +#define cds_lfs_init_rcu cds_lfs_init_rcu_mb +#define cds_lfs_push_rcu cds_lfs_push_rcu_mb +#define cds_lfs_pop_rcu cds_lfs_pop_rcu_mb + #else #error "Undefined selection" diff --git a/urcu/rculfqueue.h b/urcu/rculfqueue.h index 598fa50..e1d64f1 100644 --- a/urcu/rculfqueue.h +++ b/urcu/rculfqueue.h @@ -47,11 +47,35 @@ struct cds_lfq_queue_rcu { #include -#define cds_lfq_node_init_rcu _cds_lfq_node_init_rcu -#define cds_lfq_init_rcu _cds_lfq_init_rcu -#define cds_lfq_destroy_rcu _cds_lfq_destroy_rcu -#define cds_lfq_enqueue_rcu _cds_lfq_enqueue_rcu -#define cds_lfq_dequeue_rcu _cds_lfq_dequeue_rcu +#define cds_lfq_node_init_rcu_qsbr _cds_lfq_node_init_rcu +#define cds_lfq_init_rcu_qsbr _cds_lfq_init_rcu +#define cds_lfq_destroy_rcu_qsbr _cds_lfq_destroy_rcu +#define cds_lfq_enqueue_rcu_qsbr _cds_lfq_enqueue_rcu +#define cds_lfq_dequeue_rcu_qsbr _cds_lfq_dequeue_rcu + +#define cds_lfq_node_init_rcu_bp _cds_lfq_node_init_rcu +#define cds_lfq_init_rcu_bp _cds_lfq_init_rcu +#define cds_lfq_destroy_rcu_bp _cds_lfq_destroy_rcu +#define cds_lfq_enqueue_rcu_bp _cds_lfq_enqueue_rcu +#define cds_lfq_dequeue_rcu_bp _cds_lfq_dequeue_rcu + +#define cds_lfq_node_init_rcu_memb _cds_lfq_node_init_rcu +#define cds_lfq_init_rcu_memb _cds_lfq_init_rcu +#define cds_lfq_destroy_rcu_memb _cds_lfq_destroy_rcu +#define cds_lfq_enqueue_rcu_memb _cds_lfq_enqueue_rcu +#define cds_lfq_dequeue_rcu_memb _cds_lfq_dequeue_rcu + +#define cds_lfq_node_init_rcu_mb _cds_lfq_node_init_rcu +#define cds_lfq_init_rcu_mb _cds_lfq_init_rcu +#define cds_lfq_destroy_rcu_mb _cds_lfq_destroy_rcu +#define cds_lfq_enqueue_rcu_mb _cds_lfq_enqueue_rcu +#define cds_lfq_dequeue_rcu_mb _cds_lfq_dequeue_rcu + +#define cds_lfq_node_init_rcu_sig _cds_lfq_node_init_rcu +#define cds_lfq_init_rcu_sig _cds_lfq_init_rcu +#define cds_lfq_destroy_rcu_sig _cds_lfq_destroy_rcu +#define cds_lfq_enqueue_rcu_sig _cds_lfq_enqueue_rcu +#define cds_lfq_dequeue_rcu_sig _cds_lfq_dequeue_rcu #else /* !_LGPL_SOURCE */ diff --git a/urcu/rculfstack.h b/urcu/rculfstack.h index 75a580b..ad83dbe 100644 --- a/urcu/rculfstack.h +++ b/urcu/rculfstack.h @@ -39,10 +39,30 @@ struct cds_lfs_stack_rcu { #include -#define cds_lfs_node_init_rcu _cds_lfs_node_init_rcu -#define cds_lfs_init_rcu _cds_lfs_init_rcu -#define cds_lfs_push_rcu _cds_lfs_push_rcu -#define cds_lfs_pop_rcu _cds_lfs_pop_rcu +#define cds_lfs_node_init_rcu_qsbr _cds_lfs_node_init_rcu +#define cds_lfs_init_rcu_qsbr _cds_lfs_init_rcu +#define cds_lfs_push_rcu_qsbr _cds_lfs_push_rcu +#define cds_lfs_pop_rcu_qsbr _cds_lfs_pop_rcu + +#define cds_lfs_node_init_rcu_bp _cds_lfs_node_init_rcu +#define cds_lfs_init_rcu_bp _cds_lfs_init_rcu +#define cds_lfs_push_rcu_bp _cds_lfs_push_rcu +#define cds_lfs_pop_rcu_bp _cds_lfs_pop_rcu + +#define cds_lfs_node_init_rcu_memb _cds_lfs_node_init_rcu +#define cds_lfs_init_rcu_memb _cds_lfs_init_rcu +#define cds_lfs_push_rcu_memb _cds_lfs_push_rcu +#define cds_lfs_pop_rcu_memb _cds_lfs_pop_rcu + +#define cds_lfs_node_init_rcu_mb _cds_lfs_node_init_rcu +#define cds_lfs_init_rcu_mb _cds_lfs_init_rcu +#define cds_lfs_push_rcu_mb _cds_lfs_push_rcu +#define cds_lfs_pop_rcu_mb _cds_lfs_pop_rcu + +#define cds_lfs_node_init_rcu_sig _cds_lfs_node_init_rcu +#define cds_lfs_init_rcu_sig _cds_lfs_init_rcu +#define cds_lfs_push_rcu_sig _cds_lfs_push_rcu +#define cds_lfs_pop_rcu_sig _cds_lfs_pop_rcu #else /* !_LGPL_SOURCE */