From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wheuj-000749-Io for qemu-devel@nongnu.org; Tue, 06 May 2014 08:56:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wheue-0002hH-LH for qemu-devel@nongnu.org; Tue, 06 May 2014 08:56:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wheue-0002hB-CX for qemu-devel@nongnu.org; Tue, 06 May 2014 08:56:00 -0400 Date: Tue, 6 May 2014 14:55:50 +0200 From: Stefan Hajnoczi Message-ID: <20140506125550.GK15810@stefanha-thinkpad.redhat.com> References: <1398507552-50168-1-git-send-email-zhang.zhanghailiang@huawei.com> <20140426104415.GB2389@amosk.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] e1000/rtl8139: forbid dealing with packets when VM is paused List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhanghailiang Cc: Zhouxiangjiu , Peter Maydell , Peter Crosthwaite , Juan Quintela , "Michael S. Tsirkin" , QEMU Developers , "Huangpeng (Peter)" , Alex Williamson , Amos Kong , Dave Gilbert On Mon, Apr 28, 2014 at 03:22:34AM +0000, Zhanghailiang wrote: > > On Sat, Apr 26, 2014 at 9:04 PM, Peter Maydell > > wrote: > > > On 26 April 2014 11:44, Amos Kong wrote: > > >> > > >> I'm ok with the patch idea. > > >> > > >> On Sat, Apr 26, 2014 at 06:19:12PM +0800, zhanghailiang wrote: > > >>> For e1000/rtl8139, qemu can still send/receive packets when VM is > > paused. > > >> > > ^^^^^^^^^ > > >> -> > > isn't > > >> running > > >> > > >> There are many kinds of RunState, "is paused" doesn't equal to "isn't > > running". > > >> > > >>> If this happened in *migration's* last PAUSE VM stage, the new dirty RAM > > related to the packets will be missed. > > >>> To avoid this, do things like virtio-net, forbid sending/receiving > > >>> packets when VM is suspend. > > >> ^^^^^^^^^^^ -> isn't running. > > > > > > Shouldn't this be handled in the generic net code rather than > > > requiring every ethernet device model to include identical code? > > > > > > > +1. > > > > > thanks > > > -- PMM > > > > Hi, > Thanks for replying. > It is a good idea to handle the VM runstate check in generic net code. > Before send such a patch, I will look into other network cards emulated by qemu, and test if they have the same problem. Yes, please! virtio-net has a partial solution, it listens for VM runstate changes. But it's a bit buggy because it does not flush the peer's queue when runstate changes back to running. If you implement this in the net layer then that problem is easy to resolve since we can flush all queues when the guest resumes to get packets flowing again. Stefan