lkml.org 
[lkml]   [2021]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectQuestion on poll interface in Linux
Hello,
Looking for some guidance on using poll interfaces in Linux
We have a scenario where userspace has to wait on an interrupt from
the device. Inclined towards using poll interface on a file descriptor
in the userspace. When the device driver executes the interrupt
handler, it notifies the file descriptor and wakes up the Userspace
thread. Userspace thread reads the interrupt reason and handles the
reason.

I am afraid we have a scenario where we could lose notification from
kernel to Userspace thread if an interrupt happens during the time
window between 2 and 3 steps in the sequence below

1. Userspace thread is woken up
2. Userspace thread read the interrupt reason and handle the interrupt reason
3. Userspace thread goes back to blocked state again for next notification

Brief search on the Linux source code tells me that the kernel notify
function will wake up only a sleeping thread. So if the new interrupt
happens between steps 2 and 3, and the state of Userspace thread is
active, the kernel would not "notify" the Userspace thread and the
Userspace processing of new interrupt is missed.

In such scenarios, what is the best kernel-user notification interface
to use? Please advise

\
 
 \ /
  Last update: 2021-04-27 06:22    [W:0.026 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site