aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-10-30 13:58:51 -0700
committerBrian Behlendorf <[email protected]>2009-10-30 13:58:51 -0700
commit055ffd98cf80bfc72c28d730753c7d139b704d44 (patch)
tree24b7bd860c9d33327652698cd9f9b04dda50e341 /config
parent302b88e6abc3efe86411f9622b0a27a5b8b1f417 (diff)
Autoconf --enable-debug-* cleanup
Cleanup the --enable-debug-* configure options, this has been pending for quite some time and I am glad I finally got to it. To summerize: 1) All SPL_AC_DEBUG_* macros were updated to be a more autoconf friendly. This mainly involved shift to the GNU approved usage of AC_ARG_ENABLE and ensuring AS_IF is used rather than directly using an if [ test ] construct. 2) --enable-debug-kmem=yes by default. This simply enabled keeping a running tally of total memory allocated and freed and reporting a memory leak if there was one at module unload. Additionally, it ensure /proc/spl/kmem/slab will exist by default which is handy. The overhead is low for this and it should not impact performance. 3) --enable-debug-kmem-tracking=no by default. This option was added to provide a configure option to enable to detailed memory allocation tracking. This support was always there but you had to know where to turn it on. By default this support is disabled because it is known to badly hurt performence, however it is invaluable when chasing a memory leak. 4) --enable-debug-kstat removed. After further reflection I can't see why you would ever really want to turn this support off. It is now always on which had the nice side effect of simplifying the proc handling code in spl-proc.c. We can now always assume the top level directory will be there. 5) --enable-debug-callb removed. This never really did anything, it was put in provisionally because it might have been needed. It turns out it was not so I am just removing it to prevent confusion.
Diffstat (limited to 'config')
-rw-r--r--config/spl-build.m4137
1 files changed, 58 insertions, 79 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4
index 9d81ccc8e..ae45e29da 100644
--- a/config/spl-build.m4
+++ b/config/spl-build.m4
@@ -23,8 +23,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_DEBUG
SPL_AC_DEBUG_KMEM
- SPL_AC_DEBUG_KSTAT
- SPL_AC_DEBUG_CALLB
+ SPL_AC_DEBUG_KMEM_TRACKING
SPL_AC_ATOMIC_SPINLOCK
SPL_AC_TYPE_UINTPTR_T
SPL_AC_TYPE_ATOMIC64_T
@@ -218,91 +217,71 @@ AC_DEFUN([SPL_AC_CONFIG], [
[test "$SPL_CONFIG" = all])
])
+dnl #
+dnl # Enable if the SPL should be compiled with internal debugging enabled.
+dnl # By default this support is disabled.
+dnl #
AC_DEFUN([SPL_AC_DEBUG], [
+ AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [Enable generic debug support @<:@default=no@:>@])],
+ [],
+ [enable_debug=no])
+
+ AS_IF([test "x$enable_debug" = xyes],
+ [KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"],
+ [KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"])
+
AC_MSG_CHECKING([whether debugging is enabled])
- AC_ARG_ENABLE( [debug],
- AS_HELP_STRING([--enable-debug],
- [Enable generic debug support (default off)]),
- [ case "$enableval" in
- yes) spl_ac_debug=yes ;;
- no) spl_ac_debug=no ;;
- *) AC_MSG_RESULT([Error!])
- AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
- esac ]
- )
- if test "$spl_ac_debug" = yes; then
- AC_MSG_RESULT([yes])
- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
- else
- AC_MSG_RESULT([no])
- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
- fi
+ AC_MSG_RESULT([$enable_debug])
])
+dnl #
+dnl # Enabled by default it provides a minimal level of memory tracking.
+dnl # A total count of bytes allocated is kept for each alloc and free.
+dnl # Then at module unload time a report to the console will be printed
+dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
+dnl # and provide an easy way to inspect the kmem based slab.
+dnl #
AC_DEFUN([SPL_AC_DEBUG_KMEM], [
- AC_MSG_CHECKING([whether kmem debugging is enabled])
- AC_ARG_ENABLE( [debug-kmem],
- AS_HELP_STRING([--enable-debug-kmem],
- [Enable kmem debug support (default off)]),
- [ case "$enableval" in
- yes) spl_ac_debug_kmem=yes ;;
- no) spl_ac_debug_kmem=no ;;
- *) AC_MSG_RESULT([Error!])
- AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
- esac ]
- )
- if test "$spl_ac_debug_kmem" = yes; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([DEBUG_KMEM], [1],
- [Define to 1 to enable kmem debugging])
- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
- else
- AC_MSG_RESULT([no])
- fi
-])
+ AC_ARG_ENABLE([debug-kmem],
+ [AS_HELP_STRING([--enable-debug-kmem],
+ [Enable basic kmem accounting @<:@default=yes@:>@])],
+ [],
+ [enable_debug_kmem=yes])
-AC_DEFUN([SPL_AC_DEBUG_KSTAT], [
- AC_MSG_CHECKING([whether kstat debugging is enabled])
- AC_ARG_ENABLE( [debug-kstat],
- AS_HELP_STRING([--enable-debug-kstat],
- [Enable kstat debug support (default off)]),
- [ case "$enableval" in
- yes) spl_ac_debug_kstat=yes ;;
- no) spl_ac_debug_kstat=no ;;
- *) AC_MSG_RESULT([Error!])
- AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
- esac ]
- )
- if test "$spl_ac_debug_kstat" = yes; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([DEBUG_KSTAT], [1],
- [Define to 1 to enable kstat debugging])
- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
- else
- AC_MSG_RESULT([no])
- fi
+ AS_IF([test "x$enable_debug_kmem" = xyes],
+ [AC_DEFINE([DEBUG_KMEM], [1],
+ [Define to 1 to enable basic kmem accounting])
+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"])
+
+ AC_MSG_CHECKING([whether basic kmem accounting is enabled])
+ AC_MSG_RESULT([$enable_debug_kmem])
])
-AC_DEFUN([SPL_AC_DEBUG_CALLB], [
- AC_MSG_CHECKING([whether callb debugging is enabled])
- AC_ARG_ENABLE( [debug-callb],
- AS_HELP_STRING([--enable-debug-callb],
- [Enable callb debug support (default off)]),
- [ case "$enableval" in
- yes) spl_ac_debug_callb=yes ;;
- no) spl_ac_debug_callb=no ;;
- *) AC_MSG_RESULT([Error!])
- AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
- esac ]
- )
- if test "$spl_ac_debug_callb" = yes; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([DEBUG_CALLB], [1],
- [Define to 1 to enable callb debugging])
- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
- else
- AC_MSG_RESULT([no])
- fi
+dnl #
+dnl # Disabled by default it provides detailed memory tracking. This
+dnl # feature also requires --enable-debug-kmem to be set. When enabled
+dnl # not only will total bytes be tracked but also the location of every
+dnl # alloc and free. When the SPL module is unloaded a list of all leaked
+dnl # addresses and where they were allocated will be dumped to the console.
+dnl # Enabling this feature has a significant impact on performance but it
+dnl # makes finding memory leaks pretty straight forward.
+dnl #
+AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
+ AC_ARG_ENABLE([debug-kmem-tracking],
+ [AS_HELP_STRING([--enable-debug-kmem-tracking],
+ [Enable detailed kmem tracking @<:@default=no@:>@])],
+ [],
+ [enable_debug_kmem_tracking=no])
+
+ AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
+ [AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
+ [Define to 1 to enable detailed kmem tracking])
+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"])
+
+ AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
+ AC_MSG_RESULT([$enable_debug_kmem_tracking])
])
dnl #