From 833dbdb633ba44bfb71b4b965a83096d8e4e827b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sun, 30 Aug 2009 10:50:04 -0400 Subject: [PATCH] Move test programs to tests/ subdir Signed-off-by: Mathieu Desnoyers --- Makefile | 171 +----------------- Makefile.inc | 50 +++++ Makefile64 | 154 +--------------- debug_yield.patch | 139 -------------- tests/Makefile | 1 + tests/Makefile.inc | 114 ++++++++++++ tests/Makefile64 | 3 + api_gcc.h => tests/api_gcc.h | 0 api_ppc.h => tests/api_ppc.h | 0 api_x86.h => tests/api_x86.h | 0 rcutorture.h => tests/rcutorture.h | 0 runall.sh => tests/runall.sh | 0 runpaul-phase1.sh => tests/runpaul-phase1.sh | 0 runpaul-phase2.sh => tests/runpaul-phase2.sh | 0 runpaul-phase3.sh => tests/runpaul-phase3.sh | 0 runpaul-phase4.sh => tests/runpaul-phase4.sh | 0 runpaul-phase5.sh => tests/runpaul-phase5.sh | 0 runpaul-phase6.sh => tests/runpaul-phase6.sh | 0 runtests-batch.sh => tests/runtests-batch.sh | 0 runtests.sh => tests/runtests.sh | 0 subphase4.sh => tests/subphase4.sh | 0 test_looplen.c => tests/test_looplen.c | 4 +- test_mutex.c => tests/test_mutex.c | 4 +- .../test_perthreadlock.c | 4 +- .../test_perthreadlock_timing.c | 5 +- test_qsbr.c => tests/test_qsbr.c | 4 +- test_qsbr_gc.c => tests/test_qsbr_gc.c | 4 +- .../test_qsbr_timing.c | 4 +- test_rwlock.c => tests/test_rwlock.c | 4 +- .../test_rwlock_timing.c | 4 +- test_urcu.c => tests/test_urcu.c | 4 +- test_urcu_gc.c => tests/test_urcu_gc.c | 4 +- .../test_urcu_timing.c | 4 +- urcu-asm.c => tests/urcu-asm.c | 2 +- urcutorture.c => tests/urcutorture.c | 2 +- 35 files changed, 198 insertions(+), 487 deletions(-) create mode 100644 Makefile.inc delete mode 100644 debug_yield.patch create mode 100644 tests/Makefile create mode 100644 tests/Makefile.inc create mode 100644 tests/Makefile64 rename api_gcc.h => tests/api_gcc.h (100%) rename api_ppc.h => tests/api_ppc.h (100%) rename api_x86.h => tests/api_x86.h (100%) rename rcutorture.h => tests/rcutorture.h (100%) rename runall.sh => tests/runall.sh (100%) rename runpaul-phase1.sh => tests/runpaul-phase1.sh (100%) rename runpaul-phase2.sh => tests/runpaul-phase2.sh (100%) rename runpaul-phase3.sh => tests/runpaul-phase3.sh (100%) rename runpaul-phase4.sh => tests/runpaul-phase4.sh (100%) rename runpaul-phase5.sh => tests/runpaul-phase5.sh (100%) rename runpaul-phase6.sh => tests/runpaul-phase6.sh (100%) rename runtests-batch.sh => tests/runtests-batch.sh (100%) rename runtests.sh => tests/runtests.sh (100%) rename subphase4.sh => tests/subphase4.sh (100%) rename test_looplen.c => tests/test_looplen.c (97%) rename test_mutex.c => tests/test_mutex.c (99%) rename test_perthreadlock.c => tests/test_perthreadlock.c (99%) rename test_perthreadlock_timing.c => tests/test_perthreadlock_timing.c (99%) rename test_qsbr.c => tests/test_qsbr.c (99%) rename test_qsbr_gc.c => tests/test_qsbr_gc.c (99%) rename test_qsbr_timing.c => tests/test_qsbr_timing.c (99%) rename test_rwlock.c => tests/test_rwlock.c (99%) rename test_rwlock_timing.c => tests/test_rwlock_timing.c (99%) rename test_urcu.c => tests/test_urcu.c (99%) rename test_urcu_gc.c => tests/test_urcu_gc.c (99%) rename test_urcu_timing.c => tests/test_urcu_timing.c (99%) rename urcu-asm.c => tests/urcu-asm.c (98%) rename urcutorture.c => tests/urcutorture.c (88%) diff --git a/Makefile b/Makefile index 98f9c4a..ab19097 100644 --- a/Makefile +++ b/Makefile @@ -1,170 +1 @@ - -CFLAGS=-Wall -O2 -g -I. -LDFLAGS=-lpthread - -HOSTTYPE=$(shell uname -m) - -ifeq ("${HOSTTYPE}","x86_64") -ARCHTYPE=x86 -endif -ifeq ("${HOSTTYPE}","i586") -ARCHTYPE=x86 -endif -ifeq ("${HOSTTYPE}","i686") -ARCHTYPE=x86 -endif -ifeq ("${HOSTTYPE}","powerpc") -ARCHTYPE=ppc -endif -ifeq ("${HOSTTYPE}","ppc64") -ARCHTYPE=ppc -endif -ifeq ("${HOSTTYPE}","s390") -ARCHTYPE=s390 -endif -ifeq ("${HOSTTYPE}","s390x") -ARCHTYPE=s390 -endif - -ifeq ($(findstring ${ARCHTYPE},"x86 ppc"),) -APIHEADER=api_gcc.h -else -APIHEADER=api_${ARCHTYPE}.h -endif - -#debug -#CFLAGS=-Wall -g - -#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 - -SRC_DEP=`echo $^ | sed 's/[^ ]*\.h//g'` - -all: checkarch test_urcu test_urcu_dynamic_link test_urcu_timing \ - test_rwlock_timing test_rwlock test_perthreadlock_timing \ - test_perthreadlock test_urcu_yield test_urcu_mb \ - urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \ - urcutorture-yield liburcu.so test_mutex test_looplen test_urcu_gc \ - test_urcu_gc_mb test_qsbr_gc test_qsbr_lgc test_urcu_lgc \ - test_urcu_lgc_mb - -checkarch: -ifeq (${ARCHTYPE},) - @echo "Architecture ${HOSTTYPE} is currently unsupported by liburcu" - @exit 1 -endif - -arch.h: arch_${ARCHTYPE}.h - cp -f arch_${ARCHTYPE}.h arch.h - -api.h: ${APIHEADER} - cp -f ${APIHEADER} api.h - -arch_atomic.h: arch_atomic_${ARCHTYPE}.h - cp -f arch_atomic_${ARCHTYPE}.h arch_atomic.h - -urcu.h: arch.h arch_atomic.h - -urcu-qsbr.h: arch.h arch_atomic.h - -test_urcu: urcu.o test_urcu.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -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) -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) -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 -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) - -test_qsbr_gc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_qsbr_lgc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h - $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_rwlock: urcu.o test_rwlock.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_perthreadlock: urcu.o test_perthreadlock.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_mutex: urcu.o test_mutex.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_urcu_dynamic_link: urcu.o test_urcu.c urcu.h - $(CC) ${CFLAGS} -DDYNAMIC_LINK_TEST $(LDFLAGS) -o $@ $(SRC_DEP) - -test_urcu_yield: urcu-yield.o test_urcu.c urcu.h - $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_urcu_timing: urcu.o test_urcu_timing.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_qsbr_timing: urcu-qsbr.o test_qsbr_timing.c urcu-qsbr.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_rwlock_timing: urcu.o test_rwlock_timing.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_perthreadlock_timing: urcu.o test_perthreadlock_timing.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -urcu.o: urcu.c urcu.h - $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) - -urcu-mb.o: urcu.c urcu.h - $(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) - -liburcu.so: urcu.o - $(CC) -fPIC -shared -o $@ $< - -urcu-yield.o: urcu.c urcu.h - $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) - -urcu-asm.S: urcu-asm.c urcu.h - $(CC) ${CFLAGS} -S -o $@ $(SRC_DEP) - -urcu-asm.o: urcu-asm.c urcu.h - $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP) - -urcutorture: urcutorture.c urcu.o urcu.h rcutorture.h api.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -urcutorture-yield: urcutorture.c urcu-yield.o urcu.h rcutorture.h api.h - $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -.PHONY: clean install checkarch - -install: liburcu.so - cp -f liburcu.so /usr/lib/ - cp -f arch.h arch_atomic.h compiler.h urcu.h urcu-static.h /usr/include/ - -clean: - rm -f *.o test_urcu test_urcu_dynamic_link test_urcu_timing \ - test_rwlock_timing test_rwlock test_perthreadlock_timing \ - test_perthreadlock test_urcu_yield test_urcu_mb \ - urcu-asm.S test_qsbr_timing test_qsbr urcutorture \ - urcutorture-yield liburcu.so api.h arch.h arch_atomic.h \ - test_mutex test_urcu_gc test_urcu_gc_mb - +include Makefile.inc diff --git a/Makefile.inc b/Makefile.inc new file mode 100644 index 0000000..870bde8 --- /dev/null +++ b/Makefile.inc @@ -0,0 +1,50 @@ + +include Makefile.build.inc + +DIRS=tests + +all: checkarch liburcu.so urcu.o urcu-yield.o urcu-qsbr.o urcu-mb.o subdirs + +checkarch: +ifeq (${ARCHTYPE},) + @echo "Architecture ${HOSTTYPE} is currently unsupported by liburcu" + @exit 1 +endif + +arch.h: arch_${ARCHTYPE}.h + cp -f arch_${ARCHTYPE}.h arch.h + +arch_atomic.h: arch_atomic_${ARCHTYPE}.h + cp -f arch_atomic_${ARCHTYPE}.h arch_atomic.h + +urcu.h: arch.h arch_atomic.h + +urcu-qsbr.h: arch.h arch_atomic.h + +urcu.o: urcu.c urcu.h + $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) + +urcu-mb.o: urcu.c urcu.h + $(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) + +liburcu.so: urcu.o + $(CC) -fPIC -shared -o $@ $< + +urcu-yield.o: urcu.c urcu.h + $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) + +.PHONY: clean install checkarch tests + +subdirs: + -for d in ${DIRS}; do cd $${d}; ${MAKE} ${MFLAGS}; done + +install: liburcu.so + cp -f liburcu.so /usr/lib/ + cp -f arch.h arch_atomic.h compiler.h urcu.h urcu-static.h /usr/include/ + +clean: + rm -f *.o *.so arch.h arch_atomic.h + -for d in ${DIRS}; do cd $${d}; ${MAKE} clean; done diff --git a/Makefile64 b/Makefile64 index ba36fec..cca1cdc 100644 --- a/Makefile64 +++ b/Makefile64 @@ -1,153 +1,3 @@ +include Makefile.inc -#CFLAGS=-m64 -Wall -O2 -g -I. -CFLAGS=-m64 -O2 -g -I. -LDFLAGS=-lpthread - -HOSTTYPE=$(shell uname -m) - -ifeq ("${HOSTTYPE}","x86_64") -ARCHTYPE=x86 -endif -ifeq ("${HOSTTYPE}","powerpc") -ARCHTYPE=ppc -endif -ifeq ("${HOSTTYPE}","ppc64") -ARCHTYPE=ppc -endif - -#debug -#CFLAGS=-m64 -Wall -g - -#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 - -SRC_DEP=`echo $^ | sed 's/[^ ]*\.h//g'` - -all: checkarch test_urcu test_urcu_dynamic_link test_urcu_timing \ - test_rwlock_timing test_rwlock test_perthreadlock_timing \ - test_perthreadlock test_urcu_yield test_urcu_mb \ - urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \ - urcutorture-yield liburcu.so test_mutex test_looplen test_urcu_gc \ - test_urcu_gc_mb test_qsbr_gc test_qsbr_lgc test_urcu_lgc \ - test_urcu_lgc_mb - -checkarch: -ifeq (${ARCHTYPE},) - @echo "Architecture ${HOSTTYPE} is currently unsupported by liburcu" - @exit 1 -endif - -arch.h: arch_${ARCHTYPE}.h - cp -f arch_${ARCHTYPE}.h arch.h - -api.h: api_${ARCHTYPE}.h - cp -f api_${ARCHTYPE}.h api.h - -arch_atomic.h: arch_atomic_${ARCHTYPE}.h - cp -f arch_atomic_${ARCHTYPE}.h arch_atomic.h - -urcu.h: arch.h api.h arch_atomic.h - -urcu-qsbr.h: arch.h api.h arch_atomic.h - -test_urcu: urcu.o test_urcu.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -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) -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) -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 -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) - -test_qsbr_gc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_qsbr_lgc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h - $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_rwlock: urcu.o test_rwlock.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_perthreadlock: urcu.o test_perthreadlock.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_mutex: urcu.o test_mutex.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_urcu_dynamic_link: urcu.o test_urcu.c urcu.h - $(CC) ${CFLAGS} -DDYNAMIC_LINK_TEST $(LDFLAGS) -o $@ $(SRC_DEP) - -test_urcu_yield: urcu-yield.o test_urcu.c urcu.h - $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_urcu_timing: urcu.o test_urcu_timing.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_qsbr_timing: urcu-qsbr.o test_qsbr_timing.c urcu-qsbr.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_rwlock_timing: urcu.o test_rwlock_timing.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -test_perthreadlock_timing: urcu.o test_perthreadlock_timing.c urcu.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -urcu.o: urcu.c urcu.h - $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) - -urcu-mb.o: urcu.c urcu.h - $(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) - -liburcu.so: urcu.o - $(CC) -m64 -fPIC -shared -o $@ $< - -urcu-yield.o: urcu.c urcu.h - $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) - -urcu-asm.S: urcu-asm.c urcu.h - $(CC) ${CFLAGS} -S -o $@ $(SRC_DEP) - -urcu-asm.o: urcu-asm.c urcu.h - $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP) - -urcutorture: urcutorture.c urcu.o urcu.h rcutorture.h - $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -urcutorture-yield: urcutorture.c urcu-yield.o urcu.h rcutorture.h - $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) - -.PHONY: clean install checkarch - -install: liburcu.so - cp -f liburcu.so /usr/lib/ - cp -f arch.h arch_atomic.h compiler.h urcu.h urcu-static.h /usr/include/ - -clean: - rm -f *.o test_urcu test_urcu_dynamic_link test_urcu_timing \ - test_rwlock_timing test_rwlock test_perthreadlock_timing \ - test_perthreadlock test_urcu_yield test_urcu_mb \ - urcu-asm.S test_qsbr_timing test_qsbr urcutorture \ - urcutorture-yield liburcu.so api.h arch.h arch_atomic.h \ - test_mutex test_urcu_gc test_urcu_gc_mb - +CFLAGS+=-m64 diff --git a/debug_yield.patch b/debug_yield.patch deleted file mode 100644 index 08c04aa..0000000 --- a/debug_yield.patch +++ /dev/null @@ -1,139 +0,0 @@ -diff --git a/urcu.c b/urcu.c -index 162ce00..018e09b 100644 ---- a/urcu.c -+++ b/urcu.c -@@ -91,24 +91,17 @@ static void force_mb_all_threads(void) - */ - if (!reader_data) - return; -- debug_yield_write(); - sig_done = 0; -- debug_yield_write(); - smp_mb(); /* write sig_done before sending the signals */ -- debug_yield_write(); -- for (index = reader_data; index < reader_data + num_readers; index++) { -+ for (index = reader_data; index < reader_data + num_readers; index++) - pthread_kill(index->tid, SIGURCU); -- debug_yield_write(); -- } - /* - * Wait for sighandler (and thus mb()) to execute on every thread. - * BUSY-LOOP. - */ - while (sig_done < num_readers) - barrier(); -- debug_yield_write(); - smp_mb(); /* read sig_done before ending the barrier */ -- debug_yield_write(); - } - #endif - -@@ -135,13 +128,10 @@ void synchronize_rcu(void) - * where new ptr points to. */ - /* Write new ptr before changing the qparity */ - force_mb_all_threads(); -- debug_yield_write(); - - internal_urcu_lock(); -- debug_yield_write(); - - switch_next_urcu_qparity(); /* 0 -> 1 */ -- debug_yield_write(); - - /* - * Must commit qparity update to memory before waiting for parity -@@ -155,7 +145,6 @@ void synchronize_rcu(void) - * Wait for previous parity to be empty of readers. - */ - wait_for_quiescent_state(); /* Wait readers in parity 0 */ -- debug_yield_write(); - - /* - * Must finish waiting for quiescent state for parity 0 before -@@ -166,7 +155,6 @@ void synchronize_rcu(void) - smp_mb(); - - switch_next_urcu_qparity(); /* 1 -> 0 */ -- debug_yield_write(); - - /* - * Must commit qparity update to memory before waiting for parity -@@ -180,17 +168,14 @@ void synchronize_rcu(void) - * Wait for previous parity to be empty of readers. - */ - wait_for_quiescent_state(); /* Wait readers in parity 1 */ -- debug_yield_write(); - - internal_urcu_unlock(); -- debug_yield_write(); - - /* All threads should finish using the data referred to by old ptr - * before decrementing their urcu_active_readers count */ - /* Finish waiting for reader threads before letting the old ptr being - * freed. */ - force_mb_all_threads(); -- debug_yield_write(); - } - - void urcu_add_reader(pthread_t id) -diff --git a/urcu.h b/urcu.h -index 92b31df..1b663c7 100644 ---- a/urcu.h -+++ b/urcu.h -@@ -219,13 +219,11 @@ static inline int rcu_old_gp_ongoing(long *value) - - if (value == NULL) - return 0; -- debug_yield_write(); - /* - * Make sure both tests below are done on the same version of *value - * to insure consistency. - */ - v = ACCESS_ONCE(*value); -- debug_yield_write(); - return (v & RCU_GP_CTR_NEST_MASK) && - ((v ^ urcu_gp_ctr) & RCU_GP_CTR_BIT); - } -@@ -234,34 +232,27 @@ static inline void rcu_read_lock(void) - { - long tmp; - -- debug_yield_read(); - tmp = urcu_active_readers; -- debug_yield_read(); - /* urcu_gp_ctr = RCU_GP_COUNT | (~RCU_GP_CTR_BIT or RCU_GP_CTR_BIT) */ - if (likely(!(tmp & RCU_GP_CTR_NEST_MASK))) - urcu_active_readers = urcu_gp_ctr; - else - urcu_active_readers = tmp + RCU_GP_COUNT; -- debug_yield_read(); - /* - * Increment active readers count before accessing the pointer. - * See force_mb_all_threads(). - */ - read_barrier(); -- debug_yield_read(); - } - - static inline void rcu_read_unlock(void) - { -- debug_yield_read(); - read_barrier(); -- debug_yield_read(); - /* - * Finish using rcu before decrementing the pointer. - * See force_mb_all_threads(). - */ - urcu_active_readers -= RCU_GP_COUNT; -- debug_yield_read(); - } - - /** -@@ -302,7 +293,6 @@ extern void synchronize_rcu(void); - #define urcu_publish_content(p, v) \ - ({ \ - void *oldptr; \ -- debug_yield_write(); \ - oldptr = rcu_xchg_pointer(p, v); \ - synchronize_rcu(); \ - oldptr; \ diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..ab19097 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1 @@ +include Makefile.inc diff --git a/tests/Makefile.inc b/tests/Makefile.inc new file mode 100644 index 0000000..5fac462 --- /dev/null +++ b/tests/Makefile.inc @@ -0,0 +1,114 @@ + +include ../Makefile.build.inc + +ifeq ($(findstring ${ARCHTYPE},"x86 ppc"),) +APIHEADER=api_gcc.h +else +APIHEADER=api_${ARCHTYPE}.h +endif + +LIBDIR=.. + +CFLAGS+=-I ${LIBDIR} + +URCU_SIGNAL=${LIBDIR}/urcu.o ${LIBDIR}/urcu.h +URCU_SIGNAL_YIELD=${LIBDIR}/urcu-yield.o ${LIBDIR}/urcu.h +URCU_MB=${LIBDIR}/urcu-mb.o ${LIBDIR}/urcu.h +URCU_QSBR=${LIBDIR}/urcu-qsbr.o ${LIBDIR}/urcu-qsbr.h + +all: test_urcu test_urcu_dynamic_link test_urcu_timing \ + test_rwlock_timing test_rwlock test_perthreadlock_timing \ + test_perthreadlock test_urcu_yield test_urcu_mb \ + urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \ + urcutorture-yield test_mutex test_looplen test_urcu_gc \ + test_urcu_gc_mb test_qsbr_gc test_qsbr_lgc test_urcu_lgc \ + test_urcu_lgc_mb + +api.h: ${APIHEADER} + cp -f ${APIHEADER} api.h + +test_looplen: test_looplen.c ${LIBDIR}/urcu.h + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + + +test_urcu: test_urcu.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_gc: test_urcu_gc.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_lgc: test_urcu_gc.c ${URCU_SIGNAL} + $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + + +test_urcu_mb: test_urcu.c ${URCU_MB} + $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_gc_mb: test_urcu_gc.c ${URCU_MB} + $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_lgc_mb: test_urcu_gc.c ${URCU_MB} + $(CC) -DTEST_LOCAL_GC -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + + +test_qsbr: test_qsbr.c ${URCU_QSBR} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_qsbr_gc: test_qsbr_gc.c ${URCU_QSBR} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_qsbr_lgc: test_qsbr_gc.c ${URCU_QSBR} + $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + + +test_rwlock: test_rwlock.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_perthreadlock: test_perthreadlock.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_mutex: test_mutex.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_dynamic_link: test_urcu.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} -DDYNAMIC_LINK_TEST $(LDFLAGS) -o $@ $(SRC_DEP) + + +test_urcu_yield: test_urcu.c ${URCU_SIGNAL_YIELD} + $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_urcu_timing: test_urcu_timing.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_qsbr_timing: test_qsbr_timing.c ${URCU_QSBR} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_rwlock_timing: test_rwlock_timing.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +test_perthreadlock_timing: test_perthreadlock_timing.c ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +urcu-asm.S: urcu-asm.c ${LIBDIR}/urcu.h + $(CC) ${CFLAGS} -S -o $@ $(SRC_DEP) + +urcu-asm.o: urcu-asm.c ${LIBDIR}/urcu.h + $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP) + +urcutorture: urcutorture.c rcutorture.h api.h ${URCU_SIGNAL} + $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +urcutorture-yield: urcutorture.c ${URCU_SIGNAL_YIELD} rcutorture.h api.h + $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) + +,PHONY: clean + +clean: + rm -f *.o test_urcu test_urcu_dynamic_link test_urcu_timing \ + test_rwlock_timing test_rwlock test_perthreadlock_timing \ + test_perthreadlock test_urcu_yield test_urcu_mb \ + urcu-asm.S test_qsbr_timing test_qsbr urcutorture \ + urcutorture-yield liburcu.so api.h \ + test_mutex test_urcu_gc test_urcu_gc_mb urcu-asm-1.S \ + test_qsbr_lgc test_qsbr_gc test_looplen test_urcu_lgc \ + test_urcu_lgc_mb diff --git a/tests/Makefile64 b/tests/Makefile64 new file mode 100644 index 0000000..cca1cdc --- /dev/null +++ b/tests/Makefile64 @@ -0,0 +1,3 @@ +include Makefile.inc + +CFLAGS+=-m64 diff --git a/api_gcc.h b/tests/api_gcc.h similarity index 100% rename from api_gcc.h rename to tests/api_gcc.h diff --git a/api_ppc.h b/tests/api_ppc.h similarity index 100% rename from api_ppc.h rename to tests/api_ppc.h diff --git a/api_x86.h b/tests/api_x86.h similarity index 100% rename from api_x86.h rename to tests/api_x86.h diff --git a/rcutorture.h b/tests/rcutorture.h similarity index 100% rename from rcutorture.h rename to tests/rcutorture.h diff --git a/runall.sh b/tests/runall.sh similarity index 100% rename from runall.sh rename to tests/runall.sh diff --git a/runpaul-phase1.sh b/tests/runpaul-phase1.sh similarity index 100% rename from runpaul-phase1.sh rename to tests/runpaul-phase1.sh diff --git a/runpaul-phase2.sh b/tests/runpaul-phase2.sh similarity index 100% rename from runpaul-phase2.sh rename to tests/runpaul-phase2.sh diff --git a/runpaul-phase3.sh b/tests/runpaul-phase3.sh similarity index 100% rename from runpaul-phase3.sh rename to tests/runpaul-phase3.sh diff --git a/runpaul-phase4.sh b/tests/runpaul-phase4.sh similarity index 100% rename from runpaul-phase4.sh rename to tests/runpaul-phase4.sh diff --git a/runpaul-phase5.sh b/tests/runpaul-phase5.sh similarity index 100% rename from runpaul-phase5.sh rename to tests/runpaul-phase5.sh diff --git a/runpaul-phase6.sh b/tests/runpaul-phase6.sh similarity index 100% rename from runpaul-phase6.sh rename to tests/runpaul-phase6.sh diff --git a/runtests-batch.sh b/tests/runtests-batch.sh similarity index 100% rename from runtests-batch.sh rename to tests/runtests-batch.sh diff --git a/runtests.sh b/tests/runtests.sh similarity index 100% rename from runtests.sh rename to tests/runtests.sh diff --git a/subphase4.sh b/tests/subphase4.sh similarity index 100% rename from subphase4.sh rename to tests/subphase4.sh diff --git a/test_looplen.c b/tests/test_looplen.c similarity index 97% rename from test_looplen.c rename to tests/test_looplen.c index e07409a..5006951 100644 --- a/test_looplen.c +++ b/tests/test_looplen.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" #if defined(_syscall0) _syscall0(pid_t, gettid) @@ -55,7 +55,7 @@ static inline pid_t gettid(void) #else #define debug_yield_read() #endif -#include "urcu.h" +#include "../urcu.h" static inline void loop_sleep(unsigned long l) { diff --git a/test_mutex.c b/tests/test_mutex.c similarity index 99% rename from test_mutex.c rename to tests/test_mutex.c index e824980..e94819a 100644 --- a/test_mutex.c +++ b/tests/test_mutex.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -61,7 +61,7 @@ static inline pid_t gettid(void) #else #define debug_yield_read() #endif -#include "urcu.h" +#include "../urcu.h" struct test_array { int a; diff --git a/test_perthreadlock.c b/tests/test_perthreadlock.c similarity index 99% rename from test_perthreadlock.c rename to tests/test_perthreadlock.c index 31b7721..7402f01 100644 --- a/test_perthreadlock.c +++ b/tests/test_perthreadlock.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -61,7 +61,7 @@ static inline pid_t gettid(void) #else #define debug_yield_read() #endif -#include "urcu.h" +#include "../urcu.h" struct test_array { int a; diff --git a/test_perthreadlock_timing.c b/tests/test_perthreadlock_timing.c similarity index 99% rename from test_perthreadlock_timing.c rename to tests/test_perthreadlock_timing.c index 3e8268b..d5bd912 100644 --- a/test_perthreadlock_timing.c +++ b/tests/test_perthreadlock_timing.c @@ -31,7 +31,8 @@ #include #include #include -#include + +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -51,7 +52,7 @@ static inline pid_t gettid(void) } #endif -#include "urcu.h" +#include "../urcu.h" struct test_array { int a; diff --git a/test_qsbr.c b/tests/test_qsbr.c similarity index 99% rename from test_qsbr.c rename to tests/test_qsbr.c index 97b918d..89a9423 100644 --- a/test_qsbr.c +++ b/tests/test_qsbr.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -57,7 +57,7 @@ static inline pid_t gettid(void) #endif #define _LGPL_SOURCE -#include "urcu-qsbr.h" +#include "../urcu-qsbr.h" struct test_array { int a; diff --git a/test_qsbr_gc.c b/tests/test_qsbr_gc.c similarity index 99% rename from test_qsbr_gc.c rename to tests/test_qsbr_gc.c index 3a66a84..004672d 100644 --- a/test_qsbr_gc.c +++ b/tests/test_qsbr_gc.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -57,7 +57,7 @@ static inline pid_t gettid(void) #endif #define _LGPL_SOURCE -#include "urcu-qsbr.h" +#include "../urcu-qsbr.h" struct test_array { int a; diff --git a/test_qsbr_timing.c b/tests/test_qsbr_timing.c similarity index 99% rename from test_qsbr_timing.c rename to tests/test_qsbr_timing.c index e46a435..2a8963a 100644 --- a/test_qsbr_timing.c +++ b/tests/test_qsbr_timing.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -51,7 +51,7 @@ static inline pid_t gettid(void) #endif #define _LGPL_SOURCE -#include "urcu-qsbr.h" +#include "../urcu-qsbr.h" pthread_mutex_t rcu_copy_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/test_rwlock.c b/tests/test_rwlock.c similarity index 99% rename from test_rwlock.c rename to tests/test_rwlock.c index 4cc4c07..c7edd32 100644 --- a/test_rwlock.c +++ b/tests/test_rwlock.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -61,7 +61,7 @@ static inline pid_t gettid(void) #else #define debug_yield_read() #endif -#include "urcu.h" +#include "../urcu.h" struct test_array { int a; diff --git a/test_rwlock_timing.c b/tests/test_rwlock_timing.c similarity index 99% rename from test_rwlock_timing.c rename to tests/test_rwlock_timing.c index 4884e4d..5bc93d3 100644 --- a/test_rwlock_timing.c +++ b/tests/test_rwlock_timing.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -51,7 +51,7 @@ static inline pid_t gettid(void) } #endif -#include "urcu.h" +#include "../urcu.h" struct test_array { int a; diff --git a/test_urcu.c b/tests/test_urcu.c similarity index 99% rename from test_urcu.c rename to tests/test_urcu.c index 3feda89..18683bf 100644 --- a/test_urcu.c +++ b/tests/test_urcu.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -61,7 +61,7 @@ static inline pid_t gettid(void) #else #define debug_yield_read() #endif -#include "urcu.h" +#include "../urcu.h" struct test_array { int a; diff --git a/test_urcu_gc.c b/tests/test_urcu_gc.c similarity index 99% rename from test_urcu_gc.c rename to tests/test_urcu_gc.c index 12ea181..213c68b 100644 --- a/test_urcu_gc.c +++ b/tests/test_urcu_gc.c @@ -33,7 +33,7 @@ #include #include -#include "arch.h" +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -61,7 +61,7 @@ static inline pid_t gettid(void) #else #define debug_yield_read() #endif -#include "urcu.h" +#include "../urcu.h" struct test_array { int a; diff --git a/test_urcu_timing.c b/tests/test_urcu_timing.c similarity index 99% rename from test_urcu_timing.c rename to tests/test_urcu_timing.c index 8577b8f..a3ca783 100644 --- a/test_urcu_timing.c +++ b/tests/test_urcu_timing.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include "../arch.h" /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -51,7 +51,7 @@ static inline pid_t gettid(void) #endif #define _LGPL_SOURCE -#include "urcu.h" +#include "../urcu.h" pthread_mutex_t rcu_copy_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/urcu-asm.c b/tests/urcu-asm.c similarity index 98% rename from urcu-asm.c rename to tests/urcu-asm.c index 0e833f4..66be709 100644 --- a/urcu-asm.c +++ b/tests/urcu-asm.c @@ -20,7 +20,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "urcu.h" +#include "../urcu.h" void show_read_lock(void) { diff --git a/urcutorture.c b/tests/urcutorture.c similarity index 88% rename from urcutorture.c rename to tests/urcutorture.c index 75256f9..70abc68 100644 --- a/urcutorture.c +++ b/tests/urcutorture.c @@ -5,5 +5,5 @@ #include #include "api.h" #define _LGPL_SOURCE -#include "urcu.h" +#include "../urcu.h" #include "rcutorture.h" -- 2.34.1