]> git.ipfire.org Git - thirdparty/qemu.git/commit - MAINTAINERS
aio-posix: extract ppoll(2) and epoll(7) fd monitoring
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 5 Mar 2020 17:08:02 +0000 (17:08 +0000)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 9 Mar 2020 16:41:31 +0000 (16:41 +0000)
commit1f050a4690f62a1e7dabc4f44141e9f762c3769f
tree289c3970dfed15773b4a6cc234d2c580f28ef189
parent3aa221b382c9b36db1750ef5ed340b6566aacb8c
aio-posix: extract ppoll(2) and epoll(7) fd monitoring

The ppoll(2) and epoll(7) file descriptor monitoring implementations are
mixed with the core util/aio-posix.c code.  Before adding another
implementation for Linux io_uring, extract out the existing
ones so there is a clear interface and the core code is simpler.

The new interface is AioContext->fdmon_ops, a pointer to a FDMonOps
struct.  See the patch for details.

Semantic changes:
1. ppoll(2) now reflects events from pollfds[] back into AioHandlers
   while we're still on the clock for adaptive polling.  This was
   already happening for epoll(7), so if it's really an issue then we'll
   need to fix both in the future.
2. epoll(7)'s fallback to ppoll(2) while external events are disabled
   was broken when the number of fds exceeded the epoll(7) upgrade
   threshold.  I guess this code path simply wasn't tested and no one
   noticed the bug.  I didn't go out of my way to fix it but the correct
   code is simpler than preserving the bug.

I also took some liberties in removing the unnecessary
AioContext->epoll_available (just check AioContext->epollfd != -1
instead) and AioContext->epoll_enabled (it's implicit if our
AioContext->fdmon_ops callbacks are being invoked) fields.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Link: https://lore.kernel.org/r/20200305170806.1313245-4-stefanha@redhat.com
Message-Id: <20200305170806.1313245-4-stefanha@redhat.com>
MAINTAINERS
include/block/aio.h
util/Makefile.objs
util/aio-posix.c
util/aio-posix.h [new file with mode: 0644]
util/fdmon-epoll.c [new file with mode: 0644]
util/fdmon-poll.c [new file with mode: 0644]