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

Anton Blanchard anton at samba.org
Mon Jul 17 02:38:53 PDT 2006


 
Hi,

> Thank you Anton. Could you replying with a signed off by line? I'll 
> properly attribute this fix to you in the commit log.

Sorry, I let this one slip. Here it is.

Anton

--

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.

Signed-off-by: Anton Blanchard <anton at samba.org>

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