From: Michel Macena Oliveira <hidden> Date: 2021-03-10 20:10:24
Hi,
I'm currently developing a time benchmark application where I want
to measure a real time thread latency. My application is based on
Cyclictest from
the rt-tests suit.
At least that's what I expected, but my latencies are much bigger than
Cyclictest ones.
From cyclictest I get an average in my computer of something between
2300 and 2500 nanoseconds. However, in my application I'm having
something between 47000 and 55000 nanoseconds. As you can see it is
much higher!
I'm not sure of what I'm doing wrong, could you help or suggest something?
Processor Info:
From: Daniel Wagner <hidden> Date: 2021-03-11 12:28:27
Hi Michel,
On 10.03.21 21:07, Michel Macena Oliveira wrote:
At least that's what I expected, but my latencies are much bigger than
Cyclictest ones.
From cyclictest I get an average in my computer of something between
2300 and 2500 nanoseconds. However, in my application I'm having
something between 47000 and 55000 nanoseconds. As you can see it is
much higher!
I'm not sure of what I'm doing wrong, could you help or suggest something?
Check if your system uses power managment. cyclictest disables the power
management by using the /dev/cpu_dma_latency API.
HTH,
Daniel
From: Ahmed S. Darwish <hidden> Date: 2021-03-11 12:59:23
On Wed, Mar 10, 2021 at 05:07:47PM -0300, Michel Macena Oliveira wrote:
I'm currently developing a time benchmark application where I want
to measure a real time thread latency. My application is based on
Cyclictest from
the rt-tests suit.
...
I programmed in such way that it would be equivalent to Cyclict test
...
At least that's what I expected, but my latencies are much bigger than
Cyclictest ones.
I don't know the nature of the "time benchmark" application you are
writing.
Just a small hint that if you're doing any heavy OpenGL graphics within
that application, the latency can shoot up significantly. On some of our
Intel boxes, this can lead to an increase of 100-200 microseconds.
That's because since Intel Gen9+ GPUs, Intel shares the Last-Level Cache
(and thus also memory bandwidth) between the GPU and the CPU. This
benefits graphical applications, but hurts predicatbility significantly.
Good luck,
--
Ahmed S. Darwish
Linutronix GmbH
From: John Ogness <john.ogness@linutronix.de> Date: 2021-03-11 13:40:02
On 2021-03-11, Daniel Wagner [off-list ref] wrote:
On 10.03.21 21:07, Michel Macena Oliveira wrote:
quoted
At least that's what I expected, but my latencies are much bigger than
Cyclictest ones.
From cyclictest I get an average in my computer of something between
2300 and 2500 nanoseconds. However, in my application I'm having
something between 47000 and 55000 nanoseconds. As you can see it is
much higher!
I'm not sure of what I'm doing wrong, could you help or suggest something?
Check if your system uses power managment. cyclictest disables the power
management by using the /dev/cpu_dma_latency API.
In addition, avoid file I/O in your real-time thread. Store your
calculations in a variable and let another thread read it and write to
disk. Then it would be more "equivalent to Cyclict test".
John Ogness
From: Michel Macena Oliveira <hidden> Date: 2021-03-11 14:59:44
Hi Daniel,
Thanks for your answer! That was the problem!
If I understand correctly when Cyclictest writes to the
cpu_dma_latency file, the processor does not sleep and remain
full power all the time. Is there any problem writing a RT application
(not a benchmark one) with this trick?
Could it cause any harm to the system?
My idea is to develop a RT application in which I have a scheduled
thread to compute and deliver results in a given time or interval.
Michel
Em qui., 11 de mar. de 2021 às 09:27, Daniel Wagner [off-list ref] escreveu:
Hi Michel,
On 10.03.21 21:07, Michel Macena Oliveira wrote:
quoted
At least that's what I expected, but my latencies are much bigger than
Cyclictest ones.
From cyclictest I get an average in my computer of something between
2300 and 2500 nanoseconds. However, in my application I'm having
something between 47000 and 55000 nanoseconds. As you can see it is
much higher!
I'm not sure of what I'm doing wrong, could you help or suggest something?
Check if your system uses power managment. cyclictest disables the power
management by using the /dev/cpu_dma_latency API.
HTH,
Daniel
From: Michel Macena Oliveira <hidden> Date: 2021-03-11 15:06:42
Hi Ahmed,
thanks for the answer!
Do you know if it would be valid for GTK interface applications?
Michel
Em qui., 11 de mar. de 2021 às 09:58, Ahmed S. Darwish
[off-list ref] escreveu:
On Wed, Mar 10, 2021 at 05:07:47PM -0300, Michel Macena Oliveira wrote:
quoted
I'm currently developing a time benchmark application where I want
to measure a real time thread latency. My application is based on
Cyclictest from
the rt-tests suit.
...
quoted
I programmed in such way that it would be equivalent to Cyclict test
...
quoted
At least that's what I expected, but my latencies are much bigger than
Cyclictest ones.
I don't know the nature of the "time benchmark" application you are
writing.
Just a small hint that if you're doing any heavy OpenGL graphics within
that application, the latency can shoot up significantly. On some of our
Intel boxes, this can lead to an increase of 100-200 microseconds.
That's because since Intel Gen9+ GPUs, Intel shares the Last-Level Cache
(and thus also memory bandwidth) between the GPU and the CPU. This
benefits graphical applications, but hurts predicatbility significantly.
Good luck,
--
Ahmed S. Darwish
Linutronix GmbH
Do you know if it would be valid for GTK interface applications?
Yes, we notice latency increases even when a modern dekstop graphics
environment like GNOME is running but idle. Remember that both Windows
and modern Linux GTK environments uses the GPU — even for 2D rendering.
If you're interested, I presented a small talk about the topic here:
https://linutronix.de/PDF/Realtime_and_graphics-acontradiction2021.pdf
Good luck,
--
Ahmed S. Darwish
Linutronix GmbH
From: Ahmed S. Darwish <hidden> Date: 2021-03-11 16:18:21
[ again, no top-posting please... ]
Michel Macena Oliveira wrote:
If I understand correctly when Cyclictest writes to the
cpu_dma_latency file, the processor does not sleep and remain
full power all the time. Is there any problem writing a RT application
(not a benchmark one) with this trick?
Well, if you do it for the benchmark, but not for production, then of
course, the benchmark is meaningless.
Could it cause any harm to the system?
Talk to your CPU provider.
Yes, sometimes CPU providers warn about that, especially for x86 (Note:
I don't speak for Intel or any other x86 manufacturer).
Good luck,
--
Ahmed S. Darwish
Linutronix GmbH
From: Ahmed S. Darwish <hidden> Date: 2021-03-11 17:57:05
Michel Macena Oliveira wrote:
Ahmed S. Darwish wrote:
quoted
[ again, no top-posting please... ]
...
quoted
Well, if you do it for the benchmark, but not for production, then of
course, the benchmark is meaningless.
Then in case of a RT application for production I should "live" with
this problem?
Well, you should have an over-all realtime strategy for your product.
This includes thermal requirements for both CPU (communicated with the
provider, due to the possible removal of power-saving support in SW) and
system enclosure... then you know if you can "live with it" or not.
Thanks, really helpful, but if I understand, in your application
you've used Intel CAT to mitigate the latency and plan to use Intel
MBA as well. Is that true?
Sorry for being picky, but this was part of another e-mail sub-thread.
You should've kept it there...
Anyway, the answer to your question is yes. You need to talk to Intel
for MBA support on non-Xeon CPUs though, as the instructions are only
available under an NDA. I cannot comment further on this.
Good luck,
--
Ahmed S. Darwish
Linutronix GmbH