compiling realtime tests for SH.
PATCH 1/1 compiling realtime tests for SH.
Hoping somebody will find useful it.
Regards
Peppe
[PATCH] compiling realtime tests for SH.
This patch adds the atomi_add() define for __sh__; ltp realtime tests seem to show that it works.
The patch also moves the tsc macros form the librttest.h to another header file (named libtsc.h).
Without this I got the following error and no tests were built.
[snip]
In file included from librttest.c:43:
../include/librttest.h:127:2: error: #error ../include/librttest.h:169:2: error: #error In file included from librttest.c:43:
../include/librttest.h: In function ���atomic_add���:
[snip]
The tsc macros header is only included in the following tests (thus where necessary):
o async_handler_tsc.c
o preempt_timing.c
o rdtsc-latency.c
Note1: instead of touching the make process the patch allows to build the tests above also for architecture that do not support tsc, yet. These tests will fail at run-time with ENOTSUP. A warning will appear while compiling as well.
hmm, I do know if it is the right solution but it's simple and a good starting point for me.
Note2: I've just started running this part of the ltp on stlinux targets so I cannot provide results and I don't know which tests will fail.
Note3: realtime tests continues to build and apparently work on i386.
testcases/realtime/func/async_handler/async_handler_tsc.c renamed from testcases/realtime.orig/func/async_handler/async_handler_tsc.c +6 -0
@@ -45,6 +45,7 @@#include <pthread.h> #include <librttest.h> #include <libstats.h> +#include <libtsc.h> #define HANDLER_PRIO 98#define SIGNAL_PRIO 99
@@ -190,6 +191,11 @@int main (int argc,char *argv[]) {int signal_id, handler_id; + +#ifdef TSC_UNSUPPORTED +printf ("Error: test cannot be executed on an arch wihout TSC.\n" ); +return ENOTSUP ; +#endif setup ();rt_init ("h" , parse_args, argc, argv);
testcases/realtime/func/measurement/preempt_timing.c renamed from testcases/realtime.orig/func/measurement/preempt_timing.c +7 -1
@@ -52,7 +52,7 @@#include <sys/mman.h> #include <stdint.h> #include <librttest.h> - +#include <libtsc.h> #define ITERATIONS 1000000ULL#define INTERVALS 10
@@ -86,6 +86,12 @@struct sched_param param;cpu_set_t mask;int err; + +#ifdef TSC_UNSUPPORTED +printf ("Error: test cannot be executed on an arch wihout TSC.\n" ); +return ENOTSUP ; +#endif + max = avg =0 ; min =-1 ;setup ();
testcases/realtime/func/measurement/rdtsc-latency.c renamed from testcases/realtime.orig/func/measurement/rdtsc-latency.c +7 -0
@@ -44,6 +44,7 @@#include <errno.h> #include <stdint.h> #include <librttest.h> +#include <libtsc.h> #define ITERATIONS 1000000
@@ -101,6 +102,12 @@unsigned long long deltas[ITERATIONS ];unsigned long long max, min, avg, tsc_a, tsc_b, tsc_period;struct sched_param param; + +#ifdef TSC_UNSUPPORTED +printf ("Error: test cannot be executed on an arch wihout TSC.\n" ); +return ENOTSUP ; +#endif +setup ();rt_init ("h" ,parse_args,argc,argv);
testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +16 -31
78 lines not on this page · raw message
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +72 -0
72 lines not on this page · raw message
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi Giuseppe,
Thanks for the patch. Meanwhile i did not find the RT guys saying anything about this patch.
Gowri/Amrith/Sripathi,
Any views on this patch ?
Regards--
Subrata
** Also, this fails to apply:
patching file testcases/realtime/func/async_handler/async_handler_tsc.c Hunk #1 succeeded at 46 (offset 1 line).
Hunk #2 succeeded at 193 (offset 2 lines).
patching file testcases/realtime/func/measurement/preempt_timing.c patching file testcases/realtime/func/measurement/rdtsc-latency.c patching file testcases/realtime/include/librttest.h
Hunk #2 succeeded at 98 (offset 1 line).
Hunk #4 succeeded at 138 (offset 1 line).
Hunk #5 succeeded at 337 (offset 8 lines).
patching file testcases/realtime/include/libtsc.h
---
Quoted 335 lines · Giuseppe CAVALLARO
Hoping somebody will find useful it.
Regards
Peppedifferences
between files
attachment
(ltp-full-20090731-sh_RT.patch)[PATCH] compiling realtime tests for SH.
This patch adds the
atomi_add()define for__sh__; ltp realtime tests seem to show that it works.The patch also moves the tsc macros form the
librttest.hto another header file (namedlibtsc.h).Without this I got the following error and no tests were built.
[snip]
In file included from librttest.c:43:
../include/librttest.h:127:2: error: #error../include/librttest.h:169:2: error: #error In file included from librttest.c:43:
../include/librttest.h: In function ‘atomic_add’:
[snip]The tsc macros header is only included in the following tests (thus where necessary):
o
async_handler_tsc.c
opreempt_timing.c
ordtsc-latency.cNote1: instead of touching the make process the patch allows to build the tests above also for architecture that do not support tsc, yet. These tests will fail at run-time with ENOTSUP. A warning will appear while compiling as well.
hmm, I do know if it is the right solution but it's simple and a good starting point for me.Note2: I've just started running this part of the ltp on stlinux targets so I cannot provide results and I don't know which tests will fail.
Note3: realtime tests continues to build and apparently work on i386.
Signed-off-by Giuseppe Cavallaro <[email protected]>diff -urN
ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.cltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c
---ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c2009-11-04 15:39:21.000000000 +0100testcases/realtime/func/async_handler/async_handler_tsc.c renamed from testcases/realtime.orig/func/async_handler/async_handler_tsc.c +6
-0@@ -45,6 +45,7 @@#include <pthread.h> #include <librttest.h> #include <libstats.h> +#include <libtsc.h> #define HANDLER_PRIO 98#define SIGNAL_PRIO 99@@ -190,6 +191,11 @@int main (int argc,char *argv[]) {int signal_id, handler_id; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif setup ();rt_init("h", parse_args, argc, argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.cltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c2009-11-04 15:39:26.000000000 +0100testcases/realtime/func/measurement/preempt_timing.c renamed from testcases/realtime.orig/func/measurement/preempt_timing.c +7
-1@@ -52,7 +52,7 @@#include <sys/mman.h> #include <stdint.h> #include <librttest.h> - +#include <libtsc.h> #define ITERATIONS 1000000ULL#define INTERVALS 10@@ -86,6 +86,12 @@struct sched_param param;cpu_set_t mask;int err; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif + max = avg =0 ; min =-1 ;setup();diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.cltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c2009-11-04 15:38:49.000000000 +0100testcases/realtime/func/measurement/rdtsc-latency.c renamed from testcases/realtime.orig/func/measurement/rdtsc-latency.c +7
-0@@ -44,6 +44,7 @@#include <errno.h> #include <stdint.h> #include <librttest.h> +#include <libtsc.h> #define ITERATIONS 1000000@@ -101,6 +102,12 @@unsigned long long deltas[ITERATIONS ];unsigned long long max, min, avg, tsc_a, tsc_b, tsc_period;struct sched_param param; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif +setup ();rt_init("h",parse_args,argc,argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/include/librttest.hltp-full-20090731/testcases/realtime/include/librttest.h
---ltp-full-20090731/testcases/realtime.orig/include/librttest.h2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/librttest.h2009-11-04
14:21:22.000000000 +0100testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +1
-0@@ -36,6 +36,7 @@* 2006-May-09: improved command line argument handling * 2007-Jul-12: Added latency tracing functions -- Josh Triplett * 2007-Jul-26: Renamed to librttest.h -- Josh Triplett +* 2009-Nov-4: TSC macros within another header -- Giuseppe Cavallaro
******************************************************************************/
testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +0
-19@@ -96,36 +97,7 @@#define thread_quit (T ) (((T)->flags) & THREAD_QUIT)#define PRINT_BUFFER_SIZE (1024*1024*4) - -/* TSC macros */ #define ULL_MAX 18446744073709551615ULL // (1 << 64) - 1 -#if defined(__i386__) -#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) -#elif defined(__x86_64__) -#define rdtscll (val) \ - do { \ - uint32_t low, high; \ - __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \ - val = (uint64_t )high <<32 | low; \ - } while(0) -#elif defined(__powerpc__) -#if defined(__powerpc64__)/* 64bit version */ -#define rdtscll (val) \ - do { \ - __asm__ __volatile__ ("mfspr %0, 268" : "=r" (val)); \ - } while(0) -#else /*__powerpc__ 32bit version */ -#definerdtscll(val) \
- do
{ \
-uint32_ttbhi,
tblo ; \
-__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
-__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
- val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +15
-7- } while(0) -#endif -#else -#error -#endif extern pthread_mutex_t _buffer_mutex;extern char * _print_buffer;@@ -135,7 +107,7 @@/* function prototypes */ -/* atomic_add - add integer to atomic variable +/* atomic_add - add integer to atomic variable and returns a value. * i: integer value to add * v: pointer of type atomic_t */ @@ -165,6 +137,20 @@ : "cc", "memory");return t; +#elif defined(__sh__) +unsigned long t; + + __asm__ __volatile__ ( +"1: movli.l @%2, %0 ! atomic_add_return \n" +" add %1, %0 \n" +" movco.l %0, @%2 \n" +" bf 1b \n" +" synco \n" + :"=&z" (t) + :"r" (i),"r" (&v->counter) + :"t" ); + +return t;#else #error #endif @@ -343,7 +329,6 @@*/ int ts_to_nsec (struct timespec *ts,nsec_t *ns); -/* return difference in microseconds */ unsigned long long tsc_minus (unsigned long long tsc_start,unsigned long long tsc_end);/*
rt_nanosleep: sleep for ns nanoseconds usingclock_nanosleep
diff -urNltp-full-20090731/testcases/realtime.orig/include/libtsc.hltp-full-20090731/testcases/realtime/include/libtsc.h
---ltp-full-20090731/testcases/realtime.orig/include/libtsc.h1970-01-01 01:00:00.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/libtsc.h2009-11-04
15:41:03.000000000 +0100testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +5
-0@@ -0,0 +1,72 @@ +/****************************************************************************** +* +* Copyright © International Business Machines Corp., 2006-2008 +* +* This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
published by
+ * the Free Software Foundation; either version 2 of the License,
or
+ * (at your option) any later version.
+ *+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details.+ *
+ * You should have received a copy of the GNU General Public
License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
+ *
+ * NAME
+ *libtsc.h
+ *
+ * DESCRIPTION
+ *
+ * USAGE:
+ * To be included in some testcases.
+ *
+ * AUTHOR
+ * Darren Hart <[email protected]>
+ * Giuseppe Cavallaro <peppe.cavallarost.com>
+ *
+ * HISTORY
+ * It directly comes from thelibrttest.h(see its HISTORY).
+ *
+ *****************************************************************************/testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +11
-0+ +#undef TSC_UNSUPPORTED + +/* TSC macros */ +#if defined(__i386__) +#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) +#elif defined(__x86_64__) +#define rdtscll (val) \ + do { \ + uint32_t low, high; \ + __asm__ __volatile__ ("rdtsc" : "=a" (low),"=d" (high)); \
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +6
-0+ val = (uint64_t )high <<32 | low; \ + } while (0) +#elif defined(__powerpc__) +#if defined(__powerpc64__)/* 64bit version */ +#define rdtscll (val) \ + do{ \
+__asm____volatile__("mfspr %0, 268" :
"=r" (val)); \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +3
-0+ } while (0) +#else /*__powerpc__ 32bit version */ +#definerdtscll(val) \
+ do
{ \
+uint32_ttbhi,
tblo ; \
+__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
+__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
+ val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +2
-0+ } while (0) +#endif
testcases/realtime/include/libtsc.h line 72
Quoted 10 lines
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +10
-0+#else +#warning TSC UNSUPPORTED +/* All tests will be compiled also for the +* architecture without TSC support (e.g. SH). +* At run-time these will fail with ENOTSUP. +*/ +#define rdtscll (val) do { } while (0) +#define TSC_UNSUPPORTED +#endif +
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 8 lines · On Mon, 09 Nov 2009 23:09:16 +0530 Subrata Modak <[email protected]>…
Hi Giuseppe,
Thanks for the patch. Meanwhile i did not find the RT guys saying anything about this patch.
Gowri/Amrith/Sripathi,
Any views on this patch ?
Hi Subrata,
I think separating out the tests that need TSC from the others is the right thing to do. In future it may be useful to do something similar for atomic_* functions as well.
In my opinion this patch would have been better split into 2
parts: one that separates out TSC parts and the other that adds atomic functions for SH. That would make changelogs easier to search through in future.
Thanks,
Sripathi.
Quoted 366 lines
Regards--
Subrata** Also, this fails to apply:
patching filetestcases/realtime/func/async_handler/async_handler_tsc.cHunk #1 succeeded at 46 (offset 1 line).
Hunk #2 succeeded at 193 (offset 2 lines).
patching filetestcases/realtime/func/measurement/preempt_timing.cpatching filetestcases/realtime/func/measurement/rdtsc-latency.cpatching filetestcases/realtime/include/librttest.h
Hunk #2 succeeded at 98 (offset 1 line).
Hunk #4 succeeded at 138 (offset 1 line).
Hunk #5 succeeded at 337 (offset 8 lines).
patching filetestcases/realtime/include/libtsc.h
---Quoted 335 lines · Giuseppe CAVALLARO
Hoping somebody will find useful it.
Regards
Peppedifferences
between files
attachment
(ltp-full-20090731-sh_RT.patch)[PATCH] compiling realtime tests for SH.
This patch adds the
atomi_add()define for__sh__; ltp realtime tests seem to show that it works.The patch also moves the tsc macros form the
librttest.hto another header file (namedlibtsc.h).Without this I got the following error and no tests were built.
[snip]
In file included from librttest.c:43:
../include/librttest.h:127:2: error: #error../include/librttest.h:169:2: error: #error In file included from librttest.c:43:
../include/librttest.h: In function ‘atomic_add’:
[snip]The tsc macros header is only included in the following tests (thus where necessary):
o
async_handler_tsc.c
opreempt_timing.c
ordtsc-latency.cNote1: instead of touching the make process the patch allows to build the tests above also for architecture that do not support tsc, yet. These tests will fail at run-time with ENOTSUP. A warning will appear while compiling as well.
hmm, I do know if it is the right solution but it's simple and a good starting point for me.Note2: I've just started running this part of the ltp on stlinux targets so I cannot provide results and I don't know which tests will fail.
Note3: realtime tests continues to build and apparently work on i386.
Signed-off-by Giuseppe Cavallaro <[email protected]>diff -urN
ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.cltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c
---ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c2009-11-04 15:39:21.000000000 +0100testcases/realtime/func/async_handler/async_handler_tsc.c renamed from testcases/realtime.orig/func/async_handler/async_handler_tsc.c +6
-0@@ -45,6 +45,7 @@#include <pthread.h> #include <librttest.h> #include <libstats.h> +#include <libtsc.h> #define HANDLER_PRIO 98#define SIGNAL_PRIO 99@@ -190,6 +191,11 @@int main (int argc,char *argv[]) {int signal_id, handler_id; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif setup ();rt_init("h", parse_args, argc, argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.cltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c2009-11-04 15:39:26.000000000 +0100testcases/realtime/func/measurement/preempt_timing.c renamed from testcases/realtime.orig/func/measurement/preempt_timing.c +7
-1@@ -52,7 +52,7 @@#include <sys/mman.h> #include <stdint.h> #include <librttest.h> - +#include <libtsc.h> #define ITERATIONS 1000000ULL#define INTERVALS 10@@ -86,6 +86,12 @@struct sched_param param;cpu_set_t mask;int err; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif + max = avg =0 ; min =-1 ;setup();diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.cltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c2009-11-04 15:38:49.000000000 +0100testcases/realtime/func/measurement/rdtsc-latency.c renamed from testcases/realtime.orig/func/measurement/rdtsc-latency.c +7
-0@@ -44,6 +44,7 @@#include <errno.h> #include <stdint.h> #include <librttest.h> +#include <libtsc.h> #define ITERATIONS 1000000@@ -101,6 +102,12 @@unsigned long long deltas[ITERATIONS ];unsigned long long max, min, avg, tsc_a, tsc_b, tsc_period;struct sched_param param; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif +setup ();rt_init("h",parse_args,argc,argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/include/librttest.hltp-full-20090731/testcases/realtime/include/librttest.h
---ltp-full-20090731/testcases/realtime.orig/include/librttest.h2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/librttest.h2009-11-04
14:21:22.000000000 +0100testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +1
-0@@ -36,6 +36,7 @@* 2006-May-09: improved command line argument handling * 2007-Jul-12: Added latency tracing functions -- Josh Triplett * 2007-Jul-26: Renamed to librttest.h -- Josh Triplett +* 2009-Nov-4: TSC macros within another header -- Giuseppe Cavallaro
******************************************************************************/
testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +0
-19@@ -96,36 +97,7 @@#define thread_quit (T ) (((T)->flags) & THREAD_QUIT)#define PRINT_BUFFER_SIZE (1024*1024*4) - -/* TSC macros */ #define ULL_MAX 18446744073709551615ULL // (1 << 64) - 1 -#if defined(__i386__) -#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) -#elif defined(__x86_64__) -#define rdtscll (val) \ - do { \ - uint32_t low, high; \ - __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \ - val = (uint64_t )high <<32 | low; \ - } while(0) -#elif defined(__powerpc__) -#if defined(__powerpc64__)/* 64bit version */ -#define rdtscll (val) \ - do { \ - __asm__ __volatile__ ("mfspr %0, 268" : "=r" (val)); \ - } while(0) -#else /*__powerpc__ 32bit version */ -#definerdtscll(val) \
- do
{ \
-uint32_ttbhi,
tblo ; \
-__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
-__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
- val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +15
-7- } while(0) -#endif -#else -#error -#endif extern pthread_mutex_t _buffer_mutex;extern char * _print_buffer;@@ -135,7 +107,7 @@/* function prototypes */ -/* atomic_add - add integer to atomic variable +/* atomic_add - add integer to atomic variable and returns a value. * i: integer value to add * v: pointer of type atomic_t */ @@ -165,6 +137,20 @@ : "cc", "memory");return t; +#elif defined(__sh__) +unsigned long t; + + __asm__ __volatile__ ( +"1: movli.l @%2, %0 ! atomic_add_return \n" +" add %1, %0 \n" +" movco.l %0, @%2 \n" +" bf 1b \n" +" synco \n" + :"=&z" (t) + :"r" (i),"r" (&v->counter) + :"t" ); + +return t;#else #error #endif @@ -343,7 +329,6 @@*/ int ts_to_nsec (struct timespec *ts,nsec_t *ns); -/* return difference in microseconds */ unsigned long long tsc_minus (unsigned long long tsc_start,unsigned long long tsc_end);/*
rt_nanosleep: sleep for ns nanoseconds usingclock_nanosleep
diff -urNltp-full-20090731/testcases/realtime.orig/include/libtsc.hltp-full-20090731/testcases/realtime/include/libtsc.h
---ltp-full-20090731/testcases/realtime.orig/include/libtsc.h1970-01-01 01:00:00.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/libtsc.h2009-11-04
15:41:03.000000000 +0100testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +5
-0@@ -0,0 +1,72 @@ +/****************************************************************************** +* +* Copyright © International Business Machines Corp., 2006-2008 +* +* This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
published by
+ * the Free Software Foundation; either version 2 of the License,
or
+ * (at your option) any later version.
+ *+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details.+ *
+ * You should have received a copy of the GNU General Public
License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
+ *
+ * NAME
+ *libtsc.h
+ *
+ * DESCRIPTION
+ *
+ * USAGE:
+ * To be included in some testcases.
+ *
+ * AUTHOR
+ * Darren Hart <[email protected]>
+ * Giuseppe Cavallaro <peppe.cavallarost.com>
+ *
+ * HISTORY
+ * It directly comes from thelibrttest.h(see its HISTORY).
+ *
+ *****************************************************************************/testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +11
-0+ +#undef TSC_UNSUPPORTED + +/* TSC macros */ +#if defined(__i386__) +#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) +#elif defined(__x86_64__) +#define rdtscll (val) \ + do { \ + uint32_t low, high; \ + __asm__ __volatile__ ("rdtsc" : "=a" (low),"=d" (high)); \
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +6
-0+ val = (uint64_t )high <<32 | low; \ + } while (0) +#elif defined(__powerpc__) +#if defined(__powerpc64__)/* 64bit version */ +#define rdtscll (val) \ + do{ \
+__asm____volatile__("mfspr %0, 268" :
"=r" (val)); \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +3
-0+ } while (0) +#else /*__powerpc__ 32bit version */ +#definerdtscll(val) \
+ do
{ \
+uint32_ttbhi,
tblo ; \
+__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
+__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
+ val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +2
-0+ } while (0) +#endif testcases/realtime/include/libtsc.h line 72
Quoted 10 lines
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +10
-0+#else +#warning TSC UNSUPPORTED +/* All tests will be compiled also for the +* architecture without TSC support (e.g. SH). +* At run-time these will fail with ENOTSUP. +*/ +#define rdtscll (val) do { } while (0) +#define TSC_UNSUPPORTED +#endif +------------------------------------------------------------------------------
Quoted 8 lines
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 14 lines · Sripathi Kodi
Quoted 8 lines · On Mon, 09 Nov 2009 23:09:16 +0530 Subrata Modak <[email protected]>…
Hi Giuseppe,
Thanks for the patch. Meanwhile i did not find the RT guys saying anything about this patch.
Gowri/Amrith/Sripathi,
Any views on this patch ?
Hi Subrata,
Quoted 8 lines
I think separating out the tests that need TSC from the others is the right thing to do. In future it may be useful to do something similar for atomic_* functions as well.
In my opinion this patch would have been better split into 2
parts: one that separates out TSC parts and the other that adds atomic functions for SH. That would make changelogs easier to search through in future.
if you like I can resend the patch splitted into two parts. Let me know.
Regards,
Peppe
Quoted 376 lines
Thanks,
Sripathi.Quoted 372 lines
Regards--
Subrata** Also, this fails to apply:
patching filetestcases/realtime/func/async_handler/async_handler_tsc.cHunk #1 succeeded at 46 (offset 1 line).
Hunk #2 succeeded at 193 (offset 2 lines).
patching filetestcases/realtime/func/measurement/preempt_timing.cpatching filetestcases/realtime/func/measurement/rdtsc-latency.cpatching filetestcases/realtime/include/librttest.h
Hunk #2 succeeded at 98 (offset 1 line).
Hunk #4 succeeded at 138 (offset 1 line).
Hunk #5 succeeded at 337 (offset 8 lines).
patching filetestcases/realtime/include/libtsc.h
---Quoted 335 lines · Giuseppe CAVALLARO
Hoping somebody will find useful it.
Regards
Peppedifferences
between files
attachment
(ltp-full-20090731-sh_RT.patch)[PATCH] compiling realtime tests for SH.
This patch adds the
atomi_add()define for__sh__; ltp realtime tests seem to show that it works.The patch also moves the tsc macros form the
librttest.hto another header file (namedlibtsc.h).Without this I got the following error and no tests were built.
[snip]
In file included from librttest.c:43:
../include/librttest.h:127:2: error: #error../include/librttest.h:169:2: error: #error In file included from librttest.c:43:
../include/librttest.h: In function ‘atomic_add’:
[snip]The tsc macros header is only included in the following tests (thus where necessary):
o
async_handler_tsc.c
opreempt_timing.c
ordtsc-latency.cNote1: instead of touching the make process the patch allows to build the tests above also for architecture that do not support tsc, yet. These tests will fail at run-time with ENOTSUP. A warning will appear while compiling as well.
hmm, I do know if it is the right solution but it's simple and a good starting point for me.Note2: I've just started running this part of the ltp on stlinux targets so I cannot provide results and I don't know which tests will fail.
Note3: realtime tests continues to build and apparently work on i386.
Signed-off-by Giuseppe Cavallaro <[email protected]>diff -urN
ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.cltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c
---ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c2009-11-04 15:39:21.000000000 +0100testcases/realtime/func/async_handler/async_handler_tsc.c renamed from testcases/realtime.orig/func/async_handler/async_handler_tsc.c +6
-0@@ -45,6 +45,7 @@#include <pthread.h> #include <librttest.h> #include <libstats.h> +#include <libtsc.h> #define HANDLER_PRIO 98#define SIGNAL_PRIO 99@@ -190,6 +191,11 @@int main (int argc,char *argv[]) {int signal_id, handler_id; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif setup ();rt_init("h", parse_args, argc, argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.cltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c2009-11-04 15:39:26.000000000 +0100testcases/realtime/func/measurement/preempt_timing.c renamed from testcases/realtime.orig/func/measurement/preempt_timing.c +7
-1@@ -52,7 +52,7 @@#include <sys/mman.h> #include <stdint.h> #include <librttest.h> - +#include <libtsc.h> #define ITERATIONS 1000000ULL#define INTERVALS 10@@ -86,6 +86,12 @@struct sched_param param;cpu_set_t mask;int err; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif + max = avg =0 ; min =-1 ;setup();diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.cltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c2009-11-04 15:38:49.000000000 +0100testcases/realtime/func/measurement/rdtsc-latency.c renamed from testcases/realtime.orig/func/measurement/rdtsc-latency.c +7
-0@@ -44,6 +44,7 @@#include <errno.h> #include <stdint.h> #include <librttest.h> +#include <libtsc.h> #define ITERATIONS 1000000@@ -101,6 +102,12 @@unsigned long long deltas[ITERATIONS ];unsigned long long max, min, avg, tsc_a, tsc_b, tsc_period;struct sched_param param; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif +setup ();rt_init("h",parse_args,argc,argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/include/librttest.hltp-full-20090731/testcases/realtime/include/librttest.h
---ltp-full-20090731/testcases/realtime.orig/include/librttest.h2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/librttest.h2009-11-04
14:21:22.000000000 +0100testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +1
-0@@ -36,6 +36,7 @@* 2006-May-09: improved command line argument handling * 2007-Jul-12: Added latency tracing functions -- Josh Triplett * 2007-Jul-26: Renamed to librttest.h -- Josh Triplett +* 2009-Nov-4: TSC macros within another header -- Giuseppe Cavallaro
******************************************************************************/
testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +0
-19@@ -96,36 +97,7 @@#define thread_quit (T ) (((T)->flags) & THREAD_QUIT)#define PRINT_BUFFER_SIZE (1024*1024*4) - -/* TSC macros */ #define ULL_MAX 18446744073709551615ULL // (1 << 64) - 1 -#if defined(__i386__) -#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) -#elif defined(__x86_64__) -#define rdtscll (val) \ - do { \ - uint32_t low, high; \ - __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \ - val = (uint64_t )high <<32 | low; \ - } while(0) -#elif defined(__powerpc__) -#if defined(__powerpc64__)/* 64bit version */ -#define rdtscll (val) \ - do { \ - __asm__ __volatile__ ("mfspr %0, 268" : "=r" (val)); \ - } while(0) -#else /*__powerpc__ 32bit version */ -#definerdtscll(val) \
- do
{ \
-uint32_ttbhi,
tblo ; \
-__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
-__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
- val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +15
-7- } while(0) -#endif -#else -#error -#endif extern pthread_mutex_t _buffer_mutex;extern char * _print_buffer;@@ -135,7 +107,7 @@/* function prototypes */ -/* atomic_add - add integer to atomic variable +/* atomic_add - add integer to atomic variable and returns a value. * i: integer value to add * v: pointer of type atomic_t */ @@ -165,6 +137,20 @@ : "cc", "memory");return t; +#elif defined(__sh__) +unsigned long t; + + __asm__ __volatile__ ( +"1: movli.l @%2, %0 ! atomic_add_return \n" +" add %1, %0 \n" +" movco.l %0, @%2 \n" +" bf 1b \n" +" synco \n" + :"=&z" (t) + :"r" (i),"r" (&v->counter) + :"t" ); + +return t;#else #error #endif @@ -343,7 +329,6 @@*/ int ts_to_nsec (struct timespec *ts,nsec_t *ns); -/* return difference in microseconds */ unsigned long long tsc_minus (unsigned long long tsc_start,unsigned long long tsc_end);/*
rt_nanosleep: sleep for ns nanoseconds usingclock_nanosleep
diff -urNltp-full-20090731/testcases/realtime.orig/include/libtsc.hltp-full-20090731/testcases/realtime/include/libtsc.h
---ltp-full-20090731/testcases/realtime.orig/include/libtsc.h1970-01-01 01:00:00.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/libtsc.h2009-11-04
15:41:03.000000000 +0100testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +5
-0@@ -0,0 +1,72 @@ +/****************************************************************************** +* +* Copyright © International Business Machines Corp., 2006-2008 +* +* This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
published by
+ * the Free Software Foundation; either version 2 of the License,
or
+ * (at your option) any later version.
+ *+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details.+ *
+ * You should have received a copy of the GNU General Public
License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
+ *
+ * NAME
+ *libtsc.h
+ *
+ * DESCRIPTION
+ *
+ * USAGE:
+ * To be included in some testcases.
+ *
+ * AUTHOR
+ * Darren Hart <[email protected]>
+ * Giuseppe Cavallaro <peppe.cavallarost.com>
+ *
+ * HISTORY
+ * It directly comes from thelibrttest.h(see its HISTORY).
+ *
+ *****************************************************************************/testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +11
-0+ +#undef TSC_UNSUPPORTED + +/* TSC macros */ +#if defined(__i386__) +#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) +#elif defined(__x86_64__) +#define rdtscll (val) \ + do { \ + uint32_t low, high; \ + __asm__ __volatile__ ("rdtsc" : "=a" (low),"=d" (high)); \
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +6
-0+ val = (uint64_t )high <<32 | low; \ + } while (0) +#elif defined(__powerpc__) +#if defined(__powerpc64__)/* 64bit version */ +#define rdtscll (val) \ + do{ \
+__asm____volatile__("mfspr %0, 268" :
"=r" (val)); \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +3
-0+ } while (0) +#else /*__powerpc__ 32bit version */ +#definerdtscll(val) \
+ do
{ \
+uint32_ttbhi,
tblo ; \
+__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
+__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
+ val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +2
-0+ } while (0) +#endif testcases/realtime/include/libtsc.h line 72
Quoted 10 lines
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +10
-0+#else +#warning TSC UNSUPPORTED +/* All tests will be compiled also for the +* architecture without TSC support (e.g. SH). +* At run-time these will fail with ENOTSUP. +*/ +#define rdtscll (val) do { } while (0) +#define TSC_UNSUPPORTED +#endif +------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkr9DXwACgkQ2Xo3j31MSSKO7wCgsH3KAqveTZfPlZhTeQDMLrMl +w4An0XRbe7MZQa/Nk5Rs6D58rvIHIZk
=MRBR
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi Giuseppe,
Quoted 22 lines · Giuseppe CAVALLARO
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 18 lines · Sripathi Kodi
Quoted 8 lines · On Mon, 09 Nov 2009 23:09:16 +0530 Subrata Modak <[email protected]>…
Hi Giuseppe,
Thanks for the patch. Meanwhile i did not find the RT guys saying anything about this patch.
Gowri/Amrith/Sripathi,
Any views on this patch ?
Hi Subrata,
I think separating out the tests that need TSC from the others is the right thing to do. In future it may be useful to do something similar for atomic_* functions as well.
Quoted 7 lines
Quoted 4 lines
In my opinion this patch would have been better split into 2
parts: one that separates out TSC parts and the other that adds atomic functions for SH. That would make changelogs easier to search through in future.if you like I can resend the patch splitted into two parts. Let me know.
Yah, Please do so. I will do separate check-ins with separate LOG messages.
Regards--
Subrata
Quoted 380 lines
Regards,
PeppeQuoted 376 lines
Thanks,
Sripathi.Quoted 372 lines
Regards--
Subrata** Also, this fails to apply:
patching filetestcases/realtime/func/async_handler/async_handler_tsc.cHunk #1 succeeded at 46 (offset 1 line).
Hunk #2 succeeded at 193 (offset 2 lines).
patching filetestcases/realtime/func/measurement/preempt_timing.cpatching filetestcases/realtime/func/measurement/rdtsc-latency.cpatching filetestcases/realtime/include/librttest.h
Hunk #2 succeeded at 98 (offset 1 line).
Hunk #4 succeeded at 138 (offset 1 line).
Hunk #5 succeeded at 337 (offset 8 lines).
patching filetestcases/realtime/include/libtsc.h
---Quoted 335 lines · Giuseppe CAVALLARO
Hoping somebody will find useful it.
Regards
Peppedifferences
between files
attachment
(ltp-full-20090731-sh_RT.patch)[PATCH] compiling realtime tests for SH.
This patch adds the
atomi_add()define for__sh__; ltp realtime tests seem to show that it works.The patch also moves the tsc macros form the
librttest.hto another header file (namedlibtsc.h).Without this I got the following error and no tests were built.
[snip]
In file included from librttest.c:43:
../include/librttest.h:127:2: error: #error../include/librttest.h:169:2: error: #error In file included from librttest.c:43:
../include/librttest.h: In function ‘atomic_add’:
[snip]The tsc macros header is only included in the following tests (thus where necessary):
o
async_handler_tsc.c
opreempt_timing.c
ordtsc-latency.cNote1: instead of touching the make process the patch allows to build the tests above also for architecture that do not support tsc, yet. These tests will fail at run-time with ENOTSUP. A warning will appear while compiling as well.
hmm, I do know if it is the right solution but it's simple and a good starting point for me.Note2: I've just started running this part of the ltp on stlinux targets so I cannot provide results and I don't know which tests will fail.
Note3: realtime tests continues to build and apparently work on i386.
Signed-off-by Giuseppe Cavallaro <[email protected]>diff -urN
ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.cltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c
---ltp-full-20090731/testcases/realtime.orig/func/async_handler/async_handler_tsc.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/async_handler/async_handler_tsc.c2009-11-04 15:39:21.000000000 +0100testcases/realtime/func/async_handler/async_handler_tsc.c renamed from testcases/realtime.orig/func/async_handler/async_handler_tsc.c +6
-0@@ -45,6 +45,7 @@#include <pthread.h> #include <librttest.h> #include <libstats.h> +#include <libtsc.h> #define HANDLER_PRIO 98#define SIGNAL_PRIO 99@@ -190,6 +191,11 @@int main (int argc,char *argv[]) {int signal_id, handler_id; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif setup ();rt_init("h", parse_args, argc, argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.cltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/preempt_timing.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/preempt_timing.c2009-11-04 15:39:26.000000000 +0100testcases/realtime/func/measurement/preempt_timing.c renamed from testcases/realtime.orig/func/measurement/preempt_timing.c +7
-1@@ -52,7 +52,7 @@#include <sys/mman.h> #include <stdint.h> #include <librttest.h> - +#include <libtsc.h> #define ITERATIONS 1000000ULL#define INTERVALS 10@@ -86,6 +86,12 @@struct sched_param param;cpu_set_t mask;int err; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif + max = avg =0 ; min =-1 ;setup();diff -urN
ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.cltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c
---ltp-full-20090731/testcases/realtime.orig/func/measurement/rdtsc-latency.c2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/func/measurement/rdtsc-latency.c2009-11-04 15:38:49.000000000 +0100testcases/realtime/func/measurement/rdtsc-latency.c renamed from testcases/realtime.orig/func/measurement/rdtsc-latency.c +7
-0@@ -44,6 +44,7 @@#include <errno.h> #include <stdint.h> #include <librttest.h> +#include <libtsc.h> #define ITERATIONS 1000000@@ -101,6 +102,12 @@unsigned long long deltas[ITERATIONS ];unsigned long long max, min, avg, tsc_a, tsc_b, tsc_period;struct sched_param param; + +#ifdef TSC_UNSUPPORTED + printf("Error: test cannot be executed on an arch wihout TSC.\n"); +return ENOTSUP ; +#endif +setup ();rt_init("h",parse_args,argc,argv);diff -urN
ltp-full-20090731/testcases/realtime.orig/include/librttest.hltp-full-20090731/testcases/realtime/include/librttest.h
---ltp-full-20090731/testcases/realtime.orig/include/librttest.h2009-11-04 15:55:58.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/librttest.h2009-11-04
14:21:22.000000000 +0100testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +1
-0@@ -36,6 +36,7 @@* 2006-May-09: improved command line argument handling * 2007-Jul-12: Added latency tracing functions -- Josh Triplett * 2007-Jul-26: Renamed to librttest.h -- Josh Triplett +* 2009-Nov-4: TSC macros within another header -- Giuseppe Cavallaro
******************************************************************************/
testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +0
-19@@ -96,36 +97,7 @@#define thread_quit (T ) (((T)->flags) & THREAD_QUIT)#define PRINT_BUFFER_SIZE (1024*1024*4) - -/* TSC macros */ #define ULL_MAX 18446744073709551615ULL // (1 << 64) - 1 -#if defined(__i386__) -#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) -#elif defined(__x86_64__) -#define rdtscll (val) \ - do { \ - uint32_t low, high; \ - __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \ - val = (uint64_t )high <<32 | low; \ - } while(0) -#elif defined(__powerpc__) -#if defined(__powerpc64__)/* 64bit version */ -#define rdtscll (val) \ - do { \ - __asm__ __volatile__ ("mfspr %0, 268" : "=r" (val)); \ - } while(0) -#else /*__powerpc__ 32bit version */ -#definerdtscll(val) \
- do
{ \
-uint32_ttbhi,
tblo ; \
-__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
-__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
- val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +15
-7- } while(0) -#endif -#else -#error -#endif extern pthread_mutex_t _buffer_mutex;extern char * _print_buffer;@@ -135,7 +107,7 @@/* function prototypes */ -/* atomic_add - add integer to atomic variable +/* atomic_add - add integer to atomic variable and returns a value. * i: integer value to add * v: pointer of type atomic_t */ @@ -165,6 +137,20 @@ : "cc", "memory");return t; +#elif defined(__sh__) +unsigned long t; + + __asm__ __volatile__ ( +"1: movli.l @%2, %0 ! atomic_add_return \n" +" add %1, %0 \n" +" movco.l %0, @%2 \n" +" bf 1b \n" +" synco \n" + :"=&z" (t) + :"r" (i),"r" (&v->counter) + :"t" ); + +return t;#else #error #endif @@ -343,7 +329,6 @@*/ int ts_to_nsec (struct timespec *ts,nsec_t *ns); -/* return difference in microseconds */ unsigned long long tsc_minus (unsigned long long tsc_start,unsigned long long tsc_end);/*
rt_nanosleep: sleep for ns nanoseconds usingclock_nanosleep
diff -urNltp-full-20090731/testcases/realtime.orig/include/libtsc.hltp-full-20090731/testcases/realtime/include/libtsc.h
---ltp-full-20090731/testcases/realtime.orig/include/libtsc.h1970-01-01 01:00:00.000000000 +0100
+++ltp-full-20090731/testcases/realtime/include/libtsc.h2009-11-04
15:41:03.000000000 +0100testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +5
-0@@ -0,0 +1,72 @@ +/****************************************************************************** +* +* Copyright © International Business Machines Corp., 2006-2008 +* +* This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
published by
+ * the Free Software Foundation; either version 2 of the License,
or
+ * (at your option) any later version.
+ *+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details.+ *
+ * You should have received a copy of the GNU General Public
License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
+ *
+ * NAME
+ *libtsc.h
+ *
+ * DESCRIPTION
+ *
+ * USAGE:
+ * To be included in some testcases.
+ *
+ * AUTHOR
+ * Darren Hart <[email protected]>
+ * Giuseppe Cavallaro <peppe.cavallarost.com>
+ *
+ * HISTORY
+ * It directly comes from thelibrttest.h(see its HISTORY).
+ *
+ *****************************************************************************/testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +11
-0+ +#undef TSC_UNSUPPORTED + +/* TSC macros */ +#if defined(__i386__) +#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) +#elif defined(__x86_64__) +#define rdtscll (val) \ + do { \ + uint32_t low, high; \ + __asm__ __volatile__ ("rdtsc" : "=a" (low),"=d" (high)); \
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +6
-0+ val = (uint64_t )high <<32 | low; \ + } while (0) +#elif defined(__powerpc__) +#if defined(__powerpc64__)/* 64bit version */ +#define rdtscll (val) \ + do{ \
+__asm____volatile__("mfspr %0, 268" :
"=r" (val)); \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +3
-0+ } while (0) +#else /*__powerpc__ 32bit version */ +#definerdtscll(val) \
+ do
{ \
+uint32_ttbhi,
tblo ; \
+__asm____volatile__("mftbu %0" :
"=r" (tbhi)); \
+__asm____volatile__("mftbl %0" :
"=r" (tblo)); \
+ val = 1000 * ((uint64_t) tbhi << 32) |
tblo; \testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +2
-0+ } while (0) +#endif testcases/realtime/include/libtsc.h line 72
Quoted 10 lines
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +10
-0+#else +#warning TSC UNSUPPORTED +/* All tests will be compiled also for the +* architecture without TSC support (e.g. SH). +* At run-time these will fail with ENOTSUP. +*/ +#define rdtscll (val) do { } while (0) +#define TSC_UNSUPPORTED +#endif +------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 8 lines
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.orgiEYEARECAAYFAkr9DXwACgkQ2Xo3j31MSSKO7wCgsH3KAqveTZfPlZhTeQDMLrMl +w4An0XRbe7MZQa/Nk5Rs6D58rvIHIZk
=MRBR
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 9 lines · Subrata Modak
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
In my opinion this patch would have been better split into 2
parts: one that separates out TSC parts and the other that adds atomic functions for SH. That would make changelogs easier to search through in future.if you like I can resend the patch splitted into two parts. Let me know.
Quoted 2 lines
Yah, Please do so. I will do separate check-ins with separate LOG messages.
Hi Subrata,
in attachment the two patches.
Regards
Peppe
Quoted 4 lines
Quoted 3 lines
Regards--
Subrata
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAksBLyoACgkQ2Xo3j31MSSIMfgCgn3qXNrOd/2mhyeri3loHGoBg u1IAoIhbksE6wEIRWLYoIMGhQBZGF1dj
=QsPg
-----END PGP SIGNATURE-----
[PATCH (1/2)] add atomi_add() define for __sh__.
testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +15 -1
@@ -135,7 +135,7 @@ extern double pass_criteria;/* function prototypes */ -/* atomic_add - add integer to atomic variable +/* atomic_add - add integer to atomic variable and returns a value. * i: integer value to add * v: pointer of type atomic_t */
@@ -165,6 +165,20 @@ static inline int atomic_add(int i, atom : "cc", "memory");return t; +#elif defined(__sh__) +unsigned long t; + + __asm__ __volatile__ ( +"1: movli.l @%2, %0 \n" +" add %1, %0 \n" +" movco.l %0, @%2 \n" +" bf 1b \n" +" synco \n" + :"=&z" (t) + :"r" (i),"r" (&v->counter) + :"t" ); + +return t;#else #error #endif
[PATCH (2/2)] splitting the tsc support.
The patch moves the tsc macros form the librttest.h to another header file (named libtsc.h).
Without this I got the following error and no tests were built.
[snip]
In file included from librttest.c:43:
../include/librttest.h:127:2: error: #error ../include/librttest.h:169:2: error: #error In file included from librttest.c:43:
../include/librttest.h: In function ���atomic_add���:
[snip]
The tsc macros header is only included in the following tests (thus where necessary):
o async_handler_tsc.c
o preempt_timing.c
o rdtsc-latency.c
Note1: instead of touching the make process the patch allows to build the tests above also for architecture that do not support tsc, yet. These tests will fail at run-time with ENOTSUP. A warning will appear while compiling as well.
hmm, I do know if it is the right solution but it's simple and a good starting point for me.
testcases/realtime/func/async_handler/async_handler_tsc.c renamed from testcases/realtime.orig/func/async_handler/async_handler_tsc.c +6 -0
@@ -45,6 +45,7 @@#include <pthread.h> #include <librttest.h> #include <libstats.h> +#include <libtsc.h> #define HANDLER_PRIO 98#define SIGNAL_PRIO 99
@@ -190,6 +191,11 @@ void *signal_thread(void *arg)int main (int argc,char *argv[]) {int signal_id, handler_id; + +#ifdef TSC_UNSUPPORTED +printf ("Error: test cannot be executed on an arch wihout TSC.\n" ); +return ENOTSUP ; +#endif setup ();rt_init ("h" , parse_args, argc, argv);
testcases/realtime/func/measurement/preempt_timing.c renamed from testcases/realtime.orig/func/measurement/preempt_timing.c +7 -1
@@ -52,7 +52,7 @@#include <sys/mman.h> #include <stdint.h> #include <librttest.h> - +#include <libtsc.h> #define ITERATIONS 1000000ULL#define INTERVALS 10
@@ -86,6 +86,12 @@ int main(int argc, char *argv[])struct sched_param param;cpu_set_t mask;int err; + +#ifdef TSC_UNSUPPORTED +printf ("Error: test cannot be executed on an arch wihout TSC.\n" ); +return ENOTSUP ; +#endif + max = avg =0 ; min =-1 ;setup ();
testcases/realtime/func/measurement/rdtsc-latency.c renamed from testcases/realtime.orig/func/measurement/rdtsc-latency.c +7 -0
@@ -44,6 +44,7 @@#include <errno.h> #include <stdint.h> #include <librttest.h> +#include <libtsc.h> #define ITERATIONS 1000000
@@ -101,6 +102,12 @@ int main(int argc, char *argv[])unsigned long long deltas[ITERATIONS ];unsigned long long max, min, avg, tsc_a, tsc_b, tsc_period;struct sched_param param; + +#ifdef TSC_UNSUPPORTED +printf ("Error: test cannot be executed on an arch wihout TSC.\n" ); +return ENOTSUP ; +#endif +setup ();rt_init ("h" ,parse_args,argc,argv);
testcases/realtime/include/librttest.h renamed from testcases/realtime.orig/include/librttest.h +1 -29
@@ -36,6 +36,7 @@* 2006-May-09: improved command line argument handling * 2007-Jul-12: Added latency tracing functions -- Josh Triplett * 2007-Jul-26: Renamed to librttest.h -- Josh Triplett +* 2009-Nov-4: TSC macros within another header -- Giuseppe Cavallaro * *****************************************************************************/
@@ -96,36 +97,7 @@ typedef struct { volatile int counter; }#define thread_quit (T ) (((T)->flags) & THREAD_QUIT)#define PRINT_BUFFER_SIZE (1024*1024*4) - -/* TSC macros */ #define ULL_MAX 18446744073709551615ULL // (1 << 64) - 1 -#if defined(__i386__) -#define rdtscll (val) __asm__ __volatile__("rdtsc" : "=A" (val)) -#elif defined(__x86_64__) -#define rdtscll (val) \ - do { \ - uint32_t low, high; \ - __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high)); \ - val = (uint64_t)high << 32 | low; \ - } while(0) -#elif defined(__powerpc__) -#if defined(__powerpc64__)/* 64bit version */ -#define rdtscll (val) \ - do { \ - __asm__ __volatile__ ("mfspr %0, 268" : "=r" (val)); \ - } while(0) -#else /*__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) -#endif -#else -#error -#endif extern pthread_mutex_t _buffer_mutex;extern char * _print_buffer;
testcases/realtime/include/libtsc.h renamed from testcases/realtime.orig/include/libtsc.h +72 -0
72 lines not on this page · raw message
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 8 lines · Giuseppe CAVALLARO
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 4 lines · Subrata Modak
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
In my opinion this patch would have been better split into 2
parts: one that separates out TSC parts and the other that adds atomic functions for SH. That would make changelogs easier to search through in future.
Quoted 8 lines
Quoted 5 lines
if you like I can resend the patch splitted into two parts. Let me know.
Quoted 2 lines
Yah, Please do so. I will do separate check-ins with separate LOG messages.
Hi Subrata,
in attachment the two patches.
Thanks. Applied.
Regards--
Subrata
Quoted 8 lines
Regards
PeppeQuoted 4 lines
Quoted 3 lines
Regards--
Subrata
Quoted 8 lines
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.orgiEYEARECAAYFAksBLyoACgkQ2Xo3j31MSSIMfgCgn3qXNrOd/2mhyeri3loHGoBg u1IAoIhbksE6wEIRWLYoIMGhQBZGF1dj
=QsPg
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list