All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] xenomai cyclictest negative Max value
@ 2017-12-18  2:26 Peng Fan
  2017-12-20  6:49 ` Peng Fan
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Fan @ 2017-12-18  2:26 UTC (permalink / raw)
  To: xenomai

Hi All,

I compiled xenomai-next on my ARM64 platform, but met Max and Avg not correct.
See below:

./cyclictest -a -t10 -n -p99 -c 0
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 0.97 0.51 0.21 1/135 3018
policy: fifo: loadavg: 1.00 0.76 0.38 1/128 3018
T:[  200.650323] random: crng init done      0 Act:    0 Avg:443149053456561 Max:      -1
T: 0 ( 3002) P:99 I:1000 C: 373066 Min:      0 Act:    0 Avg:395570629834068 Max:      -11
T: 1 ( 3003) P:99 I:1500 C: 248710 Min:      0 Act:    0 Avg:148339383810136 Max:      -111
T: 2 ( 3004) P:99 I:2000 C: 186532 Min:      0 Act:    0 Avg:593359125738518 Max:      -1
T: 3 ( 3005) P:99 I:2500 C: 149359 Min:      0 Act:    0 Avg:123506076458128 Max:      -11
T: 4 ( 3006) P:99 I:3000 C: 124465 Min:      0 Act:    0 Avg:592833136181562 Max:      -1
T: 5 ( 3007) P:99 I:3500 C: 106684 Min:      0 Act:    0 Avg:172910127795260 Max:      -111
T: 6 ( 3008) P:99 I:4000 C:  93349 Min:      0 Act:    0 Avg:1383273613171719 Max:      -1
T: 7 ( 3009) P:99 I:4500 C:  82977 Min:      0 Act:    0 Avg:666934598998863 Max:      -1
T: 8 ( 3010) P:99 I:5000 C:  74679 Min:      0 Act:    0 Avg:988055226969271 Max:      -11

Seems xenomai cyclictest and rt-tests cyclictest is not sync, or there are
some differecense. Could you please help me clarify what's the difference
between xenomai cyclictest and rt-tests cyclictest?  I did not find out which
exact commit number when importing rt-tests cyclictest to xenomai.

Thanks,
Peng.

-- 


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

* Re: [Xenomai] xenomai cyclictest negative Max value
  2017-12-18  2:26 [Xenomai] xenomai cyclictest negative Max value Peng Fan
@ 2017-12-20  6:49 ` Peng Fan
  2017-12-20  7:34   ` Peng Fan
  2017-12-20 10:07   ` Philippe Gerum
  0 siblings, 2 replies; 5+ messages in thread
From: Peng Fan @ 2017-12-20  6:49 UTC (permalink / raw)
  To: xenomai

On Mon, Dec 18, 2017 at 10:26:28AM +0800, Peng Fan wrote:
>Hi All,
>
>I compiled xenomai-next on my ARM64 platform, but met Max and Avg not correct.
>See below:
>
>./cyclictest -a -t10 -n -p99 -c 0
># /dev/cpu_dma_latency set to 0us
>policy: fifo: loadavg: 0.97 0.51 0.21 1/135 3018
>policy: fifo: loadavg: 1.00 0.76 0.38 1/128 3018
>T:[  200.650323] random: crng init done      0 Act:    0 Avg:443149053456561 Max:      -1
>T: 0 ( 3002) P:99 I:1000 C: 373066 Min:      0 Act:    0 Avg:395570629834068 Max:      -11
>T: 1 ( 3003) P:99 I:1500 C: 248710 Min:      0 Act:    0 Avg:148339383810136 Max:      -111
>T: 2 ( 3004) P:99 I:2000 C: 186532 Min:      0 Act:    0 Avg:593359125738518 Max:      -1
>T: 3 ( 3005) P:99 I:2500 C: 149359 Min:      0 Act:    0 Avg:123506076458128 Max:      -11
>T: 4 ( 3006) P:99 I:3000 C: 124465 Min:      0 Act:    0 Avg:592833136181562 Max:      -1
>T: 5 ( 3007) P:99 I:3500 C: 106684 Min:      0 Act:    0 Avg:172910127795260 Max:      -111
>T: 6 ( 3008) P:99 I:4000 C:  93349 Min:      0 Act:    0 Avg:1383273613171719 Max:      -1
>T: 7 ( 3009) P:99 I:4500 C:  82977 Min:      0 Act:    0 Avg:666934598998863 Max:      -1
>T: 8 ( 3010) P:99 I:5000 C:  74679 Min:      0 Act:    0 Avg:988055226969271 Max:      -11
>
>Seems xenomai cyclictest and rt-tests cyclictest is not sync, or there are
>some differecense. Could you please help me clarify what's the difference
>between xenomai cyclictest and rt-tests cyclictest?  I did not find out which
>exact commit number when importing rt-tests cyclictest to xenomai.

I add a debug info in cyclictest.c, see below:

diff --git a/demo/posix/cyclictest/cyclictest.c b/demo/posix/cyclictest/cyclictest.c
index 31d9e5d0b..b16321cd9 100644
--- a/demo/posix/cyclictest/cyclictest.c
+++ b/demo/posix/cyclictest/cyclictest.c
@@ -920,6 +920,11 @@ void *timerthread(void *param)
                        diff = calcdiff_ns(now, next);
                else
                        diff = calcdiff(now, next);
+
+               if (diff == -1) {
+                       printf("==== %ld %ld %ld %ld\n", now.tv_sec, now.tv_nsec, next.tv_sec, next.tv_nsec);
+                       exit(0);
+               }
                if (diff < stat->min)
                        stat->min = diff;
                if (diff > stat->max) {

And I encounter the case that diff is -1,
"==== 16124 21743627 16124 21744638"
only 1ns difference between now and next.
This means clock_nanosleep wakeup earlier than expected?
I am using 4.9.51 kernel, and xenomai-next on ARM64. I am tracking
the hrtimer things, but no good progress. Please advise, if you any ideas.

Thanks,
Peng.

>
>Thanks,
>Peng.
>
>-- 

-- 


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

* Re: [Xenomai] xenomai cyclictest negative Max value
  2017-12-20  6:49 ` Peng Fan
@ 2017-12-20  7:34   ` Peng Fan
  2017-12-20 10:07   ` Philippe Gerum
  1 sibling, 0 replies; 5+ messages in thread
From: Peng Fan @ 2017-12-20  7:34 UTC (permalink / raw)
  To: xenomai

On Wed, Dec 20, 2017 at 02:49:53PM +0800, Peng Fan wrote:
>On Mon, Dec 18, 2017 at 10:26:28AM +0800, Peng Fan wrote:
>>Hi All,
>>
>>I compiled xenomai-next on my ARM64 platform, but met Max and Avg not correct.
>>See below:
>>
>>./cyclictest -a -t10 -n -p99 -c 0
>># /dev/cpu_dma_latency set to 0us
>>policy: fifo: loadavg: 0.97 0.51 0.21 1/135 3018
>>policy: fifo: loadavg: 1.00 0.76 0.38 1/128 3018
>>T:[  200.650323] random: crng init done      0 Act:    0 Avg:443149053456561 Max:      -1
>>T: 0 ( 3002) P:99 I:1000 C: 373066 Min:      0 Act:    0 Avg:395570629834068 Max:      -11
>>T: 1 ( 3003) P:99 I:1500 C: 248710 Min:      0 Act:    0 Avg:148339383810136 Max:      -111
>>T: 2 ( 3004) P:99 I:2000 C: 186532 Min:      0 Act:    0 Avg:593359125738518 Max:      -1
>>T: 3 ( 3005) P:99 I:2500 C: 149359 Min:      0 Act:    0 Avg:123506076458128 Max:      -11
>>T: 4 ( 3006) P:99 I:3000 C: 124465 Min:      0 Act:    0 Avg:592833136181562 Max:      -1
>>T: 5 ( 3007) P:99 I:3500 C: 106684 Min:      0 Act:    0 Avg:172910127795260 Max:      -111
>>T: 6 ( 3008) P:99 I:4000 C:  93349 Min:      0 Act:    0 Avg:1383273613171719 Max:      -1
>>T: 7 ( 3009) P:99 I:4500 C:  82977 Min:      0 Act:    0 Avg:666934598998863 Max:      -1
>>T: 8 ( 3010) P:99 I:5000 C:  74679 Min:      0 Act:    0 Avg:988055226969271 Max:      -11
>>
>>Seems xenomai cyclictest and rt-tests cyclictest is not sync, or there are
>>some differecense. Could you please help me clarify what's the difference
>>between xenomai cyclictest and rt-tests cyclictest?  I did not find out which
>>exact commit number when importing rt-tests cyclictest to xenomai.
>
>I add a debug info in cyclictest.c, see below:
>
>diff --git a/demo/posix/cyclictest/cyclictest.c b/demo/posix/cyclictest/cyclictest.c
>index 31d9e5d0b..b16321cd9 100644
>--- a/demo/posix/cyclictest/cyclictest.c
>+++ b/demo/posix/cyclictest/cyclictest.c
>@@ -920,6 +920,11 @@ void *timerthread(void *param)
>                        diff = calcdiff_ns(now, next);
>                else
>                        diff = calcdiff(now, next);
>+
>+               if (diff == -1) {
>+                       printf("==== %ld %ld %ld %ld\n", now.tv_sec, now.tv_nsec, next.tv_sec, next.tv_nsec);
>+                       exit(0);
>+               }
>                if (diff < stat->min)
>                        stat->min = diff;
>                if (diff > stat->max) {
>
>And I encounter the case that diff is -1,
>"==== 16124 21743627 16124 21744638"
>only 1ns difference between now and next.

Typo: it is 1011 ns.

The arch timer freq is 8MHz, resolution is 125ns.

>This means clock_nanosleep wakeup earlier than expected?
>I am using 4.9.51 kernel, and xenomai-next on ARM64. I am tracking
>the hrtimer things, but no good progress. Please advise, if you any ideas.
>
>Thanks,
>Peng.
>
>>
>>Thanks,
>>Peng.
>>
>>-- 
>
>-- 

-- 


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

* Re: [Xenomai] xenomai cyclictest negative Max value
  2017-12-20  6:49 ` Peng Fan
  2017-12-20  7:34   ` Peng Fan
@ 2017-12-20 10:07   ` Philippe Gerum
  2017-12-27  0:49     ` Peng Fan
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2017-12-20 10:07 UTC (permalink / raw)
  To: Peng Fan, xenomai

On 12/20/2017 07:49 AM, Peng Fan wrote:
> On Mon, Dec 18, 2017 at 10:26:28AM +0800, Peng Fan wrote:
>> Hi All,
>>
>> I compiled xenomai-next on my ARM64 platform, but met Max and Avg not correct.
>> See below:
>>
>> ./cyclictest -a -t10 -n -p99 -c 0
>> # /dev/cpu_dma_latency set to 0us
>> policy: fifo: loadavg: 0.97 0.51 0.21 1/135 3018
>> policy: fifo: loadavg: 1.00 0.76 0.38 1/128 3018
>> T:[  200.650323] random: crng init done      0 Act:    0 Avg:443149053456561 Max:      -1
>> T: 0 ( 3002) P:99 I:1000 C: 373066 Min:      0 Act:    0 Avg:395570629834068 Max:      -11
>> T: 1 ( 3003) P:99 I:1500 C: 248710 Min:      0 Act:    0 Avg:148339383810136 Max:      -111
>> T: 2 ( 3004) P:99 I:2000 C: 186532 Min:      0 Act:    0 Avg:593359125738518 Max:      -1
>> T: 3 ( 3005) P:99 I:2500 C: 149359 Min:      0 Act:    0 Avg:123506076458128 Max:      -11
>> T: 4 ( 3006) P:99 I:3000 C: 124465 Min:      0 Act:    0 Avg:592833136181562 Max:      -1
>> T: 5 ( 3007) P:99 I:3500 C: 106684 Min:      0 Act:    0 Avg:172910127795260 Max:      -111
>> T: 6 ( 3008) P:99 I:4000 C:  93349 Min:      0 Act:    0 Avg:1383273613171719 Max:      -1
>> T: 7 ( 3009) P:99 I:4500 C:  82977 Min:      0 Act:    0 Avg:666934598998863 Max:      -1
>> T: 8 ( 3010) P:99 I:5000 C:  74679 Min:      0 Act:    0 Avg:988055226969271 Max:      -11
>>
>> Seems xenomai cyclictest and rt-tests cyclictest is not sync, or there are
>> some differecense. Could you please help me clarify what's the difference
>> between xenomai cyclictest and rt-tests cyclictest?  I did not find out which
>> exact commit number when importing rt-tests cyclictest to xenomai.
> 
> I add a debug info in cyclictest.c, see below:
> 
> diff --git a/demo/posix/cyclictest/cyclictest.c b/demo/posix/cyclictest/cyclictest.c
> index 31d9e5d0b..b16321cd9 100644
> --- a/demo/posix/cyclictest/cyclictest.c
> +++ b/demo/posix/cyclictest/cyclictest.c
> @@ -920,6 +920,11 @@ void *timerthread(void *param)
>                         diff = calcdiff_ns(now, next);
>                 else
>                         diff = calcdiff(now, next);
> +
> +               if (diff == -1) {
> +                       printf("==== %ld %ld %ld %ld\n", now.tv_sec, now.tv_nsec, next.tv_sec, next.tv_nsec);
> +                       exit(0);
> +               }
>                 if (diff < stat->min)
>                         stat->min = diff;
>                 if (diff > stat->max) {
> 
> And I encounter the case that diff is -1,
> "==== 16124 21743627 16124 21744638"
> only 1ns difference between now and next.
> This means clock_nanosleep wakeup earlier than expected?
> I am using 4.9.51 kernel, and xenomai-next on ARM64. I am tracking
> the hrtimer things, but no good progress. Please advise, if you any ideas.
> 

You need to calibrate the core timer with the "autotune" utility. Some
details available here:

https://xenomai.org/documentation/xenomai-3/html/man1/autotune/index.html

-- 
Philippe.


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

* Re: [Xenomai] xenomai cyclictest negative Max value
  2017-12-20 10:07   ` Philippe Gerum
@ 2017-12-27  0:49     ` Peng Fan
  0 siblings, 0 replies; 5+ messages in thread
From: Peng Fan @ 2017-12-27  0:49 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On Wed, Dec 20, 2017 at 11:07:18AM +0100, Philippe Gerum wrote:
>On 12/20/2017 07:49 AM, Peng Fan wrote:
>> On Mon, Dec 18, 2017 at 10:26:28AM +0800, Peng Fan wrote:
>>> Hi All,
>>>
>>> I compiled xenomai-next on my ARM64 platform, but met Max and Avg not correct.
>>> See below:
>>>
>>> ./cyclictest -a -t10 -n -p99 -c 0
>>> # /dev/cpu_dma_latency set to 0us
>>> policy: fifo: loadavg: 0.97 0.51 0.21 1/135 3018
>>> policy: fifo: loadavg: 1.00 0.76 0.38 1/128 3018
>>> T:[  200.650323] random: crng init done      0 Act:    0 Avg:443149053456561 Max:      -1
>>> T: 0 ( 3002) P:99 I:1000 C: 373066 Min:      0 Act:    0 Avg:395570629834068 Max:      -11
>>> T: 1 ( 3003) P:99 I:1500 C: 248710 Min:      0 Act:    0 Avg:148339383810136 Max:      -111
>>> T: 2 ( 3004) P:99 I:2000 C: 186532 Min:      0 Act:    0 Avg:593359125738518 Max:      -1
>>> T: 3 ( 3005) P:99 I:2500 C: 149359 Min:      0 Act:    0 Avg:123506076458128 Max:      -11
>>> T: 4 ( 3006) P:99 I:3000 C: 124465 Min:      0 Act:    0 Avg:592833136181562 Max:      -1
>>> T: 5 ( 3007) P:99 I:3500 C: 106684 Min:      0 Act:    0 Avg:172910127795260 Max:      -111
>>> T: 6 ( 3008) P:99 I:4000 C:  93349 Min:      0 Act:    0 Avg:1383273613171719 Max:      -1
>>> T: 7 ( 3009) P:99 I:4500 C:  82977 Min:      0 Act:    0 Avg:666934598998863 Max:      -1
>>> T: 8 ( 3010) P:99 I:5000 C:  74679 Min:      0 Act:    0 Avg:988055226969271 Max:      -11
>>>
>>> Seems xenomai cyclictest and rt-tests cyclictest is not sync, or there are
>>> some differecense. Could you please help me clarify what's the difference
>>> between xenomai cyclictest and rt-tests cyclictest?  I did not find out which
>>> exact commit number when importing rt-tests cyclictest to xenomai.
>> 
>> I add a debug info in cyclictest.c, see below:
>> 
>> diff --git a/demo/posix/cyclictest/cyclictest.c b/demo/posix/cyclictest/cyclictest.c
>> index 31d9e5d0b..b16321cd9 100644
>> --- a/demo/posix/cyclictest/cyclictest.c
>> +++ b/demo/posix/cyclictest/cyclictest.c
>> @@ -920,6 +920,11 @@ void *timerthread(void *param)
>>                         diff = calcdiff_ns(now, next);
>>                 else
>>                         diff = calcdiff(now, next);
>> +
>> +               if (diff == -1) {
>> +                       printf("==== %ld %ld %ld %ld\n", now.tv_sec, now.tv_nsec, next.tv_sec, next.tv_nsec);
>> +                       exit(0);
>> +               }
>>                 if (diff < stat->min)
>>                         stat->min = diff;
>>                 if (diff > stat->max) {
>> 
>> And I encounter the case that diff is -1,
>> "==== 16124 21743627 16124 21744638"
>> only 1ns difference between now and next.
>> This means clock_nanosleep wakeup earlier than expected?
>> I am using 4.9.51 kernel, and xenomai-next on ARM64. I am tracking
>> the hrtimer things, but no good progress. Please advise, if you any ideas.
>> 
>
>You need to calibrate the core timer with the "autotune" utility. Some
>details available here:
>
>https://xenomai.org/documentation/xenomai-3/html/man1/autotune/index.html

I tried directly run "#autotune". It could fix the negative issue on i.mx6q and
i.mx7d. But on i.MX8 ARM64, I still could met the issue. Is there something
more that I could try?

Thanks,
Peng.

>
>-- 
>Philippe.

-- 


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

end of thread, other threads:[~2017-12-27  0:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-18  2:26 [Xenomai] xenomai cyclictest negative Max value Peng Fan
2017-12-20  6:49 ` Peng Fan
2017-12-20  7:34   ` Peng Fan
2017-12-20 10:07   ` Philippe Gerum
2017-12-27  0:49     ` Peng Fan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.