From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOk3S-0001VR-Dn for qemu-devel@nongnu.org; Tue, 02 Sep 2014 05:07:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOk3O-0001Pl-AK for qemu-devel@nongnu.org; Tue, 02 Sep 2014 05:07:10 -0400 Date: Tue, 2 Sep 2014 12:06:46 +0300 From: "Michael S. Tsirkin" Message-ID: <20140902090646.GA10666@redhat.com> References: <1409040377-12088-1-git-send-email-zhang.zhanghailiang@huawei.com> <20140901184018.GA27759@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140901184018.GA27759@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH V4] net: Forbid dealing with packets when VM is not running List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: zhanghailiang , jasowang@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, qemu-devel@nongnu.org, stefanha@redhat.com, qemu-stable@nongnu.org, aliguori@amazon.com On Mon, Sep 01, 2014 at 07:40:18PM +0100, Stefan Hajnoczi wrote: > On Tue, Aug 26, 2014 at 04:06:17PM +0800, zhanghailiang wrote: > > For all NICs(except virtio-net) emulated by qemu, > > Such as e1000, rtl8139, pcnet and ne2k_pci, > > Qemu can still receive packets when VM is not running. > > > > If this happened in *migration's* last PAUSE VM stage, but > > before the end of the migration, the new receiving packets will possibly dirty > > parts of RAM which has been cached in *iovec*(will be sent asynchronously) and > > dirty parts of new RAM which will be missed. > > This will lead serious network fault in VM. > > > > To avoid this, we forbid receiving packets in generic net code when > > VM is not running. > > > > Bug reproduction steps: > > (1) Start a VM which configured at least one NIC > > (2) In VM, open several Terminal and do *Ping IP -i 0.1* > > (3) Migrate the VM repeatedly between two Hosts > > And the *PING* command in VM will very likely fail with message: > > 'Destination HOST Unreachable', the NIC in VM will stay unavailable unless you > > run 'service network restart' > > > > Signed-off-by: zhanghailiang > > --- > > v4: > > - The action of flush queued packets is unnecessary, remove this. > > (Thanks for the help of Jason Wang and Stefan). > > > > v3: > > - change the 'vmstate' to 'vm_running' > > > > v2: > > - remove the superfluous check of nc->received_disabled > > --- > > > > net/net.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > Thanks, applied to my net tree: > https://github.com/stefanha/qemu/commits/net > > Stefan Also please Cc: qemu-stable@nongnu.org