Russell Johnson via Xenomai <[email protected]> writes:
> The app that I am currently working with has an interrupt scheme as follows:
> device on the PCIe bus sends an interrupt to the CPU, our linux driver then
> has an MSI interrupt handler (will be replaced by the EVL oob interrupt
> handler), the handler then calls eventfd_signal() to alert the userspace app
> that an interrupt happened. On the userspace side, there is a thread that
> implements an epoll that is monitoring the eventfd for an event. The issue
> is that eventfd and epoll are both Linux OS items, so I am not sure if
> sticking with this kind of method is the best option. Is there a more
> generally excepted method when developing with EVL to have an EVL kernel
> driver notify a userspace EVL thread that there was an interrupt?
>
The recommended way with EVL is to follow the common patterns used for
developing regular linux drivers, except that the EVL kernel API must be
used instead of the regular/in-band kernel API for anything which wants
to synchronize threads over the oob stage.
Typically, you could share an EVL semaphore [1] or an event flag group
[2] between the interrupt handler and the oob_ioctl() or oob_read()
call, which would block the user-space task until the matching event
happens. To monitor complex events, you could use an EVL wait queue
instead of a semaphore or a flag.
If you need to monitor multiple event sources in userland, you can use
the EVL poll API [4] with the file descriptors you would otherwise pass
to the oob_{ioctl, read, write}() calls.
[1] https://evlproject.org/core/user-api/semaphore/
[2] https://evlproject.org/core/user-api/flags/
[3] https://evlproject.org/core/kernel-api/wait/
[4] https://evlproject.org/core/user-api/poll/
--
Philippe.