[openib-general] Fix some suspicious ppc64 code in dapl

Anton Blanchard anton at samba.org
Sat Jun 3 17:22:00 PDT 2006


Hi,

I was reading through the ppc64 specific code in dapl/ and noticed some
suspicious inline assembly.

- EIEIO_ON_SMP and ISYNC_ON_SMP are in kernel UP build optimisations, we
  shouldnt export them to userspace. Replace it with lwsync and isync.
- The comment says its implemenenting cmpxchg64 but in fact its
  implementing cmpxchg32. Fix the comment.

Index: dapl/udapl/linux/dapl_osd.h
===================================================================
--- dapl/udapl/linux/dapl_osd.h	(revision 7621)
+++ dapl/udapl/linux/dapl_osd.h	(working copy)
@@ -238,14 +238,13 @@
 #endif /* __ia64__ */
 #elif defined(__PPC64__)
         __asm__ __volatile__ (
-        EIEIO_ON_SMP
-"1:     lwarx   %0,0,%2         # __cmpxchg_u64\n\
-        cmpd    0,%0,%3\n\
+"       lwsync\n\
+1:      lwarx   %0,0,%2         # __cmpxchg_u32\n\
+        cmpw    0,%0,%3\n\
         bne-    2f\n\
         stwcx.  %4,0,%2\n\
-        bne-    1b"
-        ISYNC_ON_SMP
-        "\n\
+        bne-    1b\n\
+        isync\n\
 2:"
         : "=&r" (current_value), "=m" (*v)
         : "r" (v), "r" (match_value), "r" (new_value), "m" (*v)



More information about the general mailing list