mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
aio-posix: support userspace polling of fd monitoring
Unlike ppoll(2) and epoll(7), Linux io_uring completions can be polled from userspace. Previously userspace polling was only allowed when all AioHandler's had an ->io_poll() callback. This prevented starvation of fds by userspace pollable handlers. Add the FDMonOps->need_wait() callback that enables userspace polling even when some AioHandlers lack ->io_poll(). For example, it's now possible to do userspace polling when a TCP/IP socket is monitored thanks to Linux io_uring. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Link: https://lore.kernel.org/r/20200305170806.1313245-7-stefanha@redhat.com Message-Id: <20200305170806.1313245-7-stefanha@redhat.com>
This commit is contained in:
@ -288,9 +288,15 @@ static int fdmon_io_uring_wait(AioContext *ctx, AioHandlerList *ready_list,
|
||||
return process_cq_ring(ctx, ready_list);
|
||||
}
|
||||
|
||||
static bool fdmon_io_uring_need_wait(AioContext *ctx)
|
||||
{
|
||||
return io_uring_cq_ready(&ctx->fdmon_io_uring);
|
||||
}
|
||||
|
||||
static const FDMonOps fdmon_io_uring_ops = {
|
||||
.update = fdmon_io_uring_update,
|
||||
.wait = fdmon_io_uring_wait,
|
||||
.need_wait = fdmon_io_uring_need_wait,
|
||||
};
|
||||
|
||||
bool fdmon_io_uring_setup(AioContext *ctx)
|
||||
|
Reference in New Issue
Block a user