On Mon, Sep 13 2021 at 13:01, Sohil Mehta wrote: > Add a new system call to allow applications to block in the kernel and > wait for user interrupts. > > <The current implementation doesn't support waking up from other > blocking system calls like sleep(), read(), epoll(), etc. > > uintr_wait() is a placeholder syscall while we decide on that > behaviour.> Which behaviour? You cannot integrate this into [clock_]nanosleep() by any means or wakeup something which is blocked in read(somefd) via SENDUIPI. What you can do is implement read() and poll() support for the uintrfd. Anything else is just not going to fly. Adding support for read/poll is pretty much a straight forward variant of a correctly implemented wait()/wakeup() mechanism. While poll()/read() support might be useful and poll() also provides a timeout, having an explicit (timed) wait mechanism might be interesting. But that brings me to an interesting question. There are two cases: 1) The task installed a user space interrupt handler. Now it want's to play nice and yield the CPU while waiting. So it needs to reinstall the UINV vector on return to user and update UIRR, but that'd be covered by the existing mechanism. Fine. 2) Task has no user space interrupt handler installed and just want's to use that wait mechanism. What is consuming the pending bit(s)? If that's not a valid use case, then the wait has to check for that and reject the syscall with EINVAL. If it is valid, then how are the pending bits consumed and relayed to user space? The same questions arise when you think about implementing poll/read support simply because the regular poll/read semantics are: poll waits for the event and read consumes the event which would be similar to #2 above, but with an installed user space interrupt handler the return from the poll system call would consume the event immediately (assumed that UIF is set). Thanks, tglx