On Thu, Dec 14, 2023 at 09:39:02PM +0100, Paolo Bonzini wrote: > Il gio 14 dic 2023, 21:12 Stefan Hajnoczi <[email protected]> ha scritto: > > > Since the fd may be bypassed until ->io_poll_end() returns, we must poll > > one last time to check if an event snuck in right at the end without > > making the fd readable. If polling detected an event, then we must do > > something. We cannot drop the event > > > I agree that in general we cannot. I wonder however if, in the (already > racy) case of a concurrent aio_set_fd_handler(ctx, fd, NULL, ...), you > really need to call poll_ready here.
It doesn't need to happen here but it needs to be recorded so that the handler (either poll_ready or the fd read handler) runs later. In the case of eventfds it's easy to write(fd, ...) so that activity will be picked up again when file descriptor monitoring resumes. > > > > (An alternative is to poll once before monitoring the fd again. That way > > pending events are detected even if the fd wasn't readable. That is > > currently not the way aio-posix.c works though.) > > > > Yes, that would be a change. If I understood correctly Hanna's suggestions > in the issue, she also mentioned doing a manual virtqueue notification > before monitoring restarts. So basically my idea boils down to implementing > that, and then cleaning up everything on top. Okay. Stefan
signature.asc
Description: PGP signature
