qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	therock247uk@247fixes.com, Stefan Hajnoczi <stefanha@redhat.com>,
	geleman@gmail.com
Subject: [Qemu-devel] [PATCH for-1.5 2/2] main-loop: partial revert of 5e3bc73
Date: Thu, 16 May 2013 17:36:01 +0200	[thread overview]
Message-ID: <1368718561-7816-3-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1368718561-7816-1-git-send-email-stefanha@redhat.com>

This patch reverts part of 5e3bc735d93dd23f074b5116fd11e1ad8cd4962f.

Paolo Bonzini wrote this patch and commented:

"WSAEventSelect is edge-triggered and the event will not be signaled if
the socket handler does not consume all the data in the socket buffer."

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 main-loop.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/main-loop.c b/main-loop.c
index 2b8eed7..cf36645 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -394,6 +394,20 @@ static int os_host_main_loop_wait(uint32_t timeout)
         return ret;
     }
 
+    FD_ZERO(&rfds);
+    FD_ZERO(&wfds);
+    FD_ZERO(&xfds);
+    nfds = pollfds_fill(gpollfds, &rfds, &wfds, &xfds);
+    if (nfds >= 0) {
+        select_ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0);
+        if (select_ret != 0) {
+            timeout = 0;
+        }
+        if (select_ret > 0) {
+            pollfds_poll(gpollfds, nfds, &rfds, &wfds, &xfds);
+        }
+    }
+
     g_main_context_prepare(context, &max_priority);
     n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout,
                                       poll_fds, ARRAY_SIZE(poll_fds));
@@ -426,24 +440,6 @@ static int os_host_main_loop_wait(uint32_t timeout)
         g_main_context_dispatch(context);
     }
 
-    /* Call select after g_poll to avoid a useless iteration and therefore
-     * improve socket latency.
-     */
-
-    FD_ZERO(&rfds);
-    FD_ZERO(&wfds);
-    FD_ZERO(&xfds);
-    nfds = pollfds_fill(gpollfds, &rfds, &wfds, &xfds);
-    if (nfds >= 0) {
-        select_ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0);
-        if (select_ret != 0) {
-            timeout = 0;
-        }
-        if (select_ret > 0) {
-            pollfds_poll(gpollfds, nfds, &rfds, &wfds, &xfds);
-        }
-    }
-
     return select_ret || g_poll_ret;
 }
 #endif
-- 
1.8.1.4

  parent reply	other threads:[~2013-05-16 15:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 15:35 [Qemu-devel] [PATCH for-1.5 0/2] main-loop: fix slirp on win32 Stefan Hajnoczi
2013-05-16 15:36 ` [Qemu-devel] [PATCH for-1.5 1/2] main-loop: narrow win32 pollfds_fill() event bitmasks Stefan Hajnoczi
2013-05-16 15:36 ` Stefan Hajnoczi [this message]
2013-05-16 16:54   ` [Qemu-devel] [PATCH for-1.5 2/2] main-loop: partial revert of 5e3bc73 Paolo Bonzini
2013-05-16 16:54 ` [Qemu-devel] [PATCH for-1.5 0/2] main-loop: fix slirp on win32 Paolo Bonzini
2013-05-17  1:25 ` TeLeMan
2013-05-17  8:01   ` Paolo Bonzini
2013-05-22 22:58 ` Anthony Liguori

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=1368718561-7816-3-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=geleman@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=therock247uk@247fixes.com \
    /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).