diff options
author | Brian Behlendorf <[email protected]> | 2009-12-04 15:54:12 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2009-12-04 15:54:12 -0800 |
commit | d04c8a563c09d6449d5663aa2b57840653defae5 (patch) | |
tree | dabaa7102180f3c4e18ac21e1f7fc3618e996bdb /configure | |
parent | db1aa22297d50fa19939e487b5cc7d1f5088c64e (diff) |
Atomic64 compatibility for 32-bit systems without kernel support.
This patch is another step towards updating the code to handle the
32-bit kernels which I have not been regularly testing. This changes
do not really impact the common case I'm expected which is the latest
kernel running on an x86_64 arch.
Until the linux-2.6.31 kernel the x86 arch did not have support for
64-bit atomic operations. Additionally, the new atomic_compat.h support
for this case was wrong because it embedded a spinlock in the atomic
variable which must always and only be 64-bits total. To handle these
32-bit issues we now simply fall back to the --enable-atomic-spinlock
implementation if the kernel does not provide the 64-bit atomic funcs.
The second issue this patch addresses is the DEBUG_KMEM assumption that
there will always be atomic64 funcs available. On 32-bit archs this may
not be true, and actually that's just fine. In that case the kernel will
will never be able to allocate more the 32-bits worth anyway. So just
check if atomic64 funcs are available, if they are not it means this
is a 32-bit machine and we can safely use atomic_t's instead.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 206 |
1 files changed, 135 insertions, 71 deletions
@@ -1039,7 +1039,7 @@ Optional Features: --enable-debug-kmem-tracking Enable detailed kmem tracking [default=no] --enable-atomic-spinlocks - Atomic types use spinlocks [default=no] + Atomic types use spinlocks [default=check] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -19160,25 +19160,9 @@ if test "${enable_atomic_spinlocks+set}" = set; then enableval="$enable_atomic_spinlocks" else - enable_atomic_spinlocks=no + enable_atomic_spinlocks=check 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 cat >conftest.c <<_ACEOF @@ -19189,13 +19173,13 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include <linux/types.h> + #include <asm/atomic.h> int main (void) { - uintptr_t *ptr; + atomic64_t *ptr; ; return 0; @@ -19218,11 +19202,10 @@ _ACEOF echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + have_atomic64_t=yes cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTPTR_T 1 +#define HAVE_ATOMIC64_T 1 _ACEOF @@ -19230,8 +19213,7 @@ else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + have_atomic64_t=no @@ -19241,8 +19223,58 @@ fi + if test "x$enable_atomic_spinlocks" = xcheck; then + + if test "x$have_atomic64_t" = xyes; then + + enable_atomic_spinlocks=no + +else + + enable_atomic_spinlocks=yes + +fi + + +fi + + + if test "x$enable_atomic_spinlocks" = xyes; then + + +cat >>confdefs.h <<\_ACEOF +#define ATOMIC_SPINLOCK 1 +_ACEOF + + +else + + if test "x$have_atomic64_t" = xno; then + + { { echo "$as_me:$LINENO: error: --disable-atomic-spinlocks given but required atomic64 support is unavailable +See \`config.log' for more details." >&5 +echo "$as_me: error: --disable-atomic-spinlocks given but required atomic64 support is unavailable +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +fi + + +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 atomic64_t" >&5 echo $ECHO_N "checking whether kernel defines atomic64_t... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $have_atomic64_t" >&5 +echo "${ECHO_T}$have_atomic64_t" >&6 + + echo "$as_me:$LINENO: checking whether kernel defines atomic64_cmpxchg" >&5 +echo $ECHO_N "checking whether kernel defines atomic64_cmpxchg... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -19259,7 +19291,7 @@ int main (void) { - atomic64_t *ptr; + atomic64_cmpxchg((atomic64_t *)NULL, 0, 0); ; return 0; @@ -19286,7 +19318,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ATOMIC64_T 1 +#define HAVE_ATOMIC64_CMPXCHG 1 _ACEOF @@ -19305,8 +19337,8 @@ fi - echo "$as_me:$LINENO: checking whether kernel defines atomic64_cmpxchg" >&5 -echo $ECHO_N "checking whether kernel defines atomic64_cmpxchg... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether kernel defines atomic64_xchg" >&5 +echo $ECHO_N "checking whether kernel defines atomic64_xchg... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -19323,7 +19355,7 @@ int main (void) { - atomic64_cmpxchg((atomic64_t *)NULL, 0, 0); + atomic64_xchg((atomic64_t *)NULL, 0); ; return 0; @@ -19350,7 +19382,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ATOMIC64_CMPXCHG 1 +#define HAVE_ATOMIC64_XCHG 1 _ACEOF @@ -19369,8 +19401,8 @@ fi - echo "$as_me:$LINENO: checking whether kernel defines atomic64_xchg" >&5 -echo $ECHO_N "checking whether kernel defines atomic64_xchg... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether kernel defines uintptr_t" >&5 +echo $ECHO_N "checking whether kernel defines uintptr_t... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -19381,13 +19413,13 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include <asm/atomic.h> + #include <linux/types.h> int main (void) { - atomic64_xchg((atomic64_t *)NULL, 0); + uintptr_t *ptr; ; return 0; @@ -19414,7 +19446,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ATOMIC64_XCHG 1 +#define HAVE_UINTPTR_T 1 _ACEOF @@ -22409,25 +22441,9 @@ if test "${enable_atomic_spinlocks+set}" = set; then enableval="$enable_atomic_spinlocks" else - enable_atomic_spinlocks=no + enable_atomic_spinlocks=check 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 cat >conftest.c <<_ACEOF @@ -22438,13 +22454,13 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include <linux/types.h> + #include <asm/atomic.h> int main (void) { - uintptr_t *ptr; + atomic64_t *ptr; ; return 0; @@ -22467,11 +22483,10 @@ _ACEOF echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + have_atomic64_t=yes cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTPTR_T 1 +#define HAVE_ATOMIC64_T 1 _ACEOF @@ -22479,8 +22494,7 @@ else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + have_atomic64_t=no @@ -22490,8 +22504,58 @@ fi + if test "x$enable_atomic_spinlocks" = xcheck; then + + if test "x$have_atomic64_t" = xyes; then + + enable_atomic_spinlocks=no + +else + + enable_atomic_spinlocks=yes + +fi + + +fi + + + if test "x$enable_atomic_spinlocks" = xyes; then + + +cat >>confdefs.h <<\_ACEOF +#define ATOMIC_SPINLOCK 1 +_ACEOF + + +else + + if test "x$have_atomic64_t" = xno; then + + { { echo "$as_me:$LINENO: error: --disable-atomic-spinlocks given but required atomic64 support is unavailable +See \`config.log' for more details." >&5 +echo "$as_me: error: --disable-atomic-spinlocks given but required atomic64 support is unavailable +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +fi + + +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 atomic64_t" >&5 echo $ECHO_N "checking whether kernel defines atomic64_t... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $have_atomic64_t" >&5 +echo "${ECHO_T}$have_atomic64_t" >&6 + + echo "$as_me:$LINENO: checking whether kernel defines atomic64_cmpxchg" >&5 +echo $ECHO_N "checking whether kernel defines atomic64_cmpxchg... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22508,7 +22572,7 @@ int main (void) { - atomic64_t *ptr; + atomic64_cmpxchg((atomic64_t *)NULL, 0, 0); ; return 0; @@ -22535,7 +22599,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ATOMIC64_T 1 +#define HAVE_ATOMIC64_CMPXCHG 1 _ACEOF @@ -22554,8 +22618,8 @@ fi - echo "$as_me:$LINENO: checking whether kernel defines atomic64_cmpxchg" >&5 -echo $ECHO_N "checking whether kernel defines atomic64_cmpxchg... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether kernel defines atomic64_xchg" >&5 +echo $ECHO_N "checking whether kernel defines atomic64_xchg... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22572,7 +22636,7 @@ int main (void) { - atomic64_cmpxchg((atomic64_t *)NULL, 0, 0); + atomic64_xchg((atomic64_t *)NULL, 0); ; return 0; @@ -22599,7 +22663,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ATOMIC64_CMPXCHG 1 +#define HAVE_ATOMIC64_XCHG 1 _ACEOF @@ -22618,8 +22682,8 @@ fi - echo "$as_me:$LINENO: checking whether kernel defines atomic64_xchg" >&5 -echo $ECHO_N "checking whether kernel defines atomic64_xchg... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether kernel defines uintptr_t" >&5 +echo $ECHO_N "checking whether kernel defines uintptr_t... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22630,13 +22694,13 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include <asm/atomic.h> + #include <linux/types.h> int main (void) { - atomic64_xchg((atomic64_t *)NULL, 0); + uintptr_t *ptr; ; return 0; @@ -22663,7 +22727,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ATOMIC64_XCHG 1 +#define HAVE_UINTPTR_T 1 _ACEOF |