Hi!
I was trying to build perftests on SLES9 SP1 (RC5).
I was getting compilation errors: apparently on this distribution
asm/timex.h includes all kind of kernel headers and
so is not fit to be used to build userspace apps.

I plan to check in the following patch to get us rid of this dependency
on asm/timex.h for PPC64 and IA64.
Note that get_cycles kernel function that we use just happens
to be incline, it could move out of line at any point, so
it might be a good idea to do this, regardless.

---

Multiple distributions have asm/timex.h that cant be used in userpace.
Lets just insert the inline assembly implementation as is.

Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]>

Index: openib/src/userspace/perftest/get_clock.h
===================================================================
--- openib/src/userspace/perftest/get_clock.h   (revision 4692)
+++ openib/src/userspace/perftest/get_clock.h   (working copy)
@@ -47,8 +47,9 @@ static inline cycles_t get_cycles()
        val = (val << 32) | low;
        return val;
 }
-#elif defined(__PPC__)
+#elif defined(__PPC__) || || defined(__PPC64__)
 /* Note: only PPC CPUs which have mftb instruction are supported. */
+/* PPC64 has mftb */
 typedef unsigned long long cycles_t;
 static inline cycles_t get_cycles()
 {
@@ -57,10 +58,17 @@ static inline cycles_t get_cycles()
        asm volatile ("mftb %0" : "=r" (ret) : );
        return ret;
 }
-#elif defined(__ia64__) || defined(__PPC64__)
+#elif defined(__ia64__)
 /* Itanium2 and up has ar.itc (Itanium1 has errata) */
-/* PPC64 has mftb */
-#include <asm/timex.h>
+typedef unsigned long cycles_t;
+static inline cycles_t get_cycles()
+{
+       cycles_t ret;
+
+       asm volatile ("mov %0=ar.itc" : "=r" (ret) ::);
+       return ret;
+}
+
 #else
 #warning get_cycles not implemented for this architecture: attempt asm/timex.h
 #include <asm/timex.h>



-- 
MST
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to