All of lore.kernel.org
 help / color / mirror / Atom feed
* Port of a RTAI based code
@ 2025-05-28 16:13 Emmanuel Pacaud
  2025-05-30  7:55 ` Jan Kiszka
  2025-06-02 15:20 ` Philippe Gerum
  0 siblings, 2 replies; 6+ messages in thread
From: Emmanuel Pacaud @ 2025-05-28 16:13 UTC (permalink / raw)
  To: xenomai

Hi,

A bit of context: we are happily running a bunch of control loops for the [Virgo gravitational wave detector](https://en.wikipedia.org/wiki/Virgo_interferometer) since 2008 using a realtime code based on RTAI. This realtime code runs on DELL R7x0 servers, exchanging data through optical fibers using custom PCIe boards. We are able to implement loops up to 50kHz (data reception, packet parsing, computation, data packing and data emission). Each iteration of the loop is triggered by an interruption generated by the PCIe board. Data reception/emission and packet parsing/packing is done in the interrupt handler, the computation being done in one or more user space process called from the interrupt handler. It works fine, but the latest kernel supported by RTAI being 5.4.x, we want to port the code base to Xenomai.

The way things are done currently relies on the fact RTAI schedules the user space processes as soon as we are waking them using `rt_sem_signal()`. If the process runs on the same CPU, `rt_sem_signal()` returns only when the computing task is done.

In pseudocode, the kernel code is:

```
irq_handler() 
{
  parse_imput_DMA_buffer() /* Data packets are parsed and stored in a shared memory */

  foreach user_space_tasks:
    rt_sem_signal(task_sem)

  fill_output_DMA_buffer()
  ask_PCI_board_for_DMA_transfer()
  acknowledge_interrupt()
}
```

In the user space process:

```
task_thread()
{
  while (!stop_task):
    rt_sem_wait(task_sem)
    do_computing()

}
```

I'm currently working on the port of this code to xenomai4, trying to minimize the refactoring.

Would it be possible to obtain a similar behaviour using evl ? I understood the user space processes will not be scheduled during the interrupt handler execution. So I suppose I have split the interrupt handler and implement the process waking part in a kernel thread. But what would be the right approach to wake the user space processes from the kernel space ?

Emmanuel.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-03  6:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 16:13 Port of a RTAI based code Emmanuel Pacaud
2025-05-30  7:55 ` Jan Kiszka
2025-05-30 20:51   ` Emmanuel Pacaud
2025-05-31  5:35     ` Jan Kiszka
2025-06-02 15:20 ` Philippe Gerum
2025-06-03  6:58   ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.