[ofa-general] [PATCH] uDAPL OFED 1.2 RC2 build issue on ia64 and RHEL5
Arlin Davis
arlin.r.davis at intel.com
Fri Apr 27 16:38:01 PDT 2007
Fixes build problems with ia64 and RHEL5 with atomic operations. Patch was tested on ia64 RHEL4 and
RHEL5 using dtest/dapltest.
James, can you review this before I push.
Thanks,
-arlin
Signed-off by: Arlin Davis ardavis at ichips.intel.com
diff --git a/Makefile.am b/Makefile.am
index 70ef6ef..d02f7c1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,10 +2,13 @@
OSFLAGS = -DOS_RELEASE=$(shell expr `uname -r | cut -f1 -d.` \* 65536 + `uname -r | cut -f2 -d.`)
# Check for RedHat, needed for ia64 udapl atomic operations (IA64_FETCHADD syntax)
-if OS_RHEL
+# and built-in atomics for RedHat EL5
+if OS_RHEL4
OSFLAGS += -DREDHAT_EL4
-else
-OSFLAGS +=
+endif
+
+if OS_RHEL5
+OSFLAGS += -DREDHAT_EL5
endif
if DEBUG
diff --git a/configure.in b/configure.in
index 324bfa1..e11fa73 100644
--- a/configure.in
+++ b/configure.in
@@ -50,15 +50,25 @@ AC_ARG_ENABLE(debug,
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
-dnl Check for Redhat EL release
-AC_CACHE_CHECK(whether this is an RHEL system, ac_cv_rhel,
+dnl Check for Redhat EL release 4
+AC_CACHE_CHECK(Check for RHEL4 system, ac_cv_rhel4,
if test -f /etc/redhat-release &&
- test -n "`grep -v Fedora /etc/redhat-release`"; then
- ac_cv_rhel=yes
+ test -n "`grep -e "release 4" /etc/redhat-release`"; then
+ ac_cv_rhel4=yes
else
- ac_cv_rhel=no
+ ac_cv_rhel4=no
fi)
-AM_CONDITIONAL(OS_RHEL, test "$ac_cv_rhel" = "yes")
+AM_CONDITIONAL(OS_RHEL4, test "$ac_cv_rhel4" = "yes")
+
+dnl Check for Redhat EL release 5
+AC_CACHE_CHECK(Check for RHEL5 system, ac_cv_rhel5,
+ if test -f /etc/redhat-release &&
+ test -n "`grep -e "release 5" /etc/redhat-release`"; then
+ ac_cv_rhel5=yes
+ else
+ ac_cv_rhel5=no
+ fi)
+AM_CONDITIONAL(OS_RHEL5, test "$ac_cv_rhel5" = "yes")
AC_CONFIG_FILES([Makefile test/dtest/Makefile test/dapltest/Makefile libdat.spec])
diff --git a/dapl/udapl/linux/dapl_osd.h b/dapl/udapl/linux/dapl_osd.h
index efa967d..cfc85d1 100644
--- a/dapl/udapl/linux/dapl_osd.h
+++ b/dapl/udapl/linux/dapl_osd.h
@@ -78,7 +78,7 @@
#include <sys/socket.h>
#include <ctype.h>
-#if defined(__ia64__) || defined(__PPC64__)
+#if !defined(REDHAT_EL5) && (defined(__ia64__) || defined(__PPC64__))
#include <asm/atomic.h>
#endif
#if defined(__PPC64__)
@@ -155,14 +155,14 @@ dapl_os_atomic_inc (
INOUT DAPL_ATOMIC *v)
{
#ifdef __ia64__
- DAT_COUNT old_value;
-
-# if !defined(REDHAT_EL4) && (OS_RELEASE >= LINUX_VERSION(2,6))
+ DAT_COUNT old_value;
+#if defined(REDHAT_EL5)
+ old_value = __sync_fetch_and_add(v, 1);
+#elif !defined(REDHAT_EL4) && (OS_RELEASE >= LINUX_VERSION(2,6))
IA64_FETCHADD(old_value,v,1,4,rel);
-# else
+#else
IA64_FETCHADD(old_value,v,1,4);
-# endif
-
+#endif
#elif defined(__PPC64__)
atomic_inc((atomic_t *) v);
#else /* !__ia64__ */
@@ -185,14 +185,14 @@ dapl_os_atomic_dec (
INOUT DAPL_ATOMIC *v)
{
#ifdef __ia64__
- DAT_COUNT old_value;
-
-# if !defined(REDHAT_EL4) && (OS_RELEASE >= LINUX_VERSION(2,6))
+ DAT_COUNT old_value;
+#if defined(REDHAT_EL5)
+ old_value = __sync_fetch_and_sub(v, 1);
+#elif !defined(REDHAT_EL4) && (OS_RELEASE >= LINUX_VERSION(2,6))
IA64_FETCHADD(old_value,v,-1,4,rel);
-# else
+#else
IA64_FETCHADD(old_value,v,-1,4);
-# endif
-
+#endif
#elif defined (__PPC64__)
atomic_dec((atomic_t *)v);
@@ -233,7 +233,9 @@ dapl_os_atomic_assign (
*/
#ifdef __ia64__
-#ifdef REDHAT_EL4
+#if defined(REDHAT_EL5)
+ current_value = __sync_val_compare_and_swap(v,match_value,new_value);
+#elif defined(REDHAT_EL4)
current_value = ia64_cmpxchg("acq",v,match_value,new_value,4);
#else
current_value = ia64_cmpxchg(acq,v,match_value,new_value,4);
More information about the general
mailing list