Add --enable-rcu-debug to configure
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 23 Jan 2017 19:26:59 +0000 (14:26 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 23 Jan 2017 20:37:06 +0000 (15:37 -0500)
When used CONFIG_RCU_DEBUG is defined in urcu/config.h, thus the
debugging self-test are used at all time. This enables a permanent
built-in debugging behaviour.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
README.md
configure.ac
include/urcu/config.h.in
include/urcu/debug.h
src/urcu-qsbr.h

index 7ce0edfeec0ef4203e286a4661eac6f7dd9ddeb1..461574617f8abd4a92054fbe4a5b0c45d5e4d9b5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -358,12 +358,19 @@ can be forced by specifying `--disable-compiler-tls` as configure
 argument.
 
 
 argument.
 
 
-### Usage of `DEBUG_RCU`
+### Usage of `DEBUG_RCU` & `--enable-rcu-debug`
 
 
-`DEBUG_RCU` is used to add internal debugging self-checks to the
-RCU library. This define adds a performance penalty when enabled.
-Can be enabled by uncommenting the corresponding line in
-`Makefile.build.inc`.
+By default the library is configured with internal debugging
+self-checks disabled.
+
+For always-on debugging self-checks:
+       ./configure --enable-rcu-debug
+
+For fine grained enabling of debugging self-checks, build
+urserspace-rcu with DEBUG_RCU defined and compile dependent
+applications with DEBUG_RCU defined when necessary.
+
+Warning: Enabling this feature result in a performance penalty.
 
 
 ### Usage of `DEBUG_YIELD`
 
 
 ### Usage of `DEBUG_YIELD`
index 8ac0c4172682668f70fd1e9d158d8c15f2b931e7..dcbb61f2bd61337e65480262b951ed152fcc2c0b 100644 (file)
@@ -26,6 +26,7 @@ AH_TEMPLATE([CONFIG_RCU_ARM_HAVE_DMB], [Use the dmb instruction if available for
 AH_TEMPLATE([CONFIG_RCU_TLS], [TLS provided by the compiler.])
 AH_TEMPLATE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [clock_gettime() is detected.])
 AH_TEMPLATE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [Require the operating system to support the membarrier system call for default and bulletproof flavors.])
 AH_TEMPLATE([CONFIG_RCU_TLS], [TLS provided by the compiler.])
 AH_TEMPLATE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [clock_gettime() is detected.])
 AH_TEMPLATE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [Require the operating system to support the membarrier system call for default and bulletproof flavors.])
+AH_TEMPLATE([CONFIG_RCU_DEBUG], [Enable internal debugging self-checks. Introduce performance penalty.])
 
 # Allow requiring the operating system to support the membarrier system
 # call. Applies to default and bulletproof flavors.
 
 # Allow requiring the operating system to support the membarrier system
 # call. Applies to default and bulletproof flavors.
@@ -253,6 +254,13 @@ AC_ARG_ENABLE([smp-support],
        [def_smp_support="yes"])
 AS_IF([test "x$def_smp_support" = "xyes"], [AC_DEFINE([CONFIG_RCU_SMP], [1])])
 
        [def_smp_support="yes"])
 AS_IF([test "x$def_smp_support" = "xyes"], [AC_DEFINE([CONFIG_RCU_SMP], [1])])
 
+# RCU debugging option
+AC_ARG_ENABLE([rcu-debug],
+      AS_HELP_STRING([--enable-rcu-debug], [Enable internal debugging
+                     self-checks. Introduce performance penalty.]))
+AS_IF([test "x$enable_rcu_debug" = "xyes"], [
+       AC_DEFINE([CONFIG_RCU_DEBUG], [1])
+])
 
 # From the sched_setaffinity(2)'s man page:
 # ~~~~
 
 # From the sched_setaffinity(2)'s man page:
 # ~~~~
index bb128a11da3c77cbc3da563b18895f93506a66f9..9ed0454987733a14b8023ca5fee513ee774b9e57 100644 (file)
@@ -26,3 +26,7 @@
 /* Require the operating system to support the membarrier system call for
    default and bulletproof flavors. */
 #undef CONFIG_RCU_FORCE_SYS_MEMBARRIER
 /* Require the operating system to support the membarrier system call for
    default and bulletproof flavors. */
 #undef CONFIG_RCU_FORCE_SYS_MEMBARRIER
+
+/* Enable internal debugging self-checks.
+   Introduce performance penalty. */
+#undef CONFIG_RCU_DEBUG
index 327bd92331088d2bf29df45d85c329109100dad6..14b50b6a1d539dd67e978ce929c8758a06ca7744 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <assert.h>
 
 
 #include <assert.h>
 
-#ifdef DEBUG_RCU
+#if defined(DEBUG_RCU) || defined(CONFIG_RCU_DEBUG)
 #define urcu_assert(...)       assert(__VA_ARGS__)
 #else
 #define urcu_assert(...)
 #define urcu_assert(...)       assert(__VA_ARGS__)
 #else
 #define urcu_assert(...)
index bf173618bf9a0dee1da8441ff2c14ada233fa064..5e47ad61c7ac63e9e6155d24133c207a0544945c 100644 (file)
@@ -90,12 +90,14 @@ extern "C" {
  * QSBR read lock/unlock are guaranteed to be no-ops. Therefore, we expose them
  * in the LGPL header for any code to use. However, the debug version is not
  * nops and may contain sanity checks. To activate it, applications must be
  * QSBR read lock/unlock are guaranteed to be no-ops. Therefore, we expose them
  * in the LGPL header for any code to use. However, the debug version is not
  * nops and may contain sanity checks. To activate it, applications must be
- * recompiled with -DDEBUG_RCU (even non-LGPL/GPL applications). This is the
- * best trade-off between license/performance/code triviality and
- * library debugging & tracing features we could come up with.
+ * recompiled with -DDEBUG_RCU (even non-LGPL/GPL applications), or
+ * compiled against a urcu/config.h that has CONFIG_RCU_DEBUG defined.
+ * This is the best trade-off between license/performance/code
+ * triviality and library debugging & tracing features we could come up
+ * with.
  */
 
  */
 
-#if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU))
+#if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU) && !defined(CONFIG_RCU_DEBUG))
 
 static inline void rcu_read_lock(void)
 {
 
 static inline void rcu_read_lock(void)
 {
@@ -105,12 +107,12 @@ static inline void rcu_read_unlock(void)
 {
 }
 
 {
 }
 
-#else /* !DEBUG_RCU */
+#else /* #if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU) && !defined(CONFIG_RCU_DEBUG)) */
 
 extern void rcu_read_lock(void);
 extern void rcu_read_unlock(void);
 
 
 extern void rcu_read_lock(void);
 extern void rcu_read_unlock(void);
 
-#endif /* !DEBUG_RCU */
+#endif /* #else #if (!defined(BUILD_QSBR_LIB) && !defined(DEBUG_RCU) && !defined(CONFIG_RCU_DEBUG)) */
 
 extern int rcu_read_ongoing(void);
 extern void rcu_quiescent_state(void);
 
 extern int rcu_read_ongoing(void);
 extern void rcu_quiescent_state(void);
This page took 0.02894 seconds and 4 git commands to generate.