Skip to contentSkip to conversation

IBM RT Test Cases v.0.3

announce In review Darren Hart 2 participants 4 messages Jul 20, 2007 – Nov 8, 2007

lore
Share & tools
lore
#0 lore raw

I am pleased to announce the release of rt-tests v.0.3. This release incorporates a new autotools based build system, updated run scripts, and numerous test fixes and updates. In particular we focused on improving the consistency of the tests in terms of criteria and result formatting. Some tests still need to have criteria defined.

Please download the tarball, give the updated documentation a cursory glance and give them a go on your -rt system. Please post your experience here as well as any questions or problems you may run into.

http://kernel.org/pub/linux/kernel/people/dvhart/realtime/tests/

Thanks,

Signature · 3 lines
Darren Hart
IBM Linux Technology Center
Realtime Linux Team
#1 lore raw

RFC PATCH 1/1 powerpc Re: [announce] IBM RT Test Cases v.0.3

Hello Darren Hart,

Quoted 3 lines · Darren Hart

Please download the tarball, give the updated documentation a cursory glance and give them a go on your -rt system. Please post your experience here as well as any questions or problems you may run into.

This patch adds powerpc version of rdtscll() macro which actually reads the timebase register and powerpc version of atomic_inc() to compile. Compile and run tested on a Celleb (a powerpc64 machine).

Comments and suggestions are welcome.

By the way, would you mind if I use and/or refer to your test
results found at http://www.kernel.org/pub/linux/kernel/people/dvhart/ols2007/ to compare with the results taken on powerpc? I'm going to present the test results at the ELC/E2007 (Embedded Linux Conference Europe;
http://www.celinux.org/elc_europe07/elc_europe_index.html).

thanks for your understanding!
-- owa
Corprate Software Engineering Center, TOSHIBA

func/async_handler/async_handler_tsc.c +10 -0
diff -rup rt-test-0.3.org/func/async_handler/async_handler_tsc.c rt-test-0.3/func/async_handler/async_handler_tsc.c
@@ -65,6 +65,16 @@ pthread_mutex_t mutex;
 		__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi << 32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 /* return difference in microseconds */
func/measurement/preempt_timing.c +10 -0
diff -rup rt-test-0.3.org/func/measurement/preempt_timing.c rt-test-0.3/func/measurement/preempt_timing.c
@@ -50,6 +50,16 @@
 		 __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi <<32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 #define ITERATIONS 1000000ULL
func/measurement/rdtsc-latency.c +10 -0
diff -rup rt-test-0.3.org/func/measurement/rdtsc-latency.c rt-test-0.3/func/measurement/rdtsc-latency.c
@@ -42,6 +42,16 @@
 		__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32 bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi <<32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 /* return difference in nanoseconds */
include/librt.h +21 -0
diff -rup rt-test-0.3.org/include/librt.h rt-test-0.3/include/librt.h
@@ -92,6 +92,7 @@ extern int _dbg_lvl;
  */
 static inline int atomic_add(int i, atomic_t *v)
 {
+#if defined(__x86_64__) || defined(__i386__)
 	int __i;
 	__i = i;
 	asm volatile(
@@ -99,6 +100,26 @@ static inline int atomic_add(int i, atom
 			:"=r"(i)
 			:"m"(v->counter), "0"(i));
 	return i + __i;
+
+#elif defined(__powerpc__)
+#define ISYNC_ON_SMP	"\n\tisync\n"
+#define LWSYNC_ON_SMP	__stringify(LWSYNC) "\n"
+	int t;
+	asm volatile(
+"	lwsync \n\
+1:	lwarx   %0,0,%2		# atomic_add_return	\n\
+	add     %0,%1,%0\n\
+	stwcx.  %0,0,%2 \n\
+	bne-    1b"
+	ISYNC_ON_SMP
+ 	: "=&r" (t)
+	: "r" (i), "r" (&v->counter)
+	: "cc", "memory");
+
+	return t;
+#else
+#error
+#endif
 }
 /* atomic_inc: atomically increment the integer passed by reference
  */
#2 lore raw

Re: [RFC] [PATCH] powerpc Re: [announce] IBM RT Test Cases v.0.3

Quoted 10 lines · Tsutomu OWA

Hello Darren Hart,

Quoted 3 lines · Darren Hart

Please download the tarball, give the updated documentation a cursory glance and give them a go on your -rt system. Please post your experience here as well as any questions or problems you may run into.

This patch adds powerpc version of rdtscll() macro which actually reads the timebase register and powerpc version of atomic_inc() to compile. Compile and run tested on a Celleb (a powerpc64 machine).

Thank you for the patch. I think we should perhaps move all the rdtscl stuff into a header file with a more generic name.. rdsystimer or something. Would you mind resending your patch with a:

Signed-off-by Your Name <your_email_address>

So I can properly track the origin and credit you in the changelogs.

Quoted 7 lines

Comments and suggestions are welcome.

By the way, would you mind if I use and/or refer to your test
results found at http://www.kernel.org/pub/linux/kernel/people/dvhart/ols2007/ to compare with the results taken on powerpc? I'm going to present the test results at the ELC/E2007 (Embedded Linux Conference Europe;
http://www.celinux.org/elc_europe07/elc_europe_index.html).

Please feel free to use the results, but do site the ols2007 publication as the source.

--Darren Hart

Quoted 103 lines

thanks for your understanding!
-- owa
Corprate Software Engineering Center, TOSHIBA

diff -rup rt-test-0.3.org/func/async_handler/async_handler_tsc.c rt-test-0.3/func/async_handler/async_handler_tsc.c

func/async_handler/async_handler_tsc.c +10 -0
@@ -65,6 +65,16 @@ pthread_mutex_t mutex;
 		__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi << 32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 /* return difference in microseconds */

diff -rup rt-test-0.3.org/func/measurement/preempt_timing.c rt-test-0.3/func/measurement/preempt_timing.c

func/measurement/preempt_timing.c +10 -0
@@ -50,6 +50,16 @@
 		 __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi <<32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 #define ITERATIONS 1000000ULL

diff -rup rt-test-0.3.org/func/measurement/rdtsc-latency.c rt-test-0.3/func/measurement/rdtsc-latency.c

func/measurement/rdtsc-latency.c +10 -0
@@ -42,6 +42,16 @@
 		__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32 bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi <<32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 /* return difference in nanoseconds */

diff -rup rt-test-0.3.org/include/librt.h rt-test-0.3/include/librt.h

include/librt.h +21 -0
@@ -92,6 +92,7 @@ extern int _dbg_lvl;
  */
 static inline int atomic_add(int i, atomic_t *v)
 {
+#if defined(__x86_64__) || defined(__i386__)
 	int __i;
 	__i = i;
 	asm volatile(
@@ -99,6 +100,26 @@ static inline int atomic_add(int i, atom
 			:"=r"(i)
 			:"m"(v->counter), "0"(i));
 	return i + __i;
+
+#elif defined(__powerpc__)
+#define ISYNC_ON_SMP	"\n\tisync\n"
+#define LWSYNC_ON_SMP	__stringify(LWSYNC) "\n"
+	int t;
+	asm volatile(
+"	lwsync \n\
+1:	lwarx   %0,0,%2		# atomic_add_return	\n\
+	add     %0,%1,%0\n\
+	stwcx.  %0,0,%2 \n\
+	bne-    1b"
+	ISYNC_ON_SMP
+ 	: "=&r" (t)
+	: "r" (i), "r" (&v->counter)
+	: "cc", "memory");
+
+	return t;
+#else
+#error
+#endif
 }
 /* atomic_inc: atomically increment the integer passed by reference
  */
#3 lore raw

Re: [RFC] [PATCH] powerpc Re: [announce] IBM RT Test Cases v.0.3

Hi,

Here is the patch with signed-off-by line. Sorry it took so long.

Quoted 3 lines · Darren Hart

Thank you for the patch. I think we should perhaps move all the rdtscl stuff into a header file with a more generic name.. rdsystimer or something.

Yes, it would be cleaner.

Quoted 5 lines

Would you mind resending your patch with a:

Signed-off-by Your Name <your_email_address>

So I can properly track the origin and credit you in the changelogs.

Thank you. I added it. The patch itself has not been touched.

Quoted 7 lines
Quoted 4 lines

By the way, would you mind if I use and/or refer to your test
results found at http://www.kernel.org/pub/linux/kernel/people/dvhart/ols2007/ to compare with the results taken on powerpc? I'm going to present the test results at the ELC/E2007 (Embedded Linux Conference Europe;
http://www.celinux.org/elc_europe07/elc_europe_index.html).

Please feel free to use the results, but do site the ols2007 publication as the source.

It's very kind of you. Certainly, and I did. The presentation materials will
be available within a few days.

Regards
--- owa

This patch adds powerpc version of rdtscll() macro which actually reads the timebase register and powerpc version of atomic_inc() to compile. Compile and run tested on a Celleb (a powerpc64 machine).

--

func/async_handler/async_handler_tsc.c +10 -0
diff -rup rt-test-0.3.org/func/async_handler/async_handler_tsc.c rt-test-0.3/func/async_handler/async_handler_tsc.c
@@ -65,6 +65,16 @@ pthread_mutex_t mutex;
 		__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi << 32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 /* return difference in microseconds */
func/measurement/preempt_timing.c +10 -0
diff -rup rt-test-0.3.org/func/measurement/preempt_timing.c rt-test-0.3/func/measurement/preempt_timing.c
@@ -50,6 +50,16 @@
 		 __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi <<32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 #define ITERATIONS 1000000ULL
func/measurement/rdtsc-latency.c +10 -0
diff -rup rt-test-0.3.org/func/measurement/rdtsc-latency.c rt-test-0.3/func/measurement/rdtsc-latency.c
@@ -42,6 +42,16 @@
 		__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \
 		val = (uint64_t)high << 32 | low;	\
 	} while(0)
+#elif defined(__powerpc__)	/* 32 bit version */
+#define rdtscll(val)							\
+	 do {								\
+		uint32_t tbhi, tblo ;					\
+		__asm__ __volatile__ ("mftbu %0" : "=r" (tbhi));	\
+		__asm__ __volatile__ ("mftbl %0" : "=r" (tblo));	\
+		val = 1000 * ((uint64_t) tbhi <<32) | tblo;		\
+	} while(0)
+#else
+#error
 #endif
 
 /* return difference in nanoseconds */
include/librt.h +21 -0
diff -rup rt-test-0.3.org/include/librt.h rt-test-0.3/include/librt.h
@@ -92,6 +92,7 @@ extern int _dbg_lvl;
  */
 static inline int atomic_add(int i, atomic_t *v)
 {
+#if defined(__x86_64__) || defined(__i386__)
 	int __i;
 	__i = i;
 	asm volatile(
@@ -99,6 +100,26 @@ static inline int atomic_add(int i, atom
 			:"=r"(i)
 			:"m"(v->counter), "0"(i));
 	return i + __i;
+
+#elif defined(__powerpc__)
+#define ISYNC_ON_SMP	"\n\tisync\n"
+#define LWSYNC_ON_SMP	__stringify(LWSYNC) "\n"
+	int t;
+	asm volatile(
+"	lwsync \n\
+1:	lwarx   %0,0,%2		# atomic_add_return	\n\
+	add     %0,%1,%0\n\
+	stwcx.  %0,0,%2 \n\
+	bne-    1b"
+	ISYNC_ON_SMP
+ 	: "=&r" (t)
+	: "r" (i), "r" (&v->counter)
+	: "cc", "memory");
+
+	return t;
+#else
+#error
+#endif
 }
 /* atomic_inc: atomically increment the integer passed by reference
  */