urcu qsbr: add DEBUG_RCU self check
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Tue, 15 Sep 2009 18:36:55 +0000 (14:36 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Tue, 15 Sep 2009 18:36:55 +0000 (14:36 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Makefile.build.inc
README
urcu-qsbr.h

index fc4c471441cc4c6a53dcbcde353f6a15dcd9fb1c..56c7705690f0afb7dbffe6e6bdd3020d1aa34e56 100644 (file)
@@ -1,7 +1,14 @@
 
-CFLAGS=-Wall -O2 -g -I.
-#debug
-#CFLAGS=-Wall -g
+CFLAGS=-Wall -I.
+
+#optimized
+CFLAGS+=-O2
+
+#debug information
+CFLAGS+=-g
+
+#RCU debug (slower, with error-checks)
+#CFLAGS+=-DDEBUG_RCU
 
 LDFLAGS=-lpthread
 
diff --git a/README b/README
index 0ec723dea10186d13e6c11705e18a0c8149ae288..f9af1eb483d83d3cee27625efc0eaa5c48dbbe3e 100644 (file)
--- a/README
+++ b/README
@@ -53,6 +53,8 @@ Usage of DEBUG_RCU
 
        DEBUG_RCU is used to add internal debugging self-checks to the
        RCU library. This define adds a performance penality when enabled.
+       Can be enabled by uncommenting the corresponding line in
+       Makefile.build.inc.
 
 Usage of DEBUG_YIELD
 
index f5392a32dfcc7ae3a4647b4a12f4882baaf042bc..448074d019b28ea1219660c43f990b39e09b7479 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <stdlib.h>
 #include <pthread.h>
+#include <assert.h>
 
 #include <compiler.h>
 #include <arch.h>
  */
 #define KICK_READER_LOOPS 10000
 
+#ifdef DEBUG_RCU
+#define rcu_assert(args...)    assert(args)
+#else
+#define rcu_assert(args...)
+#endif
+
 #ifdef DEBUG_YIELD
 #include <sched.h>
 #include <time.h>
@@ -180,6 +187,7 @@ static inline int rcu_gp_ongoing(long *value)
 
 static inline void _rcu_read_lock(void)
 {
+       rcu_assert(rcu_reader_qs_gp & 1);
 }
 
 static inline void _rcu_read_unlock(void)
This page took 0.029559 seconds and 4 git commands to generate.