From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYcQ6-0003Mo-V6 for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:13:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYcQ4-00048l-SE for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:13:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYcQ4-00048X-Dd for qemu-devel@nongnu.org; Mon, 20 Jun 2011 07:13:28 -0400 Date: Mon, 20 Jun 2011 14:13:32 +0300 From: "Michael S. Tsirkin" Message-ID: <20110620111332.GA24344@redhat.com> References: <4DF9BD9C.1060307@cn.fujitsu.com> <4DF9DD77.5040401@redhat.com> <20110616124651.GD14583@redhat.com> <4DFAAF00.900@cn.fujitsu.com> <4DFF0E9D.90409@redhat.com> <4DFF1596.8020902@cn.fujitsu.com> <4DFF1854.3070003@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DFF1854.3070003@redhat.com> Subject: Re: [Qemu-devel] [PATCH] do not send packet to nic if the packet will be dropped by nic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Aurelien Jarno , qemu-devel On Mon, Jun 20, 2011 at 11:52:20AM +0200, Kevin Wolf wrote: > Am 20.06.2011 11:40, schrieb Wen Congyang: > > At 06/20/2011 05:10 PM, Kevin Wolf Write: > >> Am 17.06.2011 03:33, schrieb Wen Congyang: > >>> If !s->clock_enabled or !rtl8139_receiver_enabled(s), it means that > >>> the nic will drop all packets from host. So qemu will keep getting > >>> packets from host and wasting CPU on dropping packets. This seems > >>> worse than packets that should be dropped but aren't. > >>> > >>> Signed-off-by: Wen Congyang > >> > >> Which bug does this change fix? I'm still not convinced that we should > >> do it. > > > > Maybe not a bug fix now. As Michael S. Tsirkin said, if rtl8139_can_receive() > > returns 1, qemu will keep getting packets from host and wasting CPU on > > dropping packets. We can save CPU by return 0. > > Don't we waste memory instead then because we leave the packets queued > indefinitely? > > Kevin Yes but the amount of wasted memory is bound from above so this doesn't seem too bad to me ... -- MST