> I am using an i7-4790k.
FWIW, I have that same CPU and in initial testing on PREEMPT_RT, I'm
getting 15-20us latency. This is slightly worse that what I saw
previously on a Xeon 1270v2.
> And managed to get one sample up an running using rt_task_create(..)
> but when i try to switch the current task (rt_task_shadow(..)) which
> i can not trace.
Is it acceptable to mix the Xenomai native and POSIX skins? When I
tested Ach on Xenomai, I used only the POSIX skin. (To preserve
portability, I think it is preferable to use POSIX whenever possible.)
> do you have some sources to how you got your xenomai setup up and not
> mode-switching?
I have not investigated mode switching under Xenomai. What I have
seen is that Ach on Xenomai had lower latency than PREEMPT_RT (and
that Xenomai had some stability issues).
> 2) tried to figure out where the mode-switches occur.
> -> ach_create, ach_open
ach_create() and ach_open() open/close files and handle memory
mapping. I can see that these may cause mode switching.
> and ach_put all seem to produce some/
The only system calls ach_put() performs deal with pthread mutexes and
condition variables. Assuming Xenomai has implemented these
appropriately, then this should not mode switch. HOWEVER, if there is
contention on the mutex, ach_put() may yield until the other mutex
holder finishes. Priority-inheriting mutexes are used (when
available) though, so there should be no priority inversion. Maybe if
a low-priority task gets scheduled out while holding the mutex, this
could cause a mode switch, so all processes accessing the channel may
need to have real-time priority.
> 3) tried achtest
> -> A lot of Mode-switches
achtest does I/O, so mode-switches are expected.
> Do you have any suggestions?
1. Does unaligned memory access on AMD64 cause a Xenomai to mode
switch? Ach does not (currently) make an effort to align memory
accesses (but this wouldn't be too hard to fix).
2. One question here is if and how Xenomai mutex and condition
variable operations can cause a mode switch. Those are the only
type of system calls that (userspace) ach_put() and ach_get()
perform. Does a contention on a mutex between two primary-mode
processes register as a mode-switch?
3. What are your latency requirements? If they can be met with
PREEMPT_RT, I think that would be a far easier option.
4. The Right Way (TM) to implement Ach on Xenomai is probably as an
RTDM kernel module similar to the current Linux kernel module.
This would make channels select()-able and hopefully bypass any
potential quirks in Xenomai pthreads synchronization.
Hope that helps...
Cheers,
-ntd