From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud1SI-0003bm-14 for qemu-devel@nongnu.org; Thu, 16 May 2013 12:55:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud1SF-0007Zb-Tm for qemu-devel@nongnu.org; Thu, 16 May 2013 12:55:01 -0400 Received: from mail-gg0-x22d.google.com ([2607:f8b0:4002:c02::22d]:44340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud1SF-0007ZT-Pg for qemu-devel@nongnu.org; Thu, 16 May 2013 12:54:59 -0400 Received: by mail-gg0-f173.google.com with SMTP id l4so571691ggn.32 for ; Thu, 16 May 2013 09:54:59 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51950F5A.5050209@redhat.com> Date: Thu, 16 May 2013 18:54:50 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1368718561-7816-1-git-send-email-stefanha@redhat.com> <1368718561-7816-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1368718561-7816-3-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-1.5 2/2] main-loop: partial revert of 5e3bc73 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: geleman@gmail.com, Anthony Liguori , therock247uk@247fixes.com, qemu-devel@nongnu.org Il 16/05/2013 17:36, Stefan Hajnoczi ha scritto: > 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 Signed-off-by: Paolo Bonzini > --- > 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 >