[lttng-dev] [PATCH userspace-rcu v2] Add --enable-rcu-debug to configure
Jonathan Rajotte
jonathan.rajotte-julien at efficios.com
Mon Jan 23 19:26:59 UTC 2017
v2: Added CONFIG_RCU_DEBUG template to urcu/include.h.
Consider CONFIG_RCU_DEbug in urcu/debug.h.
Consider CONFIG_RCU_DEBUG in src/urcu-qsbr.h.
------
When used CONFIG_RCU_DEBUG is defined in urcu/config.h ,thus the
debugging self-test are used at all time. This allow for a permanent
built-in debugging behaviour.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
README.md | 17 ++++++++++++-----
configure.ac | 8 ++++++++
include/urcu/config.h.in | 4 ++++
include/urcu/debug.h | 2 +-
src/urcu-qsbr.h | 4 ++++
5 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 7ce0edf..4615746 100644
--- a/README.md
+++ b/README.md
@@ -358,12 +358,19 @@ can be forced by specifying `--disable-compiler-tls` as configure
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`
diff --git a/configure.ac b/configure.ac
index 8ac0c41..dcbb61f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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_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.
@@ -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])])
+# 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:
# ~~~~
diff --git a/include/urcu/config.h.in b/include/urcu/config.h.in
index bb128a1..9ed0454 100644
--- a/include/urcu/config.h.in
+++ b/include/urcu/config.h.in
@@ -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
+
+/* Enable internal debugging self-checks.
+ Introduce performance penalty. */
+#undef CONFIG_RCU_DEBUG
diff --git a/include/urcu/debug.h b/include/urcu/debug.h
index 327bd92..14b50b6 100644
--- a/include/urcu/debug.h
+++ b/include/urcu/debug.h
@@ -21,7 +21,7 @@
#include <assert.h>
-#ifdef DEBUG_RCU
+#if defined(DEBUG_RCU) || defined(CONFIG_RCU_DEBUG)
#define urcu_assert(...) assert(__VA_ARGS__)
#else
#define urcu_assert(...)
diff --git a/src/urcu-qsbr.h b/src/urcu-qsbr.h
index bf17361..06c7064 100644
--- a/src/urcu-qsbr.h
+++ b/src/urcu-qsbr.h
@@ -47,6 +47,10 @@ extern "C" {
#define DEBUG_RCU
#endif
+#ifdef CONFIG_RCU_DEBUG
+#define DEBUG_RCU
+#endif
+
/*
* Important !
*
--
2.7.4
More information about the lttng-dev
mailing list