Make CONFIG_PREEMPT Fatal
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 7 Mar 2011 18:59:26 +0000 (10:59 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 7 Mar 2011 20:09:02 +0000 (12:09 -0800)
Until support is added for preemptible kernels detect this at
configure time and make it fatal.  Otherwise, it is possible to
have a successful build and kernel modules with flakey behavior.

config/kernel.m4
configure

index 492fbab..8b4a5c7 100644 (file)
@@ -274,6 +274,12 @@ AC_DEFUN([ZFS_AC_SPL], [
 ])
 
 dnl #
+dnl # Certain kernel build options are not supported.  These must be
+dnl # detected at configure time and cause a build failure.  Otherwise
+dnl # modules may be successfully built that behave incorrectly.
+dnl #
+dnl # CONFIG_PREEMPT - Preempt kernels require special handling.
+dnl #
 dnl # There are certain kernel build options which when enabled are
 dnl # completely incompatible with non GPL kernel modules.  It is best
 dnl # to detect these at configure time and fail with a clear error
@@ -283,6 +289,11 @@ dnl # CONFIG_DEBUG_LOCK_ALLOC - Maps mutex_lock() to mutex_lock_nested()
 dnl #
 AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [
 
+       ZFS_LINUX_CONFIG([PREEMPT],
+               AC_MSG_ERROR([
+               *** Kernel built with CONFIG_PREEMPT which is not supported.
+               ** You must rebuild your kernel without this option.]), [])
+
        if test "$ZFS_META_LICENSE" = CDDL; then
                ZFS_LINUX_CONFIG([DEBUG_LOCK_ALLOC],
                AC_MSG_ERROR([
index a9cfbbe..352b683 100755 (executable)
--- a/configure
+++ b/configure
@@ -12086,6 +12086,78 @@ $as_echo "$SPL_SYMBOLS" >&6; }
 
 
 
+       { $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_PREEMPT" >&5
+$as_echo_n "checking whether Linux was built with CONFIG_PREEMPT... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+               #ifndef AUTOCONF_INCLUDED
+               #include <linux/config.h>
+               #endif
+
+int
+main (void)
+{
+
+               #ifndef CONFIG_PREEMPT
+               #error CONFIG_PREEMPT not #defined
+               #endif
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build
+       echo "obj-m := conftest.o" >build/Makefile
+       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+               { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+               { { $as_echo "$as_me:$LINENO: error:
+               *** Kernel built with CONFIG_PREEMPT which is not supported.
+               ** You must rebuild your kernel without this option." >&5
+$as_echo "$as_me: error:
+               *** Kernel built with CONFIG_PREEMPT which is not supported.
+               ** You must rebuild your kernel without this option." >&2;}
+   { (exit 1); exit 1; }; }
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+
+fi
+
+       rm -Rf build
+
+
+
+
        if test "$ZFS_META_LICENSE" = CDDL; then
                { $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC" >&5
 $as_echo_n "checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC... " >&6; }
@@ -16005,6 +16077,78 @@ $as_echo "$SPL_SYMBOLS" >&6; }
 
 
 
+       { $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_PREEMPT" >&5
+$as_echo_n "checking whether Linux was built with CONFIG_PREEMPT... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+               #ifndef AUTOCONF_INCLUDED
+               #include <linux/config.h>
+               #endif
+
+int
+main (void)
+{
+
+               #ifndef CONFIG_PREEMPT
+               #error CONFIG_PREEMPT not #defined
+               #endif
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build
+       echo "obj-m := conftest.o" >build/Makefile
+       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+               { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+               { { $as_echo "$as_me:$LINENO: error:
+               *** Kernel built with CONFIG_PREEMPT which is not supported.
+               ** You must rebuild your kernel without this option." >&5
+$as_echo "$as_me: error:
+               *** Kernel built with CONFIG_PREEMPT which is not supported.
+               ** You must rebuild your kernel without this option." >&2;}
+   { (exit 1); exit 1; }; }
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+
+fi
+
+       rm -Rf build
+
+
+
+
        if test "$ZFS_META_LICENSE" = CDDL; then
                { $as_echo "$as_me:$LINENO: checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC" >&5
 $as_echo_n "checking whether Linux was built with CONFIG_DEBUG_LOCK_ALLOC... " >&6; }