Skip to contentSkip to conversation

Two minor fixes of cyclictest

PATCH In review Carsten Emde 3 participants 9 messages Mar 7, 2010 – Mar 9, 2010

lore
Share & tools
lore
#0 lore raw

cover Two minor fixes of cyclictest

These patches prevent a priority < 1 and fix an incorrect help message in cyclictest.

#1 lore raw

PATCH 1/2 do-not-allow-prio-less-than-one-in-cyclictest.patch

If not in SMP testing mode, the priority may go below 1, if the specified priority is lower than the number of threads, e.g.

# cyclictest -p2 -t3
T: 0 (21970) P: 2 [..]
T: 1 (21971) P: 1 [..]
T: 2 (21972) P: 0 [..]

Do not allow priority to go below 1.

src/cyclictest/cyclictest.c +1 -1
Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================
@@ -1304,7 +1304,7 @@ int main(int argc, char **argv)
 		}
 
 		par->prio = priority;
-		if (!sameprio)
+		if (priority > 1 && !sameprio)
 			priority--;
                 if      (priority && policy <= 1) par->policy = SCHED_FIFO;
                 else if (priority && policy == 2) par->policy = SCHED_RR;
#2 lore raw

Re: [PATCH 1/2] do-not-allow-prio-less-than-one-in-cyclictest.patch

Quoted 16 lines · Carsten Emde

If not in SMP testing mode, the priority may go below 1, if the specified priority is lower than the number of threads, e.g.

# cyclictest -p2 -t3
T: 0 (21970) P: 2 [..]
T: 1 (21971) P: 1 [..]
T: 2 (21972) P: 0 [..]

Do not allow priority to go below 1.

Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c int main(int argc, char **argv)

Quoted 10 lines
src/cyclictest/cyclictest.c +1 -2
@@ -1304,7 +1304,7 @@ int main(int argc, char **argv)
                }
 
                par->prio = priority;
-               if (!sameprio)
+               if (priority > 1 && !sameprio)
                        priority--;
                 if      (priority && policy <= 1) par->policy = SCHED_FIFO;
                 else if (priority && policy == 2) par->policy = SCHED_RR;
 
--

I'm not sure about this, why not allow a priority below 1? The code below properly sets the third thead to SCHED_OTHER.
I could imagine wanting to test that too. If you don't want to go below 1 then just set a higher prio, p3 in the scenario you showed.

Thanks.
John
--
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

#3 lore raw

Re: [PATCH 1/2] do-not-allow-prio-less-than-one-in-cyclictest.patch

Quoted 26 lines · John Kacur
Quoted 25 lines · Carsten Emde

If not in SMP testing mode, the priority may go below 1, if the specified priority is lower than the number of threads, e.g.

# cyclictest -p2 -t3
T: 0 (21970) P: 2 [..]
T: 1 (21971) P: 1 [..]
T: 2 (21972) P: 0 [..]

Do not allow priority to go below 1.

Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c +1 -1
@@ -1304,7 +1304,7 @@ int main(int argc, char **argv)
               }
 
               par->prio = priority;
-               if (!sameprio)
+               if (priority > 1 && !sameprio)
                       priority--;
                if      (priority && policy <= 1) par->policy = SCHED_FIFO;
                else if (priority && policy == 2) par->policy = SCHED_RR;
Quoted 7 lines
Quoted 1 line

--

I'm not sure about this, why not allow a priority below 1? The code below properly sets the third thead to SCHED_OTHER.
I could imagine wanting to test that too. If you don't want to go below 1 then just set a higher prio, p3 in the scenario you showed.

Maybe I'm misreading and misunderstanding the patch ... but I believe the if statement should say:

	if (priority > 0 && !sameprio)
		priority--;

Just to avoid the situation the commit log says, priority to go below 0.

kind regards,

David Sommerseth

#4 lore raw

Re: [PATCH 1/2] do-not-allow-prio-less-than-one-in-cyclictest.patch

Quoted 41 lines · David Sommerseth
Quoted 26 lines · John Kacur
Quoted 25 lines · Carsten Emde

If not in SMP testing mode, the priority may go below 1, if the specified priority is lower than the number of threads, e.g.

# cyclictest -p2 -t3
T: 0 (21970) P: 2 [..]
T: 1 (21971) P: 1 [..]
T: 2 (21972) P: 0 [..]

Do not allow priority to go below 1.

Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c +1 -1
@@ -1304,7 +1304,7 @@ int main(int argc, char **argv)
                }
 
                par->prio = priority;
-               if (!sameprio)
+               if (priority > 1 && !sameprio)
                        priority--;
                 if      (priority && policy <= 1) par->policy = SCHED_FIFO;
                 else if (priority && policy == 2) par->policy = SCHED_RR;
Quoted 7 lines
Quoted 1 line

--

I'm not sure about this, why not allow a priority below 1? The code below properly sets the third thead to SCHED_OTHER.
I could imagine wanting to test that too. If you don't want to go below 1 then just set a higher prio, p3 in the scenario you showed.

Maybe I'm misreading and misunderstanding the patch ... but I believe the if statement should say:

       if (priority > 0 && !sameprio)
               priority--;

Quoted 6 lines

Just to avoid the situation the commit log says, priority to go below 0.

kind regards,

David Sommerseth

The code in general there was buggy, so I reverted the patch that caused the problems in the first place.
(assuming Clark merges it).

Now the code will read (as it did before)

if (priority && !histogram && !smp && !numa)

                        priority--;

--
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

#5 lore raw

Re: [PATCH 1/2] do-not-allow-prio-less-than-one-in-cyclictest.patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 49 lines · John Kacur
Quoted 41 lines · David Sommerseth
Quoted 26 lines · John Kacur
Quoted 25 lines · Carsten Emde

If not in SMP testing mode, the priority may go below 1, if the specified priority is lower than the number of threads, e.g.

# cyclictest -p2 -t3
T: 0 (21970) P: 2 [..]
T: 1 (21971) P: 1 [..]
T: 2 (21972) P: 0 [..]

Do not allow priority to go below 1.

Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c +1 -1
@@ -1304,7 +1304,7 @@ int main(int argc, char **argv)
               }
 
               par->prio = priority;
-               if (!sameprio)
+               if (priority > 1 && !sameprio)
                       priority--;
                if      (priority && policy <= 1) par->policy = SCHED_FIFO;
                else if (priority && policy == 2) par->policy = SCHED_RR;
Quoted 7 lines
Quoted 1 line

--

I'm not sure about this, why not allow a priority below 1? The code below properly sets the third thead to SCHED_OTHER.
I could imagine wanting to test that too. If you don't want to go below 1 then just set a higher prio, p3 in the scenario you showed.

Maybe I'm misreading and misunderstanding the patch ... but I believe the if statement should say:

       if (priority > 0 && !sameprio)
               priority--;
Quoted 6 lines

Just to avoid the situation the commit log says, priority to go below 0.

kind regards,

David Sommerseth

Quoted 8 lines

The code in general there was buggy, so I reverted the patch that caused the problems in the first place.
(assuming Clark merges it).

Now the code will read (as it did before)

if (priority && !histogram && !smp && !numa)

                        priority--;

That looks better ... and guess what, I just stumbled upon those patches right now in the mailing list ... the troubles of catching up after holidays :)

kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkuWkAAACgkQIIWEatLf4HeRiQCeMLgoLJHvzHwS+8yRroGBOAAX zXwAnAmXlY4AFgIGRAzi+33nNwukXdCF
=cPhd
-----END PGP SIGNATURE-----

#6 lore raw

PATCH 2/2 remove-incorrect-options-from-smp-help-message-in-cyclictest.patch

In reply to Carsten Emde

The help message of cyclictest's -S option says that it equals -a -t -n -m -d0. In reality, it only equals -a -t -n.

src/cyclictest/cyclictest.c +2 -2
Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================
@@ -777,8 +777,8 @@ static void display_help(int error)
                "-W       --wakeuprt        rt task wakeup tracing (used with -b)\n"
                "-y POLI  --policy=POLI     policy of realtime thread (1:FIFO, 2:RR)\n"
                "                           format: --policy=fifo(default) or --policy=rr\n"
-	       "-S       --smp             Standard SMP testing (equals -a -t -n -m -d0)\n"
-               "                           same priority on all threads.\n"
+	       "-S       --smp             Standard SMP testing: options -a -t -n and\n"
+               "                           same priority of all threads\n"
 	       "-U       --numa            Standard NUMA testing (similar to SMP option)\n"
                "                           thread data structures allocated from local node\n",
 	       tracers
#7 lore raw

Re: [PATCH 2/2] remove-incorrect-options-from-smp-help-message-in-cyclictest.patch

Quoted 21 lines · Carsten Emde

The help message of cyclictest's -S option says that it equals -a -t -n -m -d0. In reality, it only equals -a -t -n.

Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c +0 -0
@@ -777,8 +777,8 @@ static void display_help(int error)

               "-W       --wakeuprt        rt task wakeup tracing (used with -b)\n" "-y POLI  --policy=POLI     policy of realtime thread (1:FIFO, 2:RR)\n" "                           format: --policy=fifo(default) or --policy=rr\n"
-              "-S       --smp             Standard SMP testing (equals -a -t -n -m -d0)\n"
-               "                           same priority on all threads.\n"
+              "-S       --smp             Standard SMP testing: options -a -t -n and\n"
+               "                           same priority of all threads\n"
              "-U       --numa            Standard NUMA testing (similar to SMP option)\n" "                           thread data structures allocated from local node\n", tracers

Quoted 1 line

--

Wow, you're right. I wonder if the intention here was to set -m and -d0 for -S, and if we instead need a patch to do exactly that if the user selects -S.

Certainly a default of -d0 makes sense for smp, and it probably doesn't make sense to let the user override it either. However, I'm not sure if -m by default is a good choice to make for -S. I suggest we make -d0 the default for -S, and
then see if anyone has an opinion about whether -m should be the default for -S. My vote is no, so then we would need
to correct the documentation in that case.

Thanks
John
--
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

Acked-by
#8 lore raw

Re: [PATCH 2/2] remove-incorrect-options-from-smp-help-message-in-cyclictest.patch

Quoted 28 lines · John Kacur
Quoted 21 lines · Carsten Emde

The help message of cyclictest's -S option says that it equals -a -t -n -m -d0. In reality, it only equals -a -t -n.

Index: rt-tests/src/cyclictest/cyclictest.c
===================================================================

src/cyclictest/cyclictest.c +0 -0
@@ -777,8 +777,8 @@ static void display_help(int error)

               "-W       --wakeuprt        rt task wakeup tracing (used with -b)\n" "-y POLI  --policy=POLI     policy of realtime thread (1:FIFO, 2:RR)\n" "                           format: --policy=fifo(default) or --policy=rr\n"
-              "-S       --smp             Standard SMP testing (equals -a -t -n -m -d0)\n"
-               "                           same priority on all threads.\n"
+              "-S       --smp             Standard SMP testing: options -a -t -n and\n"
+               "                           same priority of all threads\n"
              "-U       --numa            Standard NUMA testing (similar to SMP option)\n" "                           thread data structures allocated from local node\n", tracers

Quoted 1 line

--

Wow, you're right. I wonder if the intention here was to set -m and -d0 for -S, and if we instead need a patch to do exactly that if the user selects -S.

Quoted 8 lines

Certainly a default of -d0 makes sense for smp, and it probably doesn't make sense to let the user override it either. However, I'm not sure if -m by default is a good choice to make for -S. I suggest we make -d0 the default for -S, and
then see if anyone has an opinion about whether -m should be the default for -S. My vote is no, so then we would need
to correct the documentation in that case.

Okay, looking at the history of cyclictest in git, 77abded073c5d11d118112c46c22a84ddc29e771
indicates that the intention was to set just -t -a and -n, so in that case

--
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