Add smp option to ptsematest and svsematest
cover Add smp option to ptsematest and svsematest
The -S (--smp) option of cyclictest has proven to be quite useful. Add it to ptsematest and svsematest as well.
PATCH 1/2 add-smp-option-to-ptsematest.patch
Add SMP testing option (-S, --smp) to ptsematest, same as in cyclictest.
src/ptsematest/ptsematest.c +23 -2
@@ -173,6 +173,8 @@ static void display_help(void)"-i INTV --interval=INTV base interval of thread in us default=1000\n" "-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n" "-p PRIO --prio=PRIO priority\n" +"-S --smp SMP testing: options -a -t and same priority\n" +" of all threads\n" "-t --threads one thread per available processor\n" "-t [NUM] --threads=NUM number of threads:\n" " without NUM, threads = max_cpus\n"
@@ -189,6 +191,8 @@ static int num_threads = 1;static int max_cycles;static int interval =1000 ;static int distance =500 ; +static int smp; +static int sameprio;static void process_options (int argc,char *argv[]) {
@@ -205,16 +209,21 @@ static void process_options (int argc, c {"interval", required_argument, NULL, 'i'}, {"loops", required_argument, NULL, 'l'}, {"priority", required_argument, NULL, 'p'}, + {"smp", no_argument, NULL, 'S'}, {"threads", optional_argument, NULL, 't'}, {"help", no_argument, NULL, '?'}, {NULL, 0, NULL, 0} }; -int c =getopt_long (argc, argv,"a::b:d:i:l:p:t::" , +int c =getopt_long (argc, argv,"a::b:d:i:l:p:St::" , long_options, &option_index);if (c ==-1 )break ;switch (c) {case 'a' : +if (smp) { +warn ("-a ignored due to --smp\n" ); +break ; + }if (optarg !=NULL ) { affinity =atoi (optarg); setaffinity =AFFINITY_SPECIFIED ;
@@ -230,7 +239,16 @@ static void process_options (int argc, ccase 'i' : interval =atoi (optarg);break ;case 'l' : max_cycles =atoi (optarg);break ;case 'p' : priority =atoi (optarg);break ; +case 'S' : + smp =1 ; + num_threads = max_cpus; + setaffinity =AFFINITY_USEALL ; +break ;case 't' : +if (smp) { +warn ("-t ignored due to --smp\n" ); +break ; + }if (optarg !=NULL ) num_threads =atoi (optarg);else if (optind<argc &&atoi (argv[optind]))
@@ -261,6 +279,9 @@ static void process_options (int argc, cif (num_threads <1 ) error =1 ; +if (priority && smp) + sameprio =1 ; +if (error)display_help (); }
@@ -327,7 +348,7 @@ int main(int argc, char *argv[]) } receiver[i].priority = priority; receiver[i].tracelimit = tracelimit; -if (priority >0 ) +if (priority >1 && !sameprio) priority--; receiver[i].delay.tv_sec = interval /USEC_PER_SEC ; receiver[i].delay.tv_nsec = (interval %USEC_PER_SEC ) *1000 ;
Re: [PATCH 1/2] add-smp-option-to-ptsematest.patch
Quoted 78 lines · Carsten Emde
Add SMP testing option (-S, --smp) to ptsematest, same as in cyclictest.
Signed-off-by Carsten Emde <[email protected]>Index:
rt-tests/src/ptsematest/ptsematest.c
===================================================================src/ptsematest/ptsematest.c +0
-0@@ -173,6 +173,8 @@ static void display_help(void)"-i INTV --interval=INTV base interval of thread in us default=1000\n" "-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n" "-p PRIO --prio=PRIO priority\n"
+ "-S --smp SMP testing: options -a -t and same priority\n"
+ " of all threads\n"
"-t --threads one thread per available processor\n" "-t [NUM] --threads=NUM number of threads:\n"
" without NUM, threads = max_cpus\n"src/ptsematest/ptsematest.c +4
-1@@ -189,6 +191,8 @@ static int num_threads = 1; static int max_cycles; static int interval = 1000; static int distance = 500; +static int smp; +static int sameprio; static void process_options (int argc, char *argv[]) {@@ -205,16 +209,21 @@ static void process_options (int argc, c {"interval", required_argument, NULL, 'i'}, {"loops", required_argument, NULL, 'l'}, {"priority", required_argument, NULL, 'p'}, + {"smp", no_argument, NULL, 'S'}, {"threads", optional_argument, NULL, 't'}, {"help", no_argument, NULL, '?'}, {NULL, 0, NULL, 0} }; - int c = getopt_long (argc, argv, "a::b:d:i:l:p:t::", + int c = getopt_long (argc, argv, "a::b:d:i:l:p:St::", long_options, &option_index); if (c == -1) break; switch (c) {case 'a':
+ if (smp) {
+warn("-a ignored due to --smp\n");
+ break;
+ }
if (optarg != NULL) {
affinity = atoi(optarg); setaffinity =AFFINITY_SPECIFIED;src/ptsematest/ptsematest.c +5
-0@@ -230,7 +239,16 @@ static void process_options (int argc, c case 'i': interval = atoi(optarg); break; case 'l': max_cycles = atoi(optarg); break; case 'p': priority = atoi(optarg); break; + case 'S': + smp = 1; + num_threads = max_cpus; + setaffinity = AFFINITY_USEALL; + break;case 't':
+ if (smp) {
+warn("-t ignored due to --smp\n");
+ break;
+ }
if (optarg != NULL)
num_threads = atoi(optarg); else if (optind<argc &&atoi(argv[optind]))src/ptsematest/ptsematest.c +3
-0@@ -261,6 +279,9 @@ static void process_options (int argc, c if (num_threads < 1) error = 1; + if (priority && smp) + sameprio = 1; + if (error) display_help (); }
src/ptsematest/ptsematest.c int main(int argc, char *argv[])
Quoted 10 lines
src/ptsematest/ptsematest.c +1
-2@@ -327,7 +348,7 @@ int main(int argc, char *argv[]) } receiver[i].priority = priority; receiver[i].tracelimit = tracelimit; - if (priority > 0) + if (priority > 1 && !sameprio) priority--; receiver[i].delay.tv_sec = interval / USEC_PER_SEC; receiver[i].delay.tv_nsec = (interval % USEC_PER_SEC) * 1000; --
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/2 add-smp-option-to-svsematest.patch
In reply to Carsten EmdeAdd SMP testing option (-S, --smp) to svsematest, same as in cyclictest.
src/svsematest/svsematest.c +23 -2
@@ -248,6 +248,8 @@ static void display_help(void)"-i INTV --interval=INTV base interval of thread in us default=1000\n" "-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n" "-p PRIO --prio=PRIO priority\n" +"-S --smp SMP testing: options -a -t and same priority\n" +" of all threads\n" "-t --threads one thread per available processor\n" "-t [NUM] --threads=NUM number of threads:\n" " without NUM, threads = max_cpus\n"
@@ -263,6 +265,8 @@ static int num_threads = 1;static int max_cycles;static int interval =1000 ;static int distance =500 ; +static int smp; +static int sameprio;static void process_options (int argc,char *argv[]) {
@@ -281,16 +285,21 @@ static void process_options (int argc, c {"interval", required_argument, NULL, 'i'}, {"loops", required_argument, NULL, 'l'}, {"priority", required_argument, NULL, 'p'}, + {"smp", no_argument, NULL, 'S'}, {"threads", optional_argument, NULL, 't'}, {"help", no_argument, NULL, '?'}, {NULL, 0, NULL, 0} }; -int c =getopt_long (argc, argv,"a::b:d:f::i:l:p:t::" , +int c =getopt_long (argc, argv,"a::b:d:f::i:l:p:St::" , long_options, &option_index);if (c ==-1 )break ;switch (c) {case 'a' : +if (smp) { +warn ("-a ignored due to --smp\n" ); +break ; + }if (optarg !=NULL ) { affinity =atoi (optarg); setaffinity =AFFINITY_SPECIFIED ;
@@ -317,7 +326,16 @@ static void process_options (int argc, ccase 'i' : interval =atoi (optarg);break ;case 'l' : max_cycles =atoi (optarg);break ;case 'p' : priority =atoi (optarg);break ; +case 'S' : + smp =1 ; + num_threads = max_cpus; + setaffinity =AFFINITY_USEALL ; +break ;case 't' : +if (smp) { +warn ("-t ignored due to --smp\n" ); +break ; + }if (optarg !=NULL ) num_threads =atoi (optarg);else if (optind<argc &&atoi (argv[optind]))
@@ -347,6 +365,9 @@ static void process_options (int argc, cif (priority <0 || priority >99 ) error =1 ; +if (priority && smp) + sameprio =1 ; + tracelimit = thistracelimit; }if (error)
@@ -525,7 +546,7 @@ int main(int argc, char *argv[]) } receiver[i].priority = priority; receiver[i].tracelimit = tracelimit; -if (priority >0 ) +if (priority >1 && !sameprio) priority--; receiver[i].delay.tv_sec = interval /USEC_PER_SEC ; receiver[i].delay.tv_nsec = (interval %USEC_PER_SEC ) *1000 ;
Re: [PATCH 2/2] add-smp-option-to-svsematest.patch
Quoted 78 lines · Carsten Emde
Add SMP testing option (-S, --smp) to svsematest, same as in cyclictest.
Signed-off-by Carsten Emde <[email protected]>Index:
rt-tests/src/svsematest/svsematest.c
===================================================================src/svsematest/svsematest.c +0
-0@@ -248,6 +248,8 @@ static void display_help(void)"-i INTV --interval=INTV base interval of thread in us default=1000\n" "-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n" "-p PRIO --prio=PRIO priority\n"
+ "-S --smp SMP testing: options -a -t and same priority\n"
+ " of all threads\n"
"-t --threads one thread per available processor\n" "-t [NUM] --threads=NUM number of threads:\n"
" without NUM, threads = max_cpus\n"src/svsematest/svsematest.c +4
-1@@ -263,6 +265,8 @@ static int num_threads = 1; static int max_cycles; static int interval = 1000; static int distance = 500; +static int smp; +static int sameprio; static void process_options (int argc, char *argv[]) {@@ -281,16 +285,21 @@ static void process_options (int argc, c {"interval", required_argument, NULL, 'i'}, {"loops", required_argument, NULL, 'l'}, {"priority", required_argument, NULL, 'p'}, + {"smp", no_argument, NULL, 'S'}, {"threads", optional_argument, NULL, 't'}, {"help", no_argument, NULL, '?'}, {NULL, 0, NULL, 0} }; - int c = getopt_long (argc, argv, "a::b:d:f::i:l:p:t::", + int c = getopt_long (argc, argv, "a::b:d:f::i:l:p:St::", long_options, &option_index); if (c == -1) break; switch (c) {case 'a':
+ if (smp) {
+warn("-a ignored due to --smp\n");
+ break;
+ }
if (optarg != NULL) {
affinity = atoi(optarg); setaffinity =AFFINITY_SPECIFIED;src/svsematest/svsematest.c +5
-0@@ -317,7 +326,16 @@ static void process_options (int argc, c case 'i': interval = atoi(optarg); break; case 'l': max_cycles = atoi(optarg); break; case 'p': priority = atoi(optarg); break; + case 'S': + smp = 1; + num_threads = max_cpus; + setaffinity = AFFINITY_USEALL; + break;case 't':
+ if (smp) {
+warn("-t ignored due to --smp\n");
+ break;
+ }
if (optarg != NULL)
num_threads = atoi(optarg); else if (optind<argc &&atoi(argv[optind]))src/svsematest/svsematest.c +3
-0@@ -347,6 +365,9 @@ static void process_options (int argc, c if (priority < 0 || priority > 99) error = 1; + if (priority && smp) + sameprio = 1; + tracelimit = thistracelimit; } if (error)
src/svsematest/svsematest.c int main(int argc, char *argv[])
Quoted 10 lines
src/svsematest/svsematest.c +1
-2@@ -525,7 +546,7 @@ int main(int argc, char *argv[]) } receiver[i].priority = priority; receiver[i].tracelimit = tracelimit; - if (priority > 0) + if (priority > 1 && !sameprio) priority--; receiver[i].delay.tv_sec = interval / USEC_PER_SEC; receiver[i].delay.tv_nsec = (interval % USEC_PER_SEC) * 1000; --
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] add-smp-option-to-svsematest.patch
In reply to Carsten EmdeQuoted 3 lines · Carsten Emde
src/svsematest/svsematest.c +1
-1-if (priority >0 ) +if (priority >1 && !sameprio)priority--;
Unless I'm missing something really obvious, shouldn't this one state:
if (priority > 0 && !sameprio) priority--;
Or else 1 will be the lowest priority. It's a similar situation in "[PATCH 1/2] add-smp-option-to-ptsematest.patch" as well.
kind regards,
David Sommerseth
Re: [PATCH 2/2] add-smp-option-to-svsematest.patch
Quoted 10 lines · David Sommerseth
Quoted 3 lines · Carsten Emde
- if (priority > 0)
+ if (priority > 1 && !sameprio)
priority--;Unless I'm missing something really obvious, shouldn't this one state:
if (priority > 0 && !sameprio)
priority--;
Quoted 7 lines
Or else 1 will be the lowest priority. It's a similar situation in "[PATCH 1/2] add-smp-option-to-ptsematest.patch" as well.
kind regards,
David Sommerseth
Carsten is the owner of this code, he may very will have intended that 1 be the lowest priority, so I didn't want to second guess him.
Carsten, is it useful to have SCHED_OTHER for this test?
Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] add-smp-option-to-svsematest.patch
John,
Quoted 9 lines
Quoted 8 lines
src/svsematest/svsematest.c int main(int argc, char *argv[]) · line 550
Quoted 3 lines
src/svsematest/svsematest.c +1
-1-if (priority >0 ) +if (priority >1 && !sameprio) priority--;Unless I'm missing something really obvious, shouldn't this one state:
if (priority > 0 && !sameprio) priority--;Or else 1 will be the lowest priority. It's a similar situation in "[PATCH 1/2] add-smp-option-to-ptsematest.patch" as well.
Carsten, is it useful to have
SCHED_OTHERfor this test?
Don't think so. These tests (svsematest, ptsematest etc.) are intended as additional tests to cyclictest. I used them to make sure that the implementations of the various semaphore mechanisms (that mostly boil down to the same kernel code) do not introduce additional latencies. It may be sufficient to have cyclictest equipped with the numerous (and exotic) options.
Another plan was to add a plugin slot to cyclictest, since probably more than 90% of the code of the various test programs is identical. A plugin version of cyclictest would provide all the various runtime and scheduler options, the stop clocks and the test framework. The actual test plugin could be specified as a command line argument. The plugin interface would need to connect the start and stop code of a particular test to cyclictest. But this was just a plan...
Carsten.
Re: [PATCH 2/2] add-smp-option-to-svsematest.patch
In reply to David SommersethDavid,
Quoted 7 lines
Quoted 3 lines
src/svsematest/svsematest.c +1
-1-if (priority >0 ) +if (priority >1 && !sameprio)priority--;Unless I'm missing something really obvious, shouldn't this one state:
if (priority > 0 && !sameprio) priority--;Or else 1 will be the lowest priority. [..]
Yes, which is ok, since the range of valid SCHED_FIFO priorities is 1 to
99. A priority of 0 would cause sched_setscheduler() to set the EINVAL error condition.
Carsten.