linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question on poll interface in Linux
@ 2021-04-27  4:21 sainath grandhi
  0 siblings, 0 replies; only message in thread
From: sainath grandhi @ 2021-04-27  4:21 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-27  4:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27  4:21 Question on poll interface in Linux sainath grandhi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).