[Xenomai] context switch minimize

Philippe Gerum rpm at xenomai.org
Thu Jul 5 16:41:27 CEST 2018

On 07/05/2018 04:14 PM, Philippe Gerum wrote:
> On 07/05/2018 04:08 PM, Johann Obermayr wrote:
>>> -----Ursprüngliche Nachricht-----
>>> Von: Xenomai [mailto:xenomai-bounces at xenomai.org] Im Auftrag von
>>> Philippe Gerum
>>> Gesendet: Donnerstag, 5. Juli 2018 15:05
>>> An: jimmyo <jimmyo at gmx.at>; xenomai at xenomai.org
>>> Betreff: Re: [Xenomai] context switch minimize
>>> On 07/05/2018 11:37 AM, jimmyo wrote:
>>>> Hello,
>>>> we have a running system on mx6 with Kernel 3.10.x and Xenomai 2.6.4.
>>>> i known, it's very old.
>>>> now we have to make some optmization.
>>>> In one xenomai task we need to check, if a TCP/UDP socket handle has
>>>> data to receive.
>>>> at this time we use select to detect if there are data available and
>>>> with ioctl & FIONREAD we get count of data.
>>>> Now we must search a way, to do this in the primary domain, without
>>>> switching to secondary domain.
>>>> Is there a way to solve it ?
>>>> we have a exists rtdm interface to a own kernel module.
>>>> And we use rt_dev_ioctl to communicate with this module.
>>> A plain thread could select() these file descriptors in userland, posting a
>>> Xenomai-managed semaphore which your rt thread would trywait() on.
>>> - semaphores can be posted by any thread, including those unknown to
>>> Xenomai
>>> - sem_trywait() would poll for the event without switching mode.
>>> --
>>> Philippe.
>>> _______________________________________________
>>> Xenomai mailing list
>>> Xenomai at xenomai.org
>>> https://xenomai.org/mailman/listinfo/xenomai
>> Hello,
>> We also thought about our own thread but wanted to know if there is a better solution.
> None that would be as simple.

The other way, would you fancy smashing flies with nukes, would be to
have your RTDM driver create a regular netdev, that you would attach to
a network bridge along with all the network interfaces receiving traffic
of interest to your rt task. In the xmit handler of that netdev, you
would be free to issue whatever synchronization/signal to your rt task
announcing incoming data, before passing the socket buffers along to the
next layer.


More information about the Xenomai mailing list