[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CABqzqi41dV2J9V1k12r2RGt-wM8+3EZnWZsBhazQ1rosXRD4+A@mail.gmail.com>
Date: Mon, 26 Apr 2021 21:21:04 -0700
From: sainath grandhi <saiallforums@...il.com>
To: linux-kernel@...r.kernel.org
Subject: Question 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
Powered by blists - more mailing lists