From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FaXNl-0005NX-Re for qemu-devel@nongnu.org; Mon, 01 May 2006 08:20:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FaXNj-0005MX-Qr for qemu-devel@nongnu.org; Mon, 01 May 2006 08:20:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FaXNj-0005MT-MZ for qemu-devel@nongnu.org; Mon, 01 May 2006 08:20:03 -0400 Received: from [84.96.92.55] (helo=smtP.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FaXRX-00060N-Qw for qemu-devel@nongnu.org; Mon, 01 May 2006 08:24:00 -0400 Received: from [84.102.211.147] by sp604004mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0IYL00DU5694TFR0@sp604004mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Mon, 01 May 2006 14:19:52 +0200 (CEST) Date: Mon, 01 May 2006 14:19:09 +0200 From: Fabrice Bellard Subject: Re: [Qemu-devel] [PATCH] Improve -net user (slirp) performance by 4x In-reply-to: Message-id: <4455FCBD.8030209@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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) {