CONFIG_PREEMPT & irqbench
Dear all,
I am running some latency tests with irqbench/irqloop. I am wondering whether it would be possible to achieve better results when activating CONFIG_PREEMPT and CONFIG_PREEMPT_VOLUNTARILY during the kernel configuration and running irqloop in User Mode over this kernel? Does it make any sense? I think in theory it should give better results because this irqloop runs in secondary(linux) domain when started, right? An increasing preemptibility of the linux kernel should be better for the irqloop-task.
All tests were made under heavy I/O and CPU load by means of "dd", "pingflood" and "cpuburn". Nevertheless, I can only achieve worse results when activating CONFIG_PREEMPT.
Thanks in advance and regards,
Markus Franke
Quoted 6 lines · Markus Franke
Dear all,
I am running some latency tests with irqbench/irqloop. I am wondering whether it would be possible to achieve better results when activating
CONFIG_PREEMPTandCONFIG_PREEMPT_VOLUNTARILYduring the kernel configuration and running irqloop in User Mode over this kernel?
Nope.
Quoted 1 line
Does it make any sense?
Nope. :)
Quoted 4 lines
I think in theory it should give better results because this irqloop runs in secondary(linux) domain when started, right? An increasing preemptibility of the linux kernel should be better for the irqloop-task.
The Linux kernel is already fully preemptible by Xenomai once you applied the I-pipe patch. Therefore, you are free to pick the Linux preemption strategy according to your *Linux* load, independent of what the real-time part needs.
Unless you have interactive Linux programs running, I can suggest to pick PREEMPT_VOLUNTARILY or even PREEMPT_NONE, specifically on low-end hardware.
Quoted 3 lines
All tests were made under heavy I/O and CPU load by means of "dd", "pingflood" and "cpuburn". Nevertheless, I can only achieve worse results when activating
CONFIG_PREEMPT.
Do you have CONFIG_DEBUG_PREEMPT set as well then? This option still as a small but measurable impact on Xenomai due to micro-dependencies that as scheduled to be removed in the near future.
Jan
Quoted 28 lines · Jan Kiszka
Quoted 6 lines · Markus Franke
Dear all,
I am running some latency tests with irqbench/irqloop. I am wondering whether it would be possible to achieve better results when activating
CONFIG_PREEMPTandCONFIG_PREEMPT_VOLUNTARILYduring the kernel configuration and running irqloop in User Mode over this kernel?Nope.
Quoted 1 line
Does it make any sense?
Nope. :)
Quoted 4 lines
I think in theory it should give better results because this irqloop runs in secondary(linux) domain when started, right? An increasing preemptibility of the linux kernel should be better for the irqloop-task.
The Linux kernel is already fully preemptible by Xenomai once you applied the I-pipe patch. Therefore, you are free to pick the Linux preemption strategy according to your *Linux* load, independent of what the real-time part needs.
Unless you have interactive Linux programs running, I can suggest to pick
PREEMPT_VOLUNTARILYor evenPREEMPT_NONE, specifically on low-end hardware.
Quoted 7 lines
Quoted 3 lines
All tests were made under heavy I/O and CPU load by means of "dd", "pingflood" and "cpuburn". Nevertheless, I can only achieve worse results when activating
CONFIG_PREEMPT.Do you have
CONFIG_DEBUG_PREEMPTset as well then? This option still as a small but measurable impact on Xenomai due to micro-dependencies that as scheduled to be removed in the near future.
Hmm, I should have better said "tiny". This experience is based on I-pipe tracer observations, and I guess you don't have that thing on, have you?
How much is the difference? How long did you measure to exclude noise.
Jan
Quoted 3 lines
Hmm, I should have better said "tiny". This experience is based on I-pipe tracer observations, and I guess you don't have that thing on, have you?
I have set:
---snip---
# CONFIG_IPIPE_DEBUG is not setCONFIG_IPIPE_TRACE_ENABLE_VALUE=0
---snap---
in both kernels (either with preempt or without).
Quoted 1 line
How much is the difference? How long did you measure to exclude noise.
The difference is about 1 us (in average and worst case) when running irqloop in IRQ handler mode.
I have been running the measurements for 1 minute under heavy load with an interrupt frequency of 1 ms. This gives 60000 samples. Is this too less in order to exclude noise?
Regards,
Markus Franke
begin:vcard
fn:Markus Franke
n:Franke;Markus
adr;quoted-printable:;;Vettersstra=C3=9Fe 64/722;Chemnitz;Saxony;09126;Germany email;internet:[email protected]
x-mozilla-html:FALSE
url:http://www.tu-chemnitz.de/~franm
version:2.1
end:vcard
Quoted 10 lines · Jan Kiszka
Quoted 4 lines · Markus Franke
I am running some latency tests with irqbench/irqloop. I am wondering whether it would be possible to achieve better results when activating
CONFIG_PREEMPTandCONFIG_PREEMPT_VOLUNTARILYduring the kernel configuration and running irqloop in User Mode over this kernel?Nope.
Quoted 8 lines
Quoted 1 line
Does it make any sense?
Nope. :)
The Linux kernel is already fully preemptible by Xenomai once you applied the I-pipe patch. Therefore, you are free to pick the Linux preemption strategy according to your *Linux* load, independent of what the real-time part needs.
Well, "Native-API-Tour.pdf" states that everytime a mode switch from Primary Domain to Secondary Domain is made (e.g. Linux system call like ioctl()), Xenomai can ease from the
"continuous trend of improvements of Linux 2.6 regarding preemptability". So CONFIG_PREEMPT should have an impact on measurements with Xenomai, maybe not with irqbench/irqloop. The problem here is that we don't have a mode switch, right? When running irqloop as User-Task it simply runs in Secondary Mode, right?
Quoted 3 lines
Do you have
CONFIG_DEBUG_PREEMPTset as well then? This option still as a small but measurable impact on Xenomai due to micro-dependencies that as scheduled to be removed in the near future.
I cannot see anything like
CONFIG_DEBUG_PREEMPT=y
or
#CONFIG_DEBUG_PREEMPT is not set
in my config-file. The parameter simply doesn't exist.
Markus
begin:vcard
fn:Markus Franke
n:Franke;Markus
adr;quoted-printable:;;Vettersstra=C3=9Fe 64/722;Chemnitz;Saxony;09126;Germany email;internet:[email protected]
x-mozilla-html:FALSE
url:http://www.tu-chemnitz.de/~franm
version:2.1
end:vcard
Quoted 13 lines · Markus Franke
Quoted 3 lines
Hmm, I should have better said "tiny". This experience is based on I-pipe tracer observations, and I guess you don't have that thing on, have you?
I have set:
---snip---
#CONFIG_IPIPE_DEBUGis not setCONFIG_IPIPE_TRACE_ENABLE_VALUE=0
---snap---in both kernels (either with preempt or without).
Quoted 8 lines
Quoted 1 line
How much is the difference? How long did you measure to exclude noise.
The difference is about 1 us (in average and worst case) when running irqloop in IRQ handler mode.
I have been running the measurements for 1 minute under heavy load with an interrupt frequency of 1 ms. This gives 60000 samples. Is this too less in order to exclude noise?
1 us is definitely in the noise region even on today's high-end PCs, specifically when running the test that short. 1/2 hour, or better several hours are required to gain reliable worst-case numbers.
Regarding the average, your test duration is likely enough. It indicates that CONFIG_PREEMPT worsens the cache hit-rate slightly.
Jan
Quoted 18 lines · Markus Franke
Quoted 9 lines · Jan Kiszka
Quoted 4 lines · Markus Franke
I am running some latency tests with irqbench/irqloop. I am wondering whether it would be possible to achieve better results when activating
CONFIG_PREEMPTandCONFIG_PREEMPT_VOLUNTARILYduring the kernel configuration and running irqloop in User Mode over this kernel?Nope.
Quoted 7 lines
Quoted 1 line
Does it make any sense?
Nope. :)
The Linux kernel is already fully preemptible by Xenomai once you applied the I-pipe patch. Therefore, you are free to pick the Linux preemption strategy according to your *Linux* load, independent of what the real-time part needs.
Quoted 8 lines
Well, "Native-API-Tour.pdf" states that everytime a mode switch from Primary Domain to Secondary Domain is made (e.g. Linux system call like
ioctl()), Xenomai can ease from the
"continuous trend of improvements of Linux 2.6 regarding preemptability". SoCONFIG_PREEMPTshould have an impact on measurements with Xenomai, maybe not with irqbench/irqloop. The problem here is that we don't have a mode switch, right? When running irqloop as User-Task it simply runs in Secondary Mode, right?
Of course, irqloop runs in *primary* mode to be able to handle the events deterministically. So it is not directly affected by CONFIG_PREEMPT.
Yes, if you have an RT thread that issues syscalls and wishes to have them handled as fast as possible, CONFIG_PREEMPT should be enabled (and CONFIG_XENO_OPT_RPIDISABLE should remain off, maybe you even want to consider CONFIG_XENO_OPT_ISHIELD then). Such RT application designs are tricky to get correct and deterministic, so it's often better to not rely on these properties and rather seek a clear separation of pure RT threads on the one side and Linux syscall issuing non-RT or RT borderline threads (low-prio RT threads that are being switched back and forth between primary and secondary mode) on the other.
Quoted 5 lines
Quoted 4 lines
Do you have
CONFIG_DEBUG_PREEMPTset as well then? This option still as a small but measurable impact on Xenomai due to micro-dependencies that as scheduled to be removed in the near future.
Quoted 7 lines
I cannot see anything like
CONFIG_DEBUG_PREEMPT=y
or
#CONFIG_DEBUG_PREEMPT is not setin my config-file. The parameter simply doesn't exist.
Shadowed by CONFIG_DEBUG=n likely.
Jan
Quoted 2 lines · Jan Kiszka
Of course, irqloop runs in *primary* mode to be able to handle the events deterministically. So it is not directly affected by
CONFIG_PREEMPT.
If I start irqloop in User-Mode, a thread is simply created via Linux system call pthread_create() which interacts with the xeno_irqbench-driver via ioctl(). But then I don't understand why irqloop is running in Primary (Xenomai) Mode? Because of the interaction with the RTDM-based driver?
I am just wondering because I can't see something like rt_task_create().
Quoted 9 lines
Yes, if you have an RT thread that issues syscalls and wishes to have them handled as fast as possible,
CONFIG_PREEMPTshould be enabled (andCONFIG_XENO_OPT_RPIDISABLEshould remain off, maybe you even want to considerCONFIG_XENO_OPT_ISHIELDthen). Such RT application designs are tricky to get correct and deterministic, so it's often better to not rely on these properties and rather seek a clear separation of pure RT threads on the one side and Linux syscall issuing non-RT or RT borderline threads (low-prio RT threads that are being switched back and forth between primary and secondary mode) on the other.
Ok I understand. So native kernel preemption should only provide better results if you have realtime-threads issuing linux systemcalls which is not really convenient.
Quoted 1 line
Shadowed by
CONFIG_DEBUG=nlikely.
probably by CONFIG_DEBUG_KERNEL=n
Quoted 10 lines · Markus Franke
Quoted 2 lines · Jan Kiszka
Of course, irqloop runs in *primary* mode to be able to handle the events deterministically. So it is not directly affected by
CONFIG_PREEMPT.If I start irqloop in User-Mode, a thread is simply created via Linux system call
pthread_create()which interacts with the xeno_irqbench-driver viaioctl(). But then I don't understand why irqloop is running in Primary (Xenomai) Mode? Because of the interaction with the RTDM-based driver?
I am just wondering because I can't see something likert_task_create().
There is life beyond the native skin. e.g. the posix one.
After all, Xenomai is all about skins (layers implementing various RT API interfaces).
So pthread_create() as well as ioctl() you may see in irqloop are implemented ("shadowed") by the posix skin.
Signature · 2 lines
Best regards, Dmitry Adamushko
Quoted 10 lines · Markus Franke
Quoted 2 lines · Jan Kiszka
Of course, irqloop runs in *primary* mode to be able to handle the events deterministically. So it is not directly affected by
CONFIG_PREEMPT.If I start irqloop in User-Mode, a thread is simply created via Linux system call
pthread_create()which interacts with the xeno_irqbench-driver viaioctl(). But then I don't understand why irqloop is running in Primary (Xenomai) Mode? Because of the interaction with the RTDM-based driver?
I am just wondering because I can't see something likert_task_create().
<see Dmitry's reply>
Quoted 11 lines
Quoted 10 lines
Yes, if you have an RT thread that issues syscalls and wishes to have them handled as fast as possible,
CONFIG_PREEMPTshould be enabled (andCONFIG_XENO_OPT_RPIDISABLEshould remain off, maybe you even want to considerCONFIG_XENO_OPT_ISHIELDthen). Such RT application designs are tricky to get correct and deterministic, so it's often better to not rely on these properties and rather seek a clear separation of pure RT threads on the one side and Linux syscall issuing non-RT or RT borderline threads (low-prio RT threads that are being switched back and forth between primary and secondary mode) on the other.
Quoted 3 lines
Ok I understand. So native kernel preemption should only provide better results if you have realtime-threads issuing linux systemcalls which is not really convenient.
It is for sure convenient. But it doesn't take the burden from you to understand what is happening underneath. That's my point.
Quoted 4 lines
Quoted 2 lines
Shadowed by
CONFIG_DEBUG=nlikely.probably by
CONFIG_DEBUG_KERNEL=n
Yep.
Jan
Quoted 15 lines · Dmitry Adamushko
Quoted 11 lines · Markus Franke
Quoted 2 lines · Jan Kiszka
Of course, irqloop runs in *primary* mode to be able to handle the events deterministically. So it is not directly affected by
CONFIG_PREEMPT.If I start irqloop in User-Mode, a thread is simply created via Linux system call
pthread_create()which interacts with the xeno_irqbench-driver viaioctl(). But then I don't understand why irqloop is running in Primary (Xenomai) Mode? Because of the interaction with the RTDM-based driver?
I am just wondering because I can't see something likert_task_create().
Quoted 1 line
There is life beyond the native skin. e.g. the posix one.
Thank you very much for this hint. :-)
Now I got it.
Quoted 5 lines
After all, Xenomai is all about skins (layers implementing various RT API interfaces).
So
pthread_create()as well asioctl()you may see in irqloop are implemented ("shadowed") by the posix skin.
Actually I should know this.
Regards,
Markus
begin:vcard
fn:Markus Franke
n:Franke;Markus
adr;quoted-printable:;;Vettersstra=C3=9Fe 64/722;Chemnitz;Saxony;09126;Germany email;internet:[email protected]
x-mozilla-html:FALSE
url:http://www.tu-chemnitz.de/~franm
version:2.1
end:vcard