aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-12-18 16:31:25 +0200
committerAvi Kivity <avi@qumranet.com>2007-12-18 16:31:25 +0200
commit27d410ea9a9d76d51cc35a1e572392790e078665 (patch)
tree39f0d1c626d229d72f8275218c331074a018bb97
parent6a21c097710541efd9ff2da323990eed76314918 (diff)
Consume all pending I/O in I/O loop
Otherwise, we may miss incoming packets and only collect them when some random timer fires. Fixes network throughput regression after qemu-cvs merge. Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--vl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 36a5928b1..28c5df494 100644
--- a/vl.c
+++ b/vl.c
@@ -7673,16 +7673,20 @@ void main_loop_wait(int timeout)
slirp_select_fill(&nfds, &rfds, &wfds, &xfds);
}
#endif
+ moreio:
ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv);
if (ret > 0) {
IOHandlerRecord **pioh;
+ int more = 0;
for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {
if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {
ioh->fd_read(ioh->opaque);
+ more = 1;
}
if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {
ioh->fd_write(ioh->opaque);
+ more = 1;
}
}
@@ -7696,6 +7700,8 @@ void main_loop_wait(int timeout)
} else
pioh = &ioh->next;
}
+ if (more)
+ goto moreio;
}
#if defined(CONFIG_SLIRP)
if (slirp_inited) {