Scheduling latency issues
Hello Xenomai users and developers,
for my grad. assignment I am comparing Xenomai to some other co-kernel implementations (all using the Linux kernel).
The documentation of this project has been great, and the archives and source code has been a great help in finding my way around the system.
However, I've hit a little bump while testing some scheduling latency using the POSIX skin.
The latencies I'm registering are okay, but they do differ when picking different periods.
I have excluded my program from causing this issue, as the same thing happens when using the latency tool supplied by Xenomai.
I have run some traces to determine where the problem might be (see attachments), with one run using a 1 ms period and another using a 10 ms period.
I've noticed a big difference between __ipipe_syscall_root on offset 0x108 and in xnpod_resume_thread.
The latencies get even better when using a periodicity of 100 microseconds, and worse still at 100 milliseconds.
Of course, a latency difference of 10 microseconds isn't that bad, but I'm wondering why there is a difference at all?
I can attach my program as well if needed, but it simply loops in a thread and using clock_nanosleep with CLOCK_MONOTONIC, and pushing the results to a display thread with a message queue.
Still, the same occurs when using the supplied latency tool.
The system I'm testing this on is a MPC8548E , with Linux-2.6.29-DENX and Xenomai 2.5.0 .
Thanks in advance for your help.
Gerald Otter
p.s. I've read through the mailing lists and the TROUBLESHOOTING files, but could not find any references to a similar issue.
Quoted 22 lines · Gerald Otter
Hello Xenomai users and developers,
for my grad. assignment I am comparing Xenomai to some other co-kernel implementations (all using the Linux kernel).
The documentation of this project has been great, and the archives and source code has been a great help in finding my way around the system.However, I've hit a little bump while testing some scheduling latency using the POSIX skin.
The latencies I'm registering are okay, but they do differ when picking different periods.
I have excluded my program from causing this issue, as the same thing happens when using the latency tool supplied by Xenomai.I have run some traces to determine where the problem might be (see attachments), with one run using a 1 ms period and another using a 10 ms period.
I've noticed a big difference between__ipipe_syscall_rooton offset0x108and inxnpod_resume_thread.
The latencies get even better when using a periodicity of 100 microseconds, and worse still at 100 milliseconds.
Quoted 2 lines
Of course, a latency difference of 10 microseconds isn't that bad, but I'm wondering why there is a difference at all?
Cache artefact. By picking a short period, the Xenomai interrupt code is I-cached most of the time, and not much time is left to the regular non-rt linux activities to evict that code from the cache.
By increasing the period, more time is left to linux to cause cache evictions from real-time code, which translates into longer latencies due to cache misses and refills. The I-pipe tracer makes the phenomenon even more observable, because it consumes more D-cache as well.
Quoted 5 lines
I can attach my program as well if needed, but it simply loops in a thread and using
clock_nanosleepwithCLOCK_MONOTONIC, and pushing the results to a display thread with a message queue.
Still, the same occurs when using the supplied latency tool.
Take into account that the I-pipe tracer is inducing significant latency on powerpc, particularly now that is based on the ftrace infrastructure.
With CONFIG_IPIPE_TRACE disabled, your 854x should exhibit latency figures in the 20-30 us range worst-case in user-space (from the top of my head, but I would consider higher latencies as pathological on 85xx).
Quoted 2 lines
The system I'm testing this on is a MPC8548E , with Linux-2.6.29-DENX and Xenomai 2.5.0 .
If you plan to do measurements, make sure to always pick the latest available release when you start working, particularly when the series has just been started. 2.5.1 would be better, and picking 2.5.2 when it's out would be even better, to get rid of a few but annoying issues (read: freaking ugly monsters from the horror show) - albeit not latency-related though.
Quoted 11 lines
Thanks in advance for your help.
Gerald Otter
p.s. I've read through the mailing lists and the TROUBLESHOOTING files, but could not find any references to a similar issue.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Signature · 1 line
Philippe.
2010/3/16 Philippe Gerum <[email protected]>
Quoted 27 lines · Gerald Otter
Quoted 22 lines
Hello Xenomai users and developers,
for my grad. assignment I am comparing Xenomai to some other co-kernel implementations (all using the Linux kernel).
The documentation of this project has been great, and the archives and source code has been a great help in finding my way around the system.However, I've hit a little bump while testing some scheduling latency using the POSIX skin.
The latencies I'm registering are okay, but they do differ when picking different periods.
I have excluded my program from causing this issue, as the same thing happens when using the latency tool supplied by Xenomai.I have run some traces to determine where the problem might be (see attachments), with one run using a 1 ms period and another using a 10 ms period.
I've noticed a big difference between__ipipe_syscall_rooton offset0x108and inxnpod_resume_thread.
The latencies get even better when using a periodicity of 100 microseconds, and worse still at 100 milliseconds.Quoted 2 lines
Of course, a latency difference of 10 microseconds isn't that bad, but I'm wondering why there is a difference at all?
Quoted 8 lines
Cache artefact. By picking a short period, the Xenomai interrupt code is I-cached most of the time, and not much time is left to the regular non-rt linux activities to evict that code from the cache.
By increasing the period, more time is left to linux to cause cache evictions from real-time code, which translates into longer latencies due to cache misses and refills. The I-pipe tracer makes the phenomenon even more observable, because it consumes more D-cache as well.
That makes sense, perhaps I should make sure the cache is used in the load generation running in the background. Currently I'm simply running netperf's UDP_STREAM continuously, but I guess that doesn't use enough memory in between tasks to use the cache.
Quoted 6 lines
Quoted 5 lines
I can attach my program as well if needed, but it simply loops in a thread and using
clock_nanosleepwithCLOCK_MONOTONIC, and pushing the results to a display thread with a message queue.
Still, the same occurs when using the supplied latency tool.
Quoted 7 lines
Take into account that the I-pipe tracer is inducing significant latency on powerpc, particularly now that is based on the ftrace infrastructure.
With
CONFIG_IPIPE_TRACEdisabled, your 854x should exhibit latency figures in the 20-30 us range worst-case in user-space (from the top of my head, but I would consider higher latencies as pathological on 85xx).
I noticed latencies of around 20 microseconds worst-case without tracing and debugging features on, and around half that in short periods, so that seems to be correct.
Quoted 10 lines
Quoted 2 lines
The system I'm testing this on is a MPC8548E , with Linux-2.6.29-DENX and Xenomai 2.5.0 .
If you plan to do measurements, make sure to always pick the latest available release when you start working, particularly when the series has just been started. 2.5.1 would be better, and picking 2.5.2 when it's out would be even better, to get rid of a few but annoying issues (read: freaking ugly monsters from the horror show) - albeit not latency-related though.
I will go with 2.5.1 then.
Thanks for the (quick!) reply.
Gerald Otter
Quoted 17 lines
Quoted 11 lines
Thanks in advance for your help.
Gerald Otter
p.s. I've read through the mailing lists and the TROUBLESHOOTING files, but could not find any references to a similar issue.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help--
Philippe.
Quoted 37 lines · Gerald Otter
2010/3/16 Philippe Gerum <[email protected]>
Quoted 27 lines · Gerald Otter
Quoted 22 lines
Hello Xenomai users and developers,
for my grad. assignment I am comparing Xenomai to some other co-kernel implementations (all using the Linux kernel).
The documentation of this project has been great, and the archives and source code has been a great help in finding my way around the system.However, I've hit a little bump while testing some scheduling latency using the POSIX skin.
The latencies I'm registering are okay, but they do differ when picking different periods.
I have excluded my program from causing this issue, as the same thing happens when using the latency tool supplied by Xenomai.I have run some traces to determine where the problem might be (see attachments), with one run using a 1 ms period and another using a 10 ms period.
I've noticed a big difference between__ipipe_syscall_rooton offset0x108and inxnpod_resume_thread.
The latencies get even better when using a periodicity of 100 microseconds, and worse still at 100 milliseconds.Quoted 2 lines
Of course, a latency difference of 10 microseconds isn't that bad, but I'm wondering why there is a difference at all?
Quoted 8 lines
Cache artefact. By picking a short period, the Xenomai interrupt code is I-cached most of the time, and not much time is left to the regular non-rt linux activities to evict that code from the cache.
By increasing the period, more time is left to linux to cause cache evictions from real-time code, which translates into longer latencies due to cache misses and refills. The I-pipe tracer makes the phenomenon even more observable, because it consumes more D-cache as well.
Quoted 4 lines
That makes sense, perhaps I should make sure the cache is used in the load generation running in the background. Currently I'm simply running netperf's
UDP_STREAMcontinuously, but I guess that doesn't use enough memory in between tasks to use the cache.
This utility is aimed at hammering the cache badly:
http://homepages.cwi.nl/~manegold/Calibrator/src/
Quoted 52 lines
Quoted 7 lines
Quoted 6 lines
I can attach my program as well if needed, but it simply loops in a thread and using
clock_nanosleepwithCLOCK_MONOTONIC, and pushing the results to a display thread with a message queue.
Still, the same occurs when using the supplied latency tool.Quoted 7 lines
Take into account that the I-pipe tracer is inducing significant latency on powerpc, particularly now that is based on the ftrace infrastructure.
With
CONFIG_IPIPE_TRACEdisabled, your 854x should exhibit latency figures in the 20-30 us range worst-case in user-space (from the top of my head, but I would consider higher latencies as pathological on 85xx).I noticed latencies of around 20 microseconds worst-case without tracing and debugging features on, and around half that in short periods, so that seems to be correct.
Quoted 10 lines
Quoted 2 lines
The system I'm testing this on is a MPC8548E , with Linux-2.6.29-DENX and Xenomai 2.5.0 .
If you plan to do measurements, make sure to always pick the latest available release when you start working, particularly when the series has just been started. 2.5.1 would be better, and picking 2.5.2 when it's out would be even better, to get rid of a few but annoying issues (read: freaking ugly monsters from the horror show) - albeit not latency-related though.
I will go with 2.5.1 then.
Thanks for the (quick!) reply.Gerald Otter
Quoted 17 lines
Quoted 11 lines
Thanks in advance for your help.
Gerald Otter
p.s. I've read through the mailing lists and the TROUBLESHOOTING files, but could not find any references to a similar issue.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help--
Philippe.
Signature · 1 line
Philippe.
2010/3/16 Philippe Gerum <[email protected]>
Quoted 39 lines · Gerald Otter
Quoted 37 lines
2010/3/16 Philippe Gerum <[email protected]>
Quoted 35 lines · Gerald Otter
Quoted 22 lines
Hello Xenomai users and developers,
for my grad. assignment I am comparing Xenomai to some other co-kernel implementations (all using the Linux kernel).
The documentation of this project has been great, and the archives and source code has been a great help in finding my way around the system.However, I've hit a little bump while testing some scheduling latency using the POSIX skin.
The latencies I'm registering are okay, but they do differ when picking different periods.
I have excluded my program from causing this issue, as the same thing happens when using the latency tool supplied by Xenomai.I have run some traces to determine where the problem might be (see attachments), with one run using a 1 ms period and another using a 10 ms period.
I've noticed a big difference between__ipipe_syscall_rooton offset0x108and inxnpod_resume_thread.
The latencies get even better when using a periodicity of 100 microseconds, and worse still at 100 milliseconds.Quoted 2 lines
Of course, a latency difference of 10 microseconds isn't that bad, but I'm wondering why there is a difference at all?
Cache artefact. By picking a short period, the Xenomai interrupt code is I-cached most of the time, and not much time is left to the regular non-rt linux activities to evict that code from the cache.
By increasing the period, more time is left to linux to cause cache evictions from real-time code, which translates into longer latencies due to cache misses and refills. The I-pipe tracer makes the phenomenon even more observable, because it consumes more D-cache as well.
Quoted 7 lines
Quoted 4 lines
That makes sense, perhaps I should make sure the cache is used in the load generation running in the background. Currently I'm simply running netperf's
UDP_STREAMcontinuously, but I guess that doesn't use enough memory in between tasks to use the cache.This utility is aimed at hammering the cache badly:
http://homepages.cwi.nl/~manegold/Calibrator/src/
I've ran a few more tests, with varying periods. I took 10.000 measurements, where each measurement consists of the maximum latency of 100 samples.
This to make sure the maximum spikes are better visible. I've noticed on shorter periods its still hard to get measurements without cache having influence, but with the cache hammering program in the background, as well as netperf generating lots of network traffic the tests are realistic.The cache will have influence in real applications as well after all.
I've ran these tests on 2.5.1 and attached a graph (as pdf). I've smoothed things in the graph out quite a bit, as I've put a lot of periods in the tests.
As is clearly visible from the graph, the graphs converge towards a similar pattern, which confirms what you said.
Thanks a lot for the help, and the fast responses!
Gerald Otter