From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Fabien Chouteau <chouteau@adacore.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Amos Kong <akong@redhat.com>
Subject: [Qemu-devel] [PATCH v2 0/9] main-loop: switch to g_poll(3) on POSIX hosts
Date: Fri, 1 Feb 2013 14:53:19 +0100 [thread overview]
Message-ID: <1359726808-11728-1-git-send-email-stefanha@redhat.com> (raw)
Amos Kong <akong@redhat.com> reported that file descriptors numbered higher
than 1024 could crash QEMU. This is due to the fixed size of the fd_set type
used for select(2) event polling.
This series converts the main-loop.c and aio-posix.c select(2) calls to
g_poll(3). This eliminates the fd_set type and allows QEMU to scale to high
numbers of file descriptors.
The g_poll(3) interface is a portable version of the poll(2) system call. The
difference to select(2) is that fine-grained events (G_IO_IN, G_IO_OUT,
G_IO_HUP, G_IO_ERR, G_IO_PRI) can be monitored instead of just
read/write/exception. Also, there is no limit to the file descriptor numbers
that may be used, allowing applications to scale to many file descriptors. See
the documentation for details:
http://developer.gnome.org/glib/2.28/glib-The-Main-Event-Loop.html#g-poll
The QEMU main loop works as follows today:
1. Call out to slirp, iohandlers, and glib sources to fill rfds/wfds/xfds with
the file descriptors to select(2).
2. Perform the select(2) call.
3. Call out to slirp, iohandlers, and glib sources to handle events polled in
rfds/wfds/xfds.
The plan of attack is as follows:
1. Replace select(2) with g_poll(3). Use glue that converts between
rfds/wfds/xfds and GPollFD so that the unconverted QEMU components still
work.
2. Convert slirp, iohandlers, and glib source fill/poll functions to use
GPollFD directly instead of rfds/wfds/xfds.
3. Drop the glue since all components now natively use GPollFD.
4. Convert aio-posix.c to g_poll(3) by reusing GPollFD.
I have tested that the series builds and is bisectable on Linux and Windows
hosts. But I have not done extensive testing on other host platforms or with
long-term guests to check for performance regressions.
v2:
* Replace custom Poller type with GArray [aliguori]
Stefan Hajnoczi (9):
main-loop: fix select_ret uninitialized variable warning
main-loop: switch to g_poll() on POSIX hosts
main-loop: switch POSIX glib integration to GPollFD
slirp: switch to GPollFD
iohandler: switch to GPollFD
main-loop: drop rfds/wfds/xfds for good
aio: extract aio_dispatch() from aio_poll()
aio: convert aio_poll() to g_poll(3)
aio: support G_IO_HUP and G_IO_ERR
aio-posix.c | 130 ++++++++++++++++++---------------------
async.c | 2 +
include/block/aio.h | 3 +
include/qemu/main-loop.h | 4 +-
iohandler.c | 40 +++++++++---
main-loop.c | 156 ++++++++++++++++++++++++++---------------------
slirp/libslirp.h | 6 +-
slirp/main.h | 1 -
slirp/slirp.c | 136 ++++++++++++++++++++++++-----------------
slirp/socket.c | 9 ---
slirp/socket.h | 2 +
stubs/slirp.c | 6 +-
12 files changed, 270 insertions(+), 225 deletions(-)
--
1.8.1
next reply other threads:[~2013-02-01 13:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 13:53 Stefan Hajnoczi [this message]
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 1/9] main-loop: fix select_ret uninitialized variable warning Stefan Hajnoczi
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 2/9] main-loop: switch to g_poll() on POSIX hosts Stefan Hajnoczi
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 3/9] main-loop: switch POSIX glib integration to GPollFD Stefan Hajnoczi
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 4/9] slirp: switch " Stefan Hajnoczi
2013-02-02 12:46 ` Blue Swirl
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 5/9] iohandler: " Stefan Hajnoczi
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 6/9] main-loop: drop rfds/wfds/xfds for good Stefan Hajnoczi
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 7/9] aio: extract aio_dispatch() from aio_poll() Stefan Hajnoczi
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 8/9] aio: convert aio_poll() to g_poll(3) Stefan Hajnoczi
2013-02-01 13:53 ` [Qemu-devel] [PATCH v2 9/9] aio: support G_IO_HUP and G_IO_ERR Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359726808-11728-1-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=chouteau@adacore.com \
--cc=jan.kiszka@siemens.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).