diff options
author | Brian Behlendorf <[email protected]> | 2009-10-30 10:55:25 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2009-10-30 10:55:25 -0700 |
commit | 5e9b5d832b228b0628a61c9c1c9bf0b05d2fe122 (patch) | |
tree | 8dc52bf67d9cbd60a6bfc41e1156cf80b673126d /configure | |
parent | 2b5adaf18fde25b963a9d21407773544f2cbed6f (diff) |
Use Linux atomic primitives by default.
Previously Solaris style atomic primitives were implemented simply by
wrapping the desired operation in a global spinlock. This was easy to
implement at the time when I wasn't 100% sure I could safely layer the
Solaris atomic primatives on the Linux counterparts. It however was
likely not good for performance.
After more investigation however it does appear the Solaris primitives
can be layered on Linux's fairly safely. The Linux atomic_t type really
just wraps a long so we can simply cast the Solaris unsigned value to
either a atomic_t or atomic64_t. The only lingering problem for both
implementations is that Solaris provides no atomic read function. This
means reading a 64-bit value on a 32-bit arch can (and will) result in
word breaking. I was very concerned about this initially, but upon
further reflection it is a limitation of the Solaris API. So really
we are just being bug-for-bug compatible here.
With this change the default implementation is layered on top of Linux
atomic types. However, because we're assuming a lot about the internal
implementation of those types I've made it easy to fall-back to the
generic approach. Simply build with --enable-atomic_spinlocks if
issues are encountered with the new implementation.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 104 |
1 files changed, 76 insertions, 28 deletions
@@ -1038,6 +1038,8 @@ Optional Features: --enable-debug-kmem Enable kmem debug support (default off) --enable-debug-kstat Enable kstat debug support (default off) --enable-debug-callb Enable callb debug support (default off) + --enable-atomic-spinlocks + Atomic types use spinlocks [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -3986,7 +3988,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3989 "configure"' > conftest.$ac_ext + echo '#line 3991 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5585,7 +5587,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5588:" \ +echo "$as_me:5590:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 @@ -6648,11 +6650,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6651: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6653: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6655: \$? = $ac_status" >&5 + echo "$as_me:6657: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6916,11 +6918,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6919: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6921: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6923: \$? = $ac_status" >&5 + echo "$as_me:6925: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7020,11 +7022,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7023: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7025: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7027: \$? = $ac_status" >&5 + echo "$as_me:7029: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8489,7 +8491,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8492 "configure"' > conftest.$ac_ext + echo '#line 8494 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9386,7 +9388,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9389 "configure" +#line 9391 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9486,7 +9488,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9489 "configure" +#line 9491 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11829,11 +11831,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11832: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11834: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11836: \$? = $ac_status" >&5 + echo "$as_me:11838: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11933,11 +11935,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11936: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11938: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11940: \$? = $ac_status" >&5 + echo "$as_me:11942: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12469,7 +12471,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12472 "configure"' > conftest.$ac_ext + echo '#line 12474 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13527,11 +13529,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13530: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13532: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13534: \$? = $ac_status" >&5 + echo "$as_me:13536: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13631,11 +13633,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13634: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13636: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13638: \$? = $ac_status" >&5 + echo "$as_me:13640: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15080,7 +15082,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15083 "configure"' > conftest.$ac_ext + echo '#line 15085 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -15858,11 +15860,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15861: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15863: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15865: \$? = $ac_status" >&5 + echo "$as_me:15867: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16126,11 +16128,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16131: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16133: \$? = $ac_status" >&5 + echo "$as_me:16135: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16230,11 +16232,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16233: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16235: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16237: \$? = $ac_status" >&5 + echo "$as_me:16239: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17699,7 +17701,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 17702 "configure"' > conftest.$ac_ext + echo '#line 17704 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -19203,6 +19205,29 @@ _ACEOF echo "${ECHO_T}no" >&6 fi + + # Check whether --enable-atomic-spinlocks or --disable-atomic-spinlocks was given. +if test "${enable_atomic_spinlocks+set}" = set; then + enableval="$enable_atomic_spinlocks" + +else + enable_atomic_spinlocks=no +fi; + + if test "x$enable_atomic_spinlocks" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define ATOMIC_SPINLOCK 1 +_ACEOF + +fi + + + echo "$as_me:$LINENO: checking whether atomic types use spinlocks" >&5 +echo $ECHO_N "checking whether atomic types use spinlocks... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $enable_atomic_spinlocks" >&5 +echo "${ECHO_T}$enable_atomic_spinlocks" >&6 + echo "$as_me:$LINENO: checking whether kernel defines uintptr_t" >&5 echo $ECHO_N "checking whether kernel defines uintptr_t... $ECHO_C" >&6 @@ -22351,6 +22376,29 @@ _ACEOF echo "${ECHO_T}no" >&6 fi + + # Check whether --enable-atomic-spinlocks or --disable-atomic-spinlocks was given. +if test "${enable_atomic_spinlocks+set}" = set; then + enableval="$enable_atomic_spinlocks" + +else + enable_atomic_spinlocks=no +fi; + + if test "x$enable_atomic_spinlocks" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define ATOMIC_SPINLOCK 1 +_ACEOF + +fi + + + echo "$as_me:$LINENO: checking whether atomic types use spinlocks" >&5 +echo $ECHO_N "checking whether atomic types use spinlocks... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $enable_atomic_spinlocks" >&5 +echo "${ECHO_T}$enable_atomic_spinlocks" >&6 + echo "$as_me:$LINENO: checking whether kernel defines uintptr_t" >&5 echo $ECHO_N "checking whether kernel defines uintptr_t... $ECHO_C" >&6 |