puzzled: running switchtest improves latency figures permanently
A message that is not in the archive (sent off-list or not yet received): [email protected]
We have a report from 'the field' which we cannot make sense of.
The situation:
- an AMD board: http://www.asus.com/Motherboard/F1A75M_PRO
- dmesg post boot: http://pastebin.com/38XrxNBy
- xeno-regression-test runs well, max 32us jitter
- John's Xenomai kernel packages: 3.5.7/2.6.2.1 [1]
- a native-skin userland RT threads application (linuxcnc[3])
- 2 threads
- jitter measured with its own GUI application 'latency-test'
- successfully tested on several other platforms
what we observed:
1. Problem behaviour
---------------------
- boot
- run LinuxCNC latency-test
- observe massive spikes in latency
- >100uS on a 25uS thread!
- http://static.mah.priv.at/public/latency/skunkworks-unprimed.png
now any of 2), 3) or 4) improve latency:
2. run switchtest: temporary change
------------------------------------
- while still running LinuxCNC latency-test from 1) above,
- running "/usr/lib/xenomai/testsuite/switchtest -s 1000" in a separate window
- hit 'Reset Statistics' on the latency-test window
- max latency drops massively
- see http://static.mah.priv.at/public/latency/skunkworks-primed.png [3]
- ^C-ing out of the switchtest makes latency rise again
3. running a trivial shell script: temporary change during script execution
----------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
- while true; do echo "nothing" > /dev/null; done
- again, latency-test shows rather low latency figures after hitting
'reset statistics' *as long as the above script is running*
- quote from Sam: "BTW - I ran the latency-test all night with the donothing scrip and it peaked at about 19.6us latency."
- killing the script makes the latency spikes reappear.
4. running xeno-regression-test and breaking out: permanent drop in latency
--------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
sudo xeno-regression-test -l "/usr/lib/xenomai/testsuite/dohell -m /tmp 100 " -t 2
- latency drops
- the key observation: if you break by ^C out of xeno-regression-test, *latency
figures remain low*
- note that breaking out of xeno-regression-test left some processes running, obviously dd and ls: http://pastebin.ca/2313116
- once these processes complete ( http://pastebin.ca/2313117) latency goes up again.
second data point:
we have a report from another user, same kernel, Intel Q8200 Quad core board, which confirms 'dohell 900' in a separate window does drop latency significantly. This suggests it might not board specific.
This leaves us puzzled as to the causality here. We would really like to get rid of the latency spikes, but the shell script approach isnt appealing.
Any suggestions?
- Michael, Sam, John
----
[1] Config:
http://www.zultron.com/static/2013/01/xenomai/3.5.7-test-32-bit/config-3.5.7.txt
PPA info: http://wiki.linuxcnc.org/cgi-bin/wiki.pl?XenomaiKernelPackages
[2] this screenshot was taken before we isolated the improvement to running switchtest -s 1000; before we had used 'sudo xeno-regression-test -l "/usr/lib/xenomai/testsuite/dohell -m /tmp 100" -t 2' and it was observed that breaking out of the test with ^C towards its end improves latency.
[3] the logic in essence follows trivial-periodic.c. While I have not separated out the test into a simple program, this is certainly doable if required.
Quoted 74 lines · Michael Haberler
We have a report from 'the field' which we cannot make sense of.
The situation:
- an AMD board: http://www.asus.com/Motherboard/F1A75M_PRO
- dmesg post boot: http://pastebin.com/38XrxNBy
- xeno-regression-test runs well, max 32us jitter
- John's Xenomai kernel packages: 3.5.7/2.6.2.1 [1]
- a native-skin userland RT threads application (linuxcnc[3])
- 2 threads
- jitter measured with its own GUI application 'latency-test'
- successfully tested on several other platformswhat we observed:
1. Problem behaviour
---------------------
- boot
- run LinuxCNC latency-test
- observe massive spikes in latency
- >100uS on a 25uS thread!
- http://static.mah.priv.at/public/latency/skunkworks-unprimed.pngnow any of 2), 3) or 4) improve latency:
2. run switchtest: temporary change
------------------------------------
- while still running LinuxCNC latency-test from 1) above,
- running "/usr/lib/xenomai/testsuite/switchtest-s 1000" in a separate window
- hit 'Reset Statistics' on the latency-test window
- max latency drops massively
- see http://static.mah.priv.at/public/latency/skunkworks-primed.png [3]
- ^C-ing out of the switchtest makes latency rise again3. running a trivial shell script: temporary change during script execution
----------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
- while true; do echo "nothing" >/dev/null; done
- again, latency-test shows rather low latency figures after hitting 'reset statistics' *as long as the above script is running*
- quote from Sam: "BTW - I ran the latency-test all night with the donothing scrip and it peaked at about 19.6us latency."
- killing the script makes the latency spikes reappear.4. running xeno-regression-test and breaking out: permanent drop in latency
--------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
sudo xeno-regression-test -l "/usr/lib/xenomai/testsuite/dohell-m /tmp
100 " -t 2
- latency drops
- the key observation: if you break by ^C out of xeno-regression-test, *latency
figures remain low*
- note that breaking out of xeno-regression-test left some processes running, obviously dd and ls: http://pastebin.ca/2313116
- once these processes complete ( http://pastebin.ca/2313117) latency goes up again.second data point:
we have a report from another user, same kernel, Intel Q8200 Quad core board, which confirms 'dohell 900' in a separate window does drop latency significantly. This suggests it might not board specific.
Quoted 5 lines
This leaves us puzzled as to the causality here. We would really like to get rid of the latency spikes, but the shell script approach isnt appealing.
Any suggestions?
I've seen similar behaviour. In my case it had to do with the latency of transitions of the cpu's idle states. The problem was worked around by providing "nohlt idle=poll". I'm sure it is documented somewhere on the xenomai website too.
Hope this helps,
Henri.
Quoted 30 lines
- Michael, Sam, John
----
[1] Config:
http://www.zultron.com/static/2013/01/xenomai/3.5.7-test-32-bit/config-3.5.7.txt
PPA info: http://wiki.linuxcnc.org/cgi-bin/wiki.pl?XenomaiKernelPackages[2] this screenshot was taken before we isolated the improvement to running switchtest -s 1000; before we had used 'sudo xeno-regression-test -l "
/usr/lib/xenomai/testsuite/dohell-m /tmp 100" -t 2' and it was observed that breaking out of the test with ^C towards its end improves latency.[3] the logic in essence follows
trivial-periodic.c. While I have not separated out the test into a simple program, this is certainly doable if required._______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai
Quoted 79 lines · Henri Roosen
Quoted 77 lines · Michael Haberler
We have a report from 'the field' which we cannot make sense of.
The situation:
- an AMD board: http://www.asus.com/Motherboard/F1A75M_PRO
- dmesg post boot: http://pastebin.com/38XrxNBy
- xeno-regression-test runs well, max 32us jitter
- John's Xenomai kernel packages: 3.5.7/2.6.2.1 [1]
- a native-skin userland RT threads application (linuxcnc[3])
- 2 threads
- jitter measured with its own GUI application 'latency-test'
- successfully tested on several other platformswhat we observed:
1. Problem behaviour
---------------------
- boot
- run LinuxCNC latency-test
- observe massive spikes in latency
- >100uS on a 25uS thread!
- http://static.mah.priv.at/public/latency/skunkworks-unprimed.pngnow any of 2), 3) or 4) improve latency:
2. run switchtest: temporary change
------------------------------------
- while still running LinuxCNC latency-test from 1) above,
- running "/usr/lib/xenomai/testsuite/switchtest-s 1000" in a separate window
- hit 'Reset Statistics' on the latency-test window
- max latency drops massively
- see http://static.mah.priv.at/public/latency/skunkworks-primed.png [3]
- ^C-ing out of the switchtest makes latency rise again3. running a trivial shell script: temporary change during script execution
----------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
- while true; do echo "nothing" >/dev/null; done
- again, latency-test shows rather low latency figures after hitting 'reset statistics' *as long as the above script is running*
- quote from Sam: "BTW - I ran the latency-test all night with the donothing scrip and it peaked at about 19.6us latency."
- killing the script makes the latency spikes reappear.4. running xeno-regression-test and breaking out: permanent drop in latency
--------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
sudo xeno-regression-test -l "/usr/lib/xenomai/testsuite/dohell-m /tmp
100 " -t 2
- latency drops
- the key observation: if you break by ^C out of xeno-regression-test, *latency
figures remain low*
- note that breaking out of xeno-regression-test left some processes running, obviously dd and ls: http://pastebin.ca/2313116
- once these processes complete ( http://pastebin.ca/2313117) latency goes up again.second data point:
we have a report from another user, same kernel, Intel Q8200 Quad core board, which confirms 'dohell 900' in a separate window does drop latency significantly. This suggests it might not board specific.This leaves us puzzled as to the causality here. We would really like to get rid of the latency spikes, but the shell script approach isnt appealing.
Quoted 7 lines
Quoted 2 lines
Any suggestions?
I've seen similar behaviour. In my case it had to do with the latency of transitions of the cpu's idle states. The problem was worked around by providing "nohlt idle=poll". I'm sure it is documented somewhere on the xenomai website too.
That will burn quite a bit of power, though. Maybe there is some BIOS switch to relax power saving mode a bit without giving up on halt. Also, do you see the same effect in text mode?
In any case, confirming the latency source via the ipipe tracer is a good first step: http://xenomai.org/index.php/I-pipe:Tracer. You could programmaticly break the trace once you detect the spike in your program. Post the resulting trace here for public discussion.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Quoted 92 lines · Jan Kiszka
Quoted 79 lines · Henri Roosen
Quoted 77 lines · Michael Haberler
We have a report from 'the field' which we cannot make sense of.
The situation:
- an AMD board: http://www.asus.com/Motherboard/F1A75M_PRO
- dmesg post boot: http://pastebin.com/38XrxNBy
- xeno-regression-test runs well, max 32us jitter
- John's Xenomai kernel packages: 3.5.7/2.6.2.1 [1]
- a native-skin userland RT threads application (linuxcnc[3])
- 2 threads
- jitter measured with its own GUI application 'latency-test'
- successfully tested on several other platformswhat we observed:
1. Problem behaviour
---------------------
- boot
- run LinuxCNC latency-test
- observe massive spikes in latency
- >100uS on a 25uS thread!
- http://static.mah.priv.at/public/latency/skunkworks-unprimed.pngnow any of 2), 3) or 4) improve latency:
2. run switchtest: temporary change
------------------------------------
- while still running LinuxCNC latency-test from 1) above,
- running "/usr/lib/xenomai/testsuite/switchtest-s 1000" in a separate window
- hit 'Reset Statistics' on the latency-test window
- max latency drops massively
- see http://static.mah.priv.at/public/latency/skunkworks-primed.png [3]
- ^C-ing out of the switchtest makes latency rise again3. running a trivial shell script: temporary change during script execution
----------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
- while true; do echo "nothing" >/dev/null; done
- again, latency-test shows rather low latency figures after hitting 'reset statistics' *as long as the above script is running*
- quote from Sam: "BTW - I ran the latency-test all night with the donothing scrip and it peaked at about 19.6us latency."
- killing the script makes the latency spikes reappear.4. running xeno-regression-test and breaking out: permanent drop in latency
--------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
sudo xeno-regression-test -l "/usr/lib/xenomai/testsuite/dohell-m /tmp
100 " -t 2
- latency drops
- the key observation: if you break by ^C out of xeno-regression-test, *latency
figures remain low*
- note that breaking out of xeno-regression-test left some processes running, obviously dd and ls: http://pastebin.ca/2313116
- once these processes complete ( http://pastebin.ca/2313117) latency goes up again.second data point:
we have a report from another user, same kernel, Intel Q8200 Quad core board, which confirms 'dohell 900' in a separate window does drop latency significantly. This suggests it might not board specific.This leaves us puzzled as to the causality here. We would really like to get rid of the latency spikes, but the shell script approach isnt appealing.
Quoted 7 lines
Quoted 2 lines
Any suggestions?
I've seen similar behaviour. In my case it had to do with the latency of transitions of the cpu's idle states. The problem was worked around by providing "nohlt idle=poll". I'm sure it is documented somewhere on the xenomai website too.
That will burn quite a bit of power, though. Maybe there is some BIOS switch to relax power saving mode a bit without giving up on halt. Also, do you see the same effect in text mode?
Quoted 7 lines
In any case, confirming the latency source via the ipipe tracer is a good first step: http://xenomai.org/index.php/I-pipe:Tracer. You could programmaticly break the trace once you detect the spike in your program. Post the resulting trace here for public discussion.
Jan
BTW, though unrelated to the latency issues: Running a 32-bit kernel on a box with >1GB RAM is not a good choice, performance-wise. PAE is slow...
i386 is for low-end embedded only today. I'll continue testing it, but it will surely receive less attention than x86-64, just like in mainline Linux.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux
Quoted 101 lines · Jan Kiszka
Quoted 92 lines · Jan Kiszka
Quoted 79 lines · Henri Roosen
Quoted 77 lines · Michael Haberler
We have a report from 'the field' which we cannot make sense of.
The situation:
- an AMD board: http://www.asus.com/Motherboard/F1A75M_PRO
- dmesg post boot: http://pastebin.com/38XrxNBy
- xeno-regression-test runs well, max 32us jitter
- John's Xenomai kernel packages: 3.5.7/2.6.2.1 [1]
- a native-skin userland RT threads application (linuxcnc[3])
- 2 threads
- jitter measured with its own GUI application 'latency-test'
- successfully tested on several other platformswhat we observed:
1. Problem behaviour
---------------------
- boot
- run LinuxCNC latency-test
- observe massive spikes in latency
- >100uS on a 25uS thread!
- http://static.mah.priv.at/public/latency/skunkworks-unprimed.pngnow any of 2), 3) or 4) improve latency:
2. run switchtest: temporary change
------------------------------------
- while still running LinuxCNC latency-test from 1) above,
- running "/usr/lib/xenomai/testsuite/switchtest-s 1000" in a separate window
- hit 'Reset Statistics' on the latency-test window
- max latency drops massively
- see http://static.mah.priv.at/public/latency/skunkworks-primed.png [3]
- ^C-ing out of the switchtest makes latency rise again3. running a trivial shell script: temporary change during script execution
----------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
- while true; do echo "nothing" >/dev/null; done
- again, latency-test shows rather low latency figures after hitting 'reset statistics' *as long as the above script is running*
- quote from Sam: "BTW - I ran the latency-test all night with the donothing scrip and it peaked at about 19.6us latency."
- killing the script makes the latency spikes reappear.4. running xeno-regression-test and breaking out: permanent drop in latency
--------------------------------------------------------------------------
- reboot
- run latency-test, again observe latency spikes
- in a separate window, run:
sudo xeno-regression-test -l "/usr/lib/xenomai/testsuite/dohell-m /tmp
100 " -t 2
- latency drops
- the key observation: if you break by ^C out of xeno-regression-test, *latency
figures remain low*
- note that breaking out of xeno-regression-test left some processes running, obviously dd and ls: http://pastebin.ca/2313116
- once these processes complete ( http://pastebin.ca/2313117) latency goes up again.second data point:
we have a report from another user, same kernel, Intel Q8200 Quad core board, which confirms 'dohell 900' in a separate window does drop latency significantly. This suggests it might not board specific.This leaves us puzzled as to the causality here. We would really like to get rid of the latency spikes, but the shell script approach isnt appealing.
Quoted 7 lines
Quoted 2 lines
Any suggestions?
I've seen similar behaviour. In my case it had to do with the latency of transitions of the cpu's idle states. The problem was worked around by providing "nohlt idle=poll". I'm sure it is documented somewhere on the xenomai website too.
That will burn quite a bit of power, though. Maybe there is some BIOS switch to relax power saving mode a bit without giving up on halt. Also, do you see the same effect in text mode?
Quoted 7 lines
In any case, confirming the latency source via the ipipe tracer is a good first step: http://xenomai.org/index.php/I-pipe:Tracer. You could programmaticly break the trace once you detect the spike in your program. Post the resulting trace here for public discussion.
Jan
Quoted 6 lines
BTW, though unrelated to the latency issues: Running a 32-bit kernel on a box with >1GB RAM is not a good choice, performance-wise. PAE is slow...
i386 is for low-end embedded only today. I'll continue testing it, but it will surely receive less attention than x86-64, just like in mainline Linux.
I can continue running xeno-regression-test on geode and duall piii for the I-pipe releases as I did up to now.
Signature · 1 line
Gilles.
Quoted 7 lines · Michael Haberler
We have a report from 'the field' which we cannot make sense of.
The situation:
- an AMD board: http://www.asus.com/Motherboard/F1A75M_PRO
- dmesg post boot: http://pastebin.com/38XrxNBy
- xeno-regression-test runs well, max 32us jitter
Please do not rely on latency results with xeno-regression-test, switchtest artificially increases latencies by locking the scheduler. The tool to make latency benchmarks is xeno-test.
Quoted 9 lines
what we observed:
1. Problem behaviour
---------------------
- boot
- run LinuxCNC latency-test
- observe massive spikes in latency
- >100uS on a 25uS thread!
- http://static.mah.priv.at/public/latency/skunkworks-unprimed.png
Do you get the same results with Xenomai latency test?
Quoted 8 lines
now any of 2), 3) or 4) improve latency:
- running "/usr/lib/xenomai/testsuite/switchtest-s 1000" in a separate- while true; do echo "nothing" >
/dev/null; done- the key observation: if you break by ^C out of xeno-regression-test, *latency
figures remain low*
- note that breaking out of xeno-regression-test left some processes running, obviously dd and ls: http://pastebin.ca/2313116
Yes, that is a known behaviour of dohell. Fixing this in a manner portable accross various shell implementations proved to be a task not as easy as it seems. So, for the sake of simplicity, we simply ignore the problem, xeno-regression-test or xeno-test are meant to be run not very often, so a reboot after running them, or manually kill the task is not much of an issue.
Quoted 1 line
Any suggestions?
You have an issue with the idle loop. The three cases you mention cause the Linux kernel never to use the idle loop:
- switchtest run with the -s argument as a (non real-time) loop occupying 100% of the CPU.
- the shell loop does the same
- running dohell does the same.
Signature · 1 line
Gilles.
Henri, Jan, Gilles
thanks for the quick and profound answers
results are just coming in from 'the field' (the problem cases are in the colonies and the folks over there are still working their coffee mugs ;-)
Am 13.02.2013 um 12:53 schrieb Gilles Chanteperdrix:
Quoted 1 line
Do you get the same results with Xenomai latency test?
yes, it is reproducible
this is for boot option "nohlt idle=poll" added: http://imagebin.org/246556
(here for the linuxcnc latency test:http://imagebin.org/246546)
this is without that option: http://imagebin.org/246550 - notice sudden 230uS spike
so I that takes the linuxcnc latency test out of the equation
Quoted 9 lines
Quoted 1 line
Any suggestions?
You have an issue with the idle loop. The three cases you mention cause the Linux kernel never to use the idle loop:
- switchtest run with the -s argument as a (non real-time) loop occupying 100% of the CPU.
- the shell loop does the same
- running dohell does the same.
That makes sense.
Are there any specific knobs you'd suggest twisting?
--
thanks a lot! we already have a workaround based on Henri's suggestion; everything else is sugar on the cake
- Michael
Quoted 1 line · Michael Haberler
Are there any specific knobs you'd suggest twisting?
You have to configure what should happen when Linux is idle. You can change what Linux does when idle, by using the kernel command line parameters as Henri told you, or you may be able to configure what the processor does when idle. This may be possible from the BIOS menu, or alternatively with special tools which can be loaded by the boot-loader before Linux. On Intel processors, such a tool is Intel BIOS Implementation Test suite:
I do not know about AMD processors.
Regards.
Signature · 1 line
Gilles.