linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pip_stress: increase usleep for ARM devices
@ 2014-12-10  8:25 chase.qi
  2014-12-10 10:00 ` Pavel Vasilyev
  2014-12-10 14:15 ` Jorge Ramirez-Ortiz
  0 siblings, 2 replies; 5+ messages in thread
From: chase.qi @ 2014-12-10  8:25 UTC (permalink / raw)
  To: linux-rt-users
  Cc: clark.williams, milosz.wasilewski, naresh.kamboju,
	jorge.ramirez-ortiz, anders.roxell, mike.holmes

From: Chase Qi <chase.qi@linaro.org>

Hello,

pip_stress works out of the box on my x86 based laptop, but
doesn't work on ARM devices, returned 'no inversion incurred'.
Follow the comment to increase usleep value, 2500 worked for
pandaboard and 3000 worked for Beaglebone Black board.

I propose that increase the usleep value to 3500 from upstream,
so that we can use pip_stress right out of the box.

Please let me know if this is acceptable.

Regards,
Chase

Signed-off-by: Chase Qi <chase.qi@linaro.org>
---
 src/pi_tests/pip_stress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 2b42b8f..553290b 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -162,7 +162,7 @@ void low(pid_t pid)
 				statep->inversion = 0;
 			}
 		Pthread_mutex_unlock(statep->mutex);
-		usleep(500);
+		usleep(3500);
 	Pthread_mutex_unlock(resource);
 	waitpid(pid, &status, 0);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] pip_stress: increase usleep for ARM devices
  2014-12-10  8:25 [PATCH] pip_stress: increase usleep for ARM devices chase.qi
@ 2014-12-10 10:00 ` Pavel Vasilyev
  2014-12-10 14:15 ` Jorge Ramirez-Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Pavel Vasilyev @ 2014-12-10 10:00 UTC (permalink / raw)
  To: chase.qi, linux-rt-users
  Cc: clark.williams, milosz.wasilewski, naresh.kamboju,
	jorge.ramirez-ortiz, anders.roxell, mike.holmes

May be #defines?

#ifndef (ARM)
		usleep(500);
#else
		usleep(3500);
#endif


10.12.2014 11:25, chase.qi@linaro.org пишет:
> From: Chase Qi <chase.qi@linaro.org>
>
> Hello,
>
> pip_stress works out of the box on my x86 based laptop, but
> doesn't work on ARM devices, returned 'no inversion incurred'.
> Follow the comment to increase usleep value, 2500 worked for
> pandaboard and 3000 worked for Beaglebone Black board.
>
> I propose that increase the usleep value to 3500 from upstream,
> so that we can use pip_stress right out of the box.
>
> Please let me know if this is acceptable.
>
> Regards,
> Chase
>
> Signed-off-by: Chase Qi <chase.qi@linaro.org>
> ---
>   src/pi_tests/pip_stress.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
> index 2b42b8f..553290b 100644
> --- a/src/pi_tests/pip_stress.c
> +++ b/src/pi_tests/pip_stress.c
> @@ -162,7 +162,7 @@ void low(pid_t pid)
>   				statep->inversion = 0;
>   			}
>   		Pthread_mutex_unlock(statep->mutex);
> -		usleep(500);
> +		usleep(3500);
>   	Pthread_mutex_unlock(resource);
>   	waitpid(pid, &status, 0);
>   }
>


-- 

                                                          Pavel.
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pip_stress: increase usleep for ARM devices
  2014-12-10  8:25 [PATCH] pip_stress: increase usleep for ARM devices chase.qi
  2014-12-10 10:00 ` Pavel Vasilyev
@ 2014-12-10 14:15 ` Jorge Ramirez-Ortiz
  2014-12-10 21:16   ` Clark Williams
  1 sibling, 1 reply; 5+ messages in thread
From: Jorge Ramirez-Ortiz @ 2014-12-10 14:15 UTC (permalink / raw)
  To: chase.qi, linux-rt-users
  Cc: clark.williams, milosz.wasilewski, naresh.kamboju, anders.roxell,
	mike.holmes

On 12/10/2014 03:25 AM, chase.qi@linaro.org wrote:
> From: Chase Qi <chase.qi@linaro.org>
>
> Hello,
>
> pip_stress works out of the box on my x86 based laptop, but
> doesn't work on ARM devices, returned 'no inversion incurred'.
> Follow the comment to increase usleep value, 2500 worked for
> pandaboard and 3000 worked for Beaglebone Black board.
>
> I propose that increase the usleep value to 3500 from upstream,
> so that we can use pip_stress right out of the box.
>
> Please let me know if this is acceptable.

I think they should have modified main() to accept the lock time as a parameter
instead of simply adding some instructions in the comments

 * to show that it works. If you are having difficulty triggering an inversion,
 * merely increase the time that the low priority process sleeps while
 * holding the lock. (usleep);
 * Also note that you have to run as a user with permission to change
 * scheduling priorities.
 */

what I would do is actually
1. modify main to accept lock_time
2. send the patch to the rt-tests team




>
> Regards,
> Chase
>
> Signed-off-by: Chase Qi <chase.qi@linaro.org>
> ---
>  src/pi_tests/pip_stress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
> index 2b42b8f..553290b 100644
> --- a/src/pi_tests/pip_stress.c
> +++ b/src/pi_tests/pip_stress.c
> @@ -162,7 +162,7 @@ void low(pid_t pid)
>  				statep->inversion = 0;
>  			}
>  		Pthread_mutex_unlock(statep->mutex);
> -		usleep(500);
> +		usleep(3500);
>  	Pthread_mutex_unlock(resource);
>  	waitpid(pid, &status, 0);
>  }


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pip_stress: increase usleep for ARM devices
  2014-12-10 14:15 ` Jorge Ramirez-Ortiz
@ 2014-12-10 21:16   ` Clark Williams
  2015-01-15 18:44     ` Clark Williams
  0 siblings, 1 reply; 5+ messages in thread
From: Clark Williams @ 2014-12-10 21:16 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz
  Cc: chase.qi, linux-rt-users, milosz.wasilewski, naresh.kamboju,
	anders.roxell, mike.holmes, John Kacur

[-- Attachment #1: Type: text/plain, Size: 1757 bytes --]

On Wed, 10 Dec 2014 09:15:00 -0500
Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> wrote:

> On 12/10/2014 03:25 AM, chase.qi@linaro.org wrote:
> > From: Chase Qi <chase.qi@linaro.org>
> >
> > Hello,
> >
> > pip_stress works out of the box on my x86 based laptop, but
> > doesn't work on ARM devices, returned 'no inversion incurred'.
> > Follow the comment to increase usleep value, 2500 worked for
> > pandaboard and 3000 worked for Beaglebone Black board.
> >
> > I propose that increase the usleep value to 3500 from upstream,
> > so that we can use pip_stress right out of the box.
> >
> > Please let me know if this is acceptable.
> 
> I think they should have modified main() to accept the lock time as a parameter
> instead of simply adding some instructions in the comments
> 
>  * to show that it works. If you are having difficulty triggering an inversion,
>  * merely increase the time that the low priority process sleeps while
>  * holding the lock. (usleep);
>  * Also note that you have to run as a user with permission to change
>  * scheduling priorities.
>  */
> 
> what I would do is actually
> 1. modify main to accept lock_time
> 2. send the patch to the rt-tests team
> 
> 
>

I wish we didn't have to deal with timers here. I used barriers when I
wrote pi_stress.c and obviously we don't have that luxury with
pip_stress.c. I guess the best thing we can do right now is add a
parameter to change the default timer value for pip_stress and see if
someone comes up with a brilliant state-machine solution that will work
between processes :).

John and I are about to start a sweep through the tests and will
probably come out with a new rt-tests around the first of the year. 

Clark

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pip_stress: increase usleep for ARM devices
  2014-12-10 21:16   ` Clark Williams
@ 2015-01-15 18:44     ` Clark Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Clark Williams @ 2015-01-15 18:44 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz
  Cc: chase.qi, linux-rt-users, milosz.wasilewski, naresh.kamboju,
	anders.roxell, mike.holmes, John Kacur

[-- Attachment #1: Type: text/plain, Size: 4385 bytes --]

On Wed, 10 Dec 2014 15:16:50 -0600
Clark Williams <clark.williams@gmail.com> wrote:

> On Wed, 10 Dec 2014 09:15:00 -0500
> Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> wrote:
> 
> > On 12/10/2014 03:25 AM, chase.qi@linaro.org wrote:
> > > From: Chase Qi <chase.qi@linaro.org>
> > >
> > > Hello,
> > >
> > > pip_stress works out of the box on my x86 based laptop, but
> > > doesn't work on ARM devices, returned 'no inversion incurred'.
> > > Follow the comment to increase usleep value, 2500 worked for
> > > pandaboard and 3000 worked for Beaglebone Black board.
> > >
> > > I propose that increase the usleep value to 3500 from upstream,
> > > so that we can use pip_stress right out of the box.
> > >
> > > Please let me know if this is acceptable.
> > 
> > I think they should have modified main() to accept the lock time as a parameter
> > instead of simply adding some instructions in the comments
> > 
> >  * to show that it works. If you are having difficulty triggering an inversion,
> >  * merely increase the time that the low priority process sleeps while
> >  * holding the lock. (usleep);
> >  * Also note that you have to run as a user with permission to change
> >  * scheduling priorities.
> >  */
> > 
> > what I would do is actually
> > 1. modify main to accept lock_time
> > 2. send the patch to the rt-tests team
> > 
> > 
> >
> 
> I wish we didn't have to deal with timers here. I used barriers when I
> wrote pi_stress.c and obviously we don't have that luxury with
> pip_stress.c. I guess the best thing we can do right now is add a
> parameter to change the default timer value for pip_stress and see if
> someone comes up with a brilliant state-machine solution that will work
> between processes :).
> 
> John and I are about to start a sweep through the tests and will
> probably come out with a new rt-tests around the first of the year. 
> 
> Clark

Here's what I've got for the problem. Comments?


commit 57f700830439fd036cfd8231f4b4a077c9fc461b
Author: Clark Williams <clark.williams@gmail.com>
Date:   Thu Jan 15 12:35:05 2015 -0600

    pip_stress: parameterize usleep value to work-around platform
    issuess 
    ARM platforms have timing issues with pip_stress:
    
        Hello,
    
        pip_stress works out of the box on my x86 based laptop, but
        doesn't work on ARM devices, returned 'no inversion incurred'.
        Follow the comment to increase usleep value, 2500 worked for
        pandaboard and 3000 worked for Beaglebone Black board.
    
        I propose that increase the usleep value to 3500 from upstream,
        so that we can use pip_stress right out of the box.
    
    Rather than hardcode the usleep value used by pip_stress, I made
    the command line option --usleep which takes a microsecond value
    that defaults to 500us.
    
    Reported-by: Chase Qi <chase.qi@linaro.org>
    Signed-off-by: Clark Williams <clark.williams@gmail.com>

diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 2b42b8ff2491..66b3dc1c9fea 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -56,6 +56,12 @@
 
 #include "pip_stress.h"
 
+#include <unistd.h>
+#include <getopt.h>
+
+/* default time for low priority thread usleep */
+useconds_t usleep_val = 500;
+
 pthread_mutex_t *resource;
 
 /* This records the state to determine whether a priority inversion
occured */ @@ -73,6 +79,11 @@ struct State *statep;
 const int policy = SCHED_FIFO;
 const int prio_min;    /* Initialized for the minimum priority of
policy */ 
+struct option long_options[] = {
+    { "usleep", required_argument, 0, 0 },
+    { 0,        0,                 0, 0 },
+};
+
 int main(void)
 {
        void *mptr;     /* memory pointer */
@@ -80,6 +91,7 @@ int main(void)
        cpu_set_t set, *setp = &set;
        int res;
        int *minimum_priority = (int*)&prio_min;
+       int c;
 
        *minimum_priority = sched_get_priority_min(policy);
 
@@ -162,7 +174,7 @@ void low(pid_t pid)
                                statep->inversion = 0;
                        }
                Pthread_mutex_unlock(statep->mutex);
-               usleep(500);
+               usleep(usleep_val);
        Pthread_mutex_unlock(resource);
        waitpid(pid, &status, 0);
 }


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-15 18:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10  8:25 [PATCH] pip_stress: increase usleep for ARM devices chase.qi
2014-12-10 10:00 ` Pavel Vasilyev
2014-12-10 14:15 ` Jorge Ramirez-Ortiz
2014-12-10 21:16   ` Clark Williams
2015-01-15 18:44     ` Clark Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).