qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Improve -net user (slirp) performance by 4x
Date: Mon, 01 May 2006 14:19:09 +0200	[thread overview]
Message-ID: <4455FCBD.8030209@bellard.org> (raw)
In-Reply-To: <c1bf1cf0604302000ree12430v7144109271cb6a2f@mail.gmail.com>

Ed Swierk wrote:

> 3. qemu sleeps soundly while packets back up in slirp's buffers. slirp
> socket fds should be added to the main qemu select() loop to avoid
> unnecessary delays.

I agree, but your patch does not suppress the slirp select(). I tried to 
do it with the following patch but slirp becomes twice slower and I 
cannot get a good explanation. Maybe you could look at that problem so 
that a real correction can be commited.

Regards,

Fabrice.

Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.180
diff -u -w -r1.180 vl.c
--- vl.c        30 Apr 2006 22:53:25 -0000      1.180
+++ vl.c        1 May 2006 12:17:36 -0000
@@ -4361,7 +4361,7 @@
  void main_loop_wait(int timeout)
  {
      IOHandlerRecord *ioh, *ioh_next;
-    fd_set rfds, wfds;
+    fd_set rfds, wfds, xfds;
      int ret, nfds;
      struct timeval tv;
      PollingEntry *pe;
@@ -4382,6 +4382,7 @@
      nfds = -1;
      FD_ZERO(&rfds);
      FD_ZERO(&wfds);
+    FD_ZERO(&xfds);
      for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {
          if (ioh->fd_read &&
              (!ioh->fd_read_poll ||
@@ -4403,7 +4404,12 @@
  #else
      tv.tv_usec = timeout * 1000;
  #endif
-    ret = select(nfds + 1, &rfds, &wfds, NULL, &tv);
+#if defined(CONFIG_SLIRP)
+    if (slirp_inited) {
+        slirp_select_fill(&nfds, &rfds, &wfds, &xfds);
+    }
+#endif
+    ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv);
      if (ret > 0) {
          /* XXX: better handling of removal */
          for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
@@ -4416,29 +4422,13 @@
              }
          }
      }
-#ifdef _WIN32
-    tap_win32_poll();
-#endif
-
  #if defined(CONFIG_SLIRP)
-    /* XXX: merge with the previous select() */
-    if (slirp_inited) {
-        fd_set rfds, wfds, xfds;
-        int nfds;
-        struct timeval tv;
-
-        nfds = -1;
-        FD_ZERO(&rfds);
-        FD_ZERO(&wfds);
-        FD_ZERO(&xfds);
-        slirp_select_fill(&nfds, &rfds, &wfds, &xfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 0;
-        ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv);
-        if (ret >= 0) {
+    if (slirp_inited && ret >= 0) {
              slirp_select_poll(&rfds, &wfds, &xfds);
          }
-    }
+#endif
+#ifdef _WIN32
+    tap_win32_poll();
  #endif

      if (vm_running) {

  reply	other threads:[~2006-05-01 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-01  3:00 [Qemu-devel] [PATCH] Improve -net user (slirp) performance by 4x Ed Swierk
2006-05-01 12:19 ` Fabrice Bellard [this message]
2006-05-01 13:34   ` Fabrice Bellard

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=4455FCBD.8030209@bellard.org \
    --to=fabrice@bellard.org \
    --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).