Can multiple processes(not threads) poll on a device descriptor (For ex: /dev/xyx) in blocking mode and get woken up when the driver does a return POLLIN ?
Details: I have a driver and to support async event notification from the driver to user space apps, I have implemented a poll functionality in the driver. I am expecting multiple processes to do poll on my descriptor /dev/xyz, on doing poll, immediately driver puts them on a wait queue from the .poll function, so that they block until the driver returns a POLLIN.
Now, it works fine when one process is blocked on the descriptor, so when the driver does a POLLIN, the poll() unblocks and I process it. However if there are multiple processes blocked on the /dev/xyz (by doing poll) and if the driver sends a POLLIN, only one of the processes is unblocking and the other is still blocked.
Is there a way to make sure that all processes blocked on that descriptor is woken up when the driver does a POLLIN on the /dev/xyz ? (Like walking through the wait queue list or something ) ??
You can try to replace wake_up (or wake_up_interruptible) with wake_up_all (wake_up_interruptible_all). This should awake all waiting processes.