From b4ce15269d95cb1fc5542d0e192ec593b2222dd5 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 8 Jul 2009 00:13:13 -0400 Subject: [PATCH] Move DEBUG_FULL_MB to properly named CONFIG_URCU_AVOID_SIGNALS Signed-off-by: Mathieu Desnoyers --- Makefile | 12 +++++++----- Makefile64 | 12 +++++++----- README | 10 +++++----- urcu-static.h | 9 ++++++--- urcu.c | 12 ++++++------ 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 658a7fb..98f9c4a 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,9 @@ endif #debug #CFLAGS=-Wall -g -#CFLAGS+=-DDEBUG_FULL_MB + +#Build the library without using signals. Slower read-side. +#CFLAGS+=-DCONFIG_URCU_AVOID_SIGNALS #Changing the signal number used by the library. SIGUSR1 by default. #CFLAGS+=-DSIGURCU=SIGUSR2 @@ -75,19 +77,19 @@ test_looplen: test_looplen.c urcu.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_mb: urcu-mb.o test_urcu.c urcu.h - $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_gc: urcu.o test_urcu_gc.c urcu.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_gc_mb: urcu-mb.o test_urcu_gc.c urcu.h - $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_lgc: urcu.o test_urcu_gc.c urcu.h $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_lgc_mb: urcu-mb.o test_urcu_gc.c urcu.h - $(CC) -DTEST_LOCAL_GC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + $(CC) -DTEST_LOCAL_GC -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_qsbr: urcu-qsbr.o test_qsbr.c urcu-qsbr.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) @@ -129,7 +131,7 @@ urcu.o: urcu.c urcu.h $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) urcu-mb.o: urcu.c urcu.h - $(CC) -fPIC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) + $(CC) -fPIC -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) urcu-qsbr.o: urcu-qsbr.c urcu-qsbr.h $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) diff --git a/Makefile64 b/Makefile64 index 9c65568..ba36fec 100644 --- a/Makefile64 +++ b/Makefile64 @@ -17,7 +17,9 @@ endif #debug #CFLAGS=-m64 -Wall -g -#CFLAGS+=-DDEBUG_FULL_MB + +#Build the library without using signals. Slower read-side. +#CFLAGS+=-DCONFIG_URCU_AVOID_SIGNALS #Changing the signal number used by the library. SIGUSR1 by default. #CFLAGS+=-DSIGURCU=SIGUSR2 @@ -58,19 +60,19 @@ test_looplen: test_looplen.c urcu.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_mb: urcu-mb.o test_urcu.c urcu.h - $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_gc: urcu.o test_urcu_gc.c urcu.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_gc_mb: urcu-mb.o test_urcu_gc.c urcu.h - $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_lgc: urcu.o test_urcu_gc.c urcu.h $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_urcu_lgc_mb: urcu-mb.o test_urcu_gc.c urcu.h - $(CC) -DTEST_LOCAL_GC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + $(CC) -DTEST_LOCAL_GC -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) test_qsbr: urcu-qsbr.o test_qsbr.c urcu-qsbr.h $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) @@ -112,7 +114,7 @@ urcu.o: urcu.c urcu.h $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) urcu-mb.o: urcu.c urcu.h - $(CC) -fPIC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) + $(CC) -fPIC -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) urcu-qsbr.o: urcu-qsbr.c urcu-qsbr.h $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) diff --git a/README b/README index 2fae654..ae8b661 100644 --- a/README +++ b/README @@ -36,16 +36,16 @@ Being careful with signals some non-restartable system calls to fail with errno = EINTR. Care should be taken to restart system calls manually if they fail with this error. A list of non-restartable system calls may be found in - signal(7). + signal(7). To ensure the Userspace RCU library does not use signals, + define CONFIG_URCU_AVOID_SIGNALS at compile-time. -Usage of DEBUG_FULL_MB +Usage of CONFIG_URCU_AVOID_SIGNALS - DEBUG_FULL_MB uses full SMP barriers for readers. This eliminates the - need for signals but results in slower reads. + CONFIG_URCU_AVOID_SIGNALS uses full SMP barriers for readers. This + eliminates the need for signals but results in slower reads. Usage of DEBUG_YIELD DEBUG_YIELD is used to add random delays in the code for testing purposes. - diff --git a/urcu-static.h b/urcu-static.h index 1b3527f..1921097 100644 --- a/urcu-static.h +++ b/urcu-static.h @@ -117,8 +117,11 @@ #define YIELD_READ (1 << 0) #define YIELD_WRITE (1 << 1) -/* Updates without DEBUG_FULL_MB are much slower. Account this in the delay */ -#ifdef DEBUG_FULL_MB +/* + * Updates without CONFIG_URCU_AVOID_SIGNALS are much slower. Account this in + * the delay. + */ +#ifdef CONFIG_URCU_AVOID_SIGNALS /* maximum sleep delay, in us */ #define MAX_SLEEP 50 #else @@ -161,7 +164,7 @@ static inline void debug_yield_init(void) } #endif -#ifdef DEBUG_FULL_MB +#ifdef CONFIG_URCU_AVOID_SIGNALS static inline void reader_barrier() { smp_mb(); diff --git a/urcu.c b/urcu.c index 51c279f..8fae8fa 100644 --- a/urcu.c +++ b/urcu.c @@ -36,7 +36,7 @@ /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ #include "urcu.h" -#ifndef DEBUG_FULL_MB +#ifndef CONFIG_URCU_AVOID_SIGNALS void __attribute__((constructor)) urcu_init(void); void __attribute__((destructor)) urcu_exit(void); #else @@ -127,7 +127,7 @@ static void switch_next_urcu_qparity(void) STORE_SHARED(urcu_gp_ctr, urcu_gp_ctr ^ RCU_GP_CTR_BIT); } -#ifdef DEBUG_FULL_MB +#ifdef CONFIG_URCU_AVOID_SIGNALS #ifdef HAS_INCOHERENT_CACHES static void force_mb_single_thread(struct reader_registry *index) { @@ -139,7 +139,7 @@ static void force_mb_all_threads(void) { smp_mb(); } -#else /* #ifdef DEBUG_FULL_MB */ +#else /* #ifdef CONFIG_URCU_AVOID_SIGNALS */ #ifdef HAS_INCOHERENT_CACHES static void force_mb_single_thread(struct reader_registry *index) { @@ -206,7 +206,7 @@ static void force_mb_all_threads(void) } smp_mb(); /* read ->need_mb before ending the barrier */ } -#endif /* #else #ifdef DEBUG_FULL_MB */ +#endif /* #else #ifdef CONFIG_URCU_AVOID_SIGNALS */ void wait_for_quiescent_state(void) { @@ -420,7 +420,7 @@ void rcu_unregister_thread(void) internal_urcu_unlock(); } -#ifndef DEBUG_FULL_MB +#ifndef CONFIG_URCU_AVOID_SIGNALS static void sigurcu_handler(int signo, siginfo_t *siginfo, void *context) { /* @@ -473,4 +473,4 @@ void urcu_exit(void) assert(act.sa_sigaction == sigurcu_handler); free(registry); } -#endif /* #ifndef DEBUG_FULL_MB */ +#endif /* #ifndef CONFIG_URCU_AVOID_SIGNALS */ -- 2.34.1