Received: from eggs.gnu.org ([2001:4830:134:3::10]:34100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKZGc-0005rH-R2 for qemu-devel@nongnu.org; Mon, 03 Mar 2014 15:15:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKZGW-0006oQ-Pa for qemu-devel@nongnu.org; Mon, 03 Mar 2014 15:15:14 -0500 Received: from mail-qc0-f174.google.com ([209.85.216.174]:50326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKZGW-0006nw-KP for qemu-devel@nongnu.org; Mon, 03 Mar 2014 15:15:08 -0500 Received: by mail-qc0-f174.google.com with SMTP id x13so4287881qcv.19 for ; Mon, 03 Mar 2014 12:15:08 -0800 (PST) From: Neil Skrypuch Date: Mon, 03 Mar 2014 15:15:06 -0500 Message-ID: <7893766.JXH9hN5hSm@skrypuch> In-Reply-To: <4A3C1273-355A-4E07-AC93-369B3B5F642F@icloud.com> References: <1729828.TVLplOUlZS@skrypuch> <4166424.tA9d5zbRN6@skrypuch> <4A3C1273-355A-4E07-AC93-369B3B5F642F@icloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="GB2312" Subject: Re: [Qemu-devel] Live migration results in non-working virtio-net device (sometimes) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?B?6ZmI5qKB?= Cc: qemu-devel@nongnu.org On Saturday 01 March 2014 10:34:03 =B3=C2=C1=BA wrote: > > On Thursday 30 January 2014 13:23:04 Neil Skrypuch wrote: > >> First, let me briefly outline the way we use live migration, as it= is > >> probably not typical. We use live migration (with block migration)= to > >> make > >> backups of VMs with zero downtime. The basic process goes like thi= s: > >>=20 > >> 1) migrate src VM -> dest VM > >> 2) migration completes > >> 3) cont src VM > >> 4) gracefully shut down dest VM > >> 5) dest VM's disk image is now a valid backup > >>=20 > >> In general, this works very well. > >>=20 > >> Up until now we have been using qemu-kvm 1.1.2 and have not had an= y > >> issues > >> with the above process. I am now attempting to upgrade us to a new= er > >> version of qemu, but all newer versions I've tried occasionally re= sult > >> in the virtio- net device ceasing to function on the src VM after = step > >> 3. > >>=20 > >> I am able to reproduce this reliably (given enough iterations), it= > >> happens > >> in roughly 2% of all migrations. > >>=20 > >> Here is the complete qemu command line for the src VM: > >>=20 > >> /usr/bin/qemu-system-x86_64 -machine accel=3Dkvm -drive > >> file=3D/var/lib/kvm/testbackup.polldev.com.img,if=3Dvirtio -m 2048= -smp > >> 4,cores=3D4,sockets=3D1,threads=3D1 -net > >> nic,macaddr=3D52:54:98:00:00:00,model=3Dvirtio -net > >> tap,script=3D/etc/qemu-ifup- > >> br2,downscript=3Dno -curses -name > >> "testbackup.polldev.com",process=3Dtestbackup.polldev.com -monitor= > >> unix:/var/lib/kvm/monitor/testbackup,server,nowait > >>=20 > >> The dest VM: > >>=20 > >> /usr/bin/qemu-system-x86_64 -machine accel=3Dkvm -drive > >> file=3D/backup/testbackup.polldev.com.img.bak20140129,if=3Dvirtio = -m 2048 > >> -smp > >> 4,cores=3D4,sockets=3D1,threads=3D1 -net > >> nic,macaddr=3D52:54:98:00:00:00,model=3Dvirtio -net > >> tap,script=3Dno,downscript=3Dno > >> - curses -name "testbackup.polldev.com",process=3Dtestbackup.polld= ev.com > >> -monitor unix:/var/lib/kvm/monitor/testbackup.bak,server,nowait -i= ncoming > >> tcp:0:4444 > >>=20 > >> The migration is performed like so: > >>=20 > >> echo "migrate -b tcp:localhost:4444" | socat STDIO UNIX- > >> CONNECT:/var/lib/kvm/monitor/testbackup > >> echo "migrate_set_speed 1G" | socat STDIO UNIX- > >> CONNECT:/var/lib/kvm/monitor/testbackup > >> #wait > >> echo cont | socat STDIO UNIX-CONNECT:/var/lib/kvm/monitor/testback= up > >>=20 > >> The guest in question is a minimal install of CentOS 6.5. > >>=20 > >> I have observed this issue across the following qemu versions: > >>=20 > >> qemu 1.4.2 > >> qemu 1.6.0 > >> qemu 1.6.1 > >> qemu 1.7.0 > >>=20 > >> I also attempted to test qemu 1.5.3, but live migration flat out c= rashed > >> there (totally different issue). > >>=20 > >> I have also tested a number of other scenarios with qemu 1.6.0, al= l of > >> which exhibit the same failure mode: > >>=20 > >> qemu 1.6.0 + host kernel 3.1.0 > >> qemu 1.6.0 + host kernel 3.10.7 > >> qemu 1.6.0 + host kernel 3.10.17 > >> qemu 1.6.0 + virtio with -netdev/-device syntax > >> qemu 1.6.0 + accel=3Dtcg > >>=20 > >> The one case I have found that works properly is the following: > >>=20 > >> qemu 1.6.0 + e1000 > >>=20 > >> It is worth noting that when the virtio-net device ceases to funct= ion in > >> the guest that removing and reinserting the virtio-net kernel modu= le > >> results in the device working again (except in 1.4.2, this had no = effect > >> there). > >>=20 > >> As mentioned above I can reproduce this with minimal effort, and a= m > >> willing > >> to test out any patches or provide further details as necessary. > >>=20 > >> - Neil > >=20 > > Ok, I was able to narrow this down to somewhere in between 1.2.2 (o= r > > rather, 1.2.0) and 1.3.0. Migration in 1.3.0 is broken, however, I = was > > able to cherry pick d7cd369, d5f1f28, and 9ee0cb2 on top of 1.3.0 t= o fix > > the unrelated migration bug and confirm that the bug from this thre= ad is > > still present in 1.3.0. > >=20 > > I started a git bisect on 1.2.2..1.3.0 but didn't get very far befo= re > > running into several unrelated bugs which kept migration from worki= ng. > >=20 > > I also tested out the latest master code (d844a7b) and it fails in = the > > same > > way as 1.7.0. > >=20 > > - Neil >=20 > hi=A3=AChave you try to ping from vm to other host after migration? Yes, pings from the VM to anywhere result in "Destination Host Unreacha= ble",=20 it's not the usual MAC address moved problem with migration. Note that = the=20 problem occurs on the *source* VM, not the destination VM, the destinat= ion VM=20 is intentionally configured with an unconnected network interface (scri= pt=3Dno). Also, I had a closer look at the source VM's state after the network st= ops=20 working. If I initiate a ping from inside the VM, via tcpdump I can see= ARP=20 traffic on the host's corresponding tap and bridge adaptors (both the r= equest=20 and response), however, tcpdump from inside the guest does not see eith= er of=20 these. I can see the TX count on eth0 inside the guest is increasing, but the = RX=20 count is not moving. On the host, I can see the RX count on the tap is=20= increasing, but the TX is not. Similarly, the dropped count on the tap = is=20 rising rapidly: tap0 Link encap:Ethernet HWaddr fe:19:99:0a:9b:07 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:452 errors:0 dropped:0 overruns:0 frame:0 TX packets:62626 errors:0 dropped:954919 overruns:0 carrier:0= collisions:0 txqueuelen:500 RX bytes:29104 (28.4 KiB) TX bytes:8726592 (8.3 MiB) If I try to ping the guest from an external host, I can see the ICMP re= quest=20 reach the tap adaptor on the host, but never a response and nothing in = the=20 guest. It seems like the TX side is working properly. Is it possible that the = RX side=20 of the virtio-net adaptor is in a confused state and thus resulting in = dropped=20 packets? - Neil