From 4b2220f0b937018b79154ac368c845e6176a8a66 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 20 Jan 2012 16:39:12 -0800 Subject: Add --enable-debug-log configure option Until now the notion of an internal debug logging infrastructure was conflated with enabling ASSERT()s. This patch clarifies things by cleanly breaking the two subsystem apart. The result of this is the following behavior. --enable-debug - Enable/disable code wrapped in ASSERT()s. --disable-debug ASSERT()s are used to check invariants and are never required for correct operation. They are disabled by default because they may impact performance. --enable-debug-log - Enable/disable the debug log infrastructure. --disable-debug-log This infrastructure allows the spl code and its consumer to log messages to an in-kernel log. The granularity of the logging can be controlled by a debug mask. By default the mask disables most debug messages resulting in a negligible performance impact. Because of this the debug log is enabled by default. Signed-off-by: Brian Behlendorf --- config/spl-build.m4 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'config/spl-build.m4') diff --git a/config/spl-build.m4 b/config/spl-build.m4 index a20ee38d1..205eb6bc5 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -19,6 +19,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ AC_SUBST(KERNELCPPFLAGS) SPL_AC_DEBUG + SPL_AC_DEBUG_LOG SPL_AC_DEBUG_KMEM SPL_AC_DEBUG_KMEM_TRACKING SPL_AC_ATOMIC_SPINLOCK @@ -485,6 +486,33 @@ AC_DEFUN([SPL_AC_DEBUG], [ AC_MSG_RESULT([$enable_debug]) ]) +dnl # +dnl # Enabled by default it provides a basic debug log infrastructure. +dnl # Each subsystem registers itself with a name and logs messages +dnl # using predefined types. If the debug mask it set to allow the +dnl # message type it will be written to the internal log. The log +dnl # can be dumped to a file by echoing 1 to the 'dump' proc entry, +dnl # after dumping the log it must be decoded using the spl utility. +dnl # +dnl # echo 1 >/proc/sys/kernel/spl/debug/dump +dnl # spl /tmp/spl-log.xxx.yyy /tmp/spl-log.xxx.yyy.txt +dnl # +AC_DEFUN([SPL_AC_DEBUG_LOG], [ + AC_ARG_ENABLE([debug-log], + [AS_HELP_STRING([--enable-debug-log], + [Enable basic debug logging @<:@default=yes@:>@])], + [], + [enable_debug_log=yes]) + + AS_IF([test "x$enable_debug_log" = xyes], + [AC_DEFINE([DEBUG_LOG], [1], + [Define to 1 to enable basic debug logging]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_LOG"]) + + AC_MSG_CHECKING([whether basic debug logging is enabled]) + AC_MSG_RESULT([$enable_debug_log]) +]) + 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. -- cgit v1.2.3