[openib-general] [PATCH] uDAPL build fix for OS vendor variations of IA64_FETCHADD

Arlin Davis arlin.r.davis at intel.com
Tue Sep 27 12:51:06 PDT 2005


James,

Please review the following uDAPL patch which fixes some ia64 
build problems (atomics) with the latest Redhat EL4.0 update and 
adds support for SuSe. Feel free to come up with a better solution.

Thanks,

-arlin

 
Signed-off by: Arlin Davis <ardavis at ichips.intel.com>

Index: dapl/udapl/linux/dapl_osd.h
===================================================================
--- dapl/udapl/linux/dapl_osd.h	(revision 3541)
+++ dapl/udapl/linux/dapl_osd.h	(working copy)
@@ -83,7 +83,6 @@
 #include <asm/system.h>
 #endif
 
-
 /* Useful debug definitions */
 #ifndef STATIC
 #define STATIC static
@@ -156,13 +155,17 @@
 #ifdef __ia64__
     DAT_COUNT	old_value;
 
-#if OS_VERSION >= LINUX_VERSION(2,6)
-    IA64_FETCHADD  (old_value,v,1,4,rel);
+#ifndef REDHAT_EL4
+#   if OS_RELEASE >= LINUX_VERSION(2,6)
+	IA64_FETCHADD(old_value,v,1,4,rel);
+#   else
+	IA64_FETCHADD(old_value,v,1,4);
+#   endif
 #else
-    IA64_FETCHADD  (old_value,v,1,4);
+   IA64_FETCHADD(old_value,v,1,4);
 #endif
 
-#else  /* !__ia64__ */
+#else
     __asm__ __volatile__ (
 	"lock;" "incl %0"
 	:"=m" (*v)
@@ -184,13 +187,17 @@
 #ifdef __ia64__
     DAT_COUNT	old_value;
 
-#if OS_VERSION >= LINUX_VERSION(2,6)
-    IA64_FETCHADD  (old_value,v,-1,4,rel);
+#ifndef REDHAT_EL4
+#   if OS_RELEASE >= LINUX_VERSION(2,6)
+	IA64_FETCHADD(old_value,v,-1,4,rel);
+#   else
+	IA64_FETCHADD(old_value,v,-1,4);
+#   endif
 #else
-    IA64_FETCHADD  (old_value,v,-1,4);
+   IA64_FETCHADD(old_value,v,-1,4);
 #endif
 
-#else  /* !__ia64__ */
+#else
     __asm__ __volatile__ (
 	"lock;" "decl %0"
 	:"=m" (*v)
@@ -227,9 +234,11 @@
      */
 
 #ifdef __ia64__
-
-current_value = ia64_cmpxchg("acq",v,match_value,new_value,4);
-
+#ifdef 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);
+#endif
 #else
     __asm__ __volatile__ (
         "lock; cmpxchgl %1, %2"
Index: dapl/udapl/dapl_cno_free.c
===================================================================
--- dapl/udapl/dapl_cno_free.c	(revision 3541)
+++ dapl/udapl/dapl_cno_free.c	(working copy)
@@ -74,7 +74,7 @@
 	goto bail;
     }
 
-    if (cno_ptr->cno_ref_count != 0
+    if (dapl_os_atomic_read(&cno_ptr->cno_ref_count) != 0
 	|| cno_ptr->cno_waiters != 0)
     {
 	dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_CNO_IN_USE);
Index: dapl/udapl/Makefile
===================================================================
--- dapl/udapl/Makefile	(revision 3565)
+++ dapl/udapl/Makefile	(working copy)
@@ -57,6 +57,13 @@
 endif
 
 #
+# Set up the default OS Vendor 
+#
+ifndef OS_VENDOR
+OS_VENDOR = REDHAT_EL4
+endif
+
+#
 # CFLAGS definition
 #
 # The makefile will build for multiple providers, but each provider
@@ -67,7 +74,7 @@
 #  CFLAGS	Compile time flags for build
 #
 
-CFLAGS    = -O2 $(CPPFLAGS) -DOS_VERSION=$(OSRELEASE) -DDAPL_DBG
+CFLAGS  = -O2 $(CPPFLAGS)  -D$(OS_VENDOR) -DOS_VERSION=$(OSRELEASE) -DDAPL_DBG
 
 #
 # dummy provider
@@ -152,15 +159,12 @@
 CFLAGS   += --no-strict-aliasing
 CFLAGS   += -Werror
 CFLAGS   += -g3
+CFLAGS   += -fPIC
 
 ifdef GPROF
 CFLAGS   += -pg
 endif
 
-ifeq (${MACH},x86_64)
-CFLAGS += -fPIC
-endif
-
 LD = ld
 
 #
@@ -170,6 +174,10 @@
 LDFLAGS += -lpthread
 LDFLAGS += -init dapl_init
 LDFLAGS += -fini dapl_fini
+ifeq ($(OS_VENDOR),SuSE)
+LDFLAGS += -lgcc_s
+endif
+
 
 AR = ar
 #
Index: dapl/common/dapl_evd_free.c
===================================================================
--- dapl/common/dapl_evd_free.c	(revision 3541)
+++ dapl/common/dapl_evd_free.c	(working copy)
@@ -113,7 +113,7 @@
 #else
     if (cno_ptr != NULL)
     {
-	if (cno_ptr->cno_ref_count == 0 && cno_ptr->cno_waiters > 0)
+	if (dapl_os_atomic_read(&cno_ptr->cno_ref_count) == 0 && cno_ptr->cno_waiters > 0)
 	{
 	    /*
 	     * Last reference on the CNO, trigger a notice. See


-------------- next part --------------
A non-text attachment was scrubbed...
Name: osvendor.patch
Type: application/octet-stream
Size: 3581 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050927/1115d3e1/attachment.obj>


More information about the general mailing list