From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuANC-00063u-Jb for qemu-devel@nongnu.org; Thu, 27 Nov 2014 20:29:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XuAN7-0004Wf-KP for qemu-devel@nongnu.org; Thu, 27 Nov 2014 20:29:26 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:33142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuAN7-0004WO-9u for qemu-devel@nongnu.org; Thu, 27 Nov 2014 20:29:21 -0500 Date: Fri, 28 Nov 2014 11:50:51 +1100 From: David Gibson Message-ID: <20141128005051.GO11025@voom.redhat.com> References: <1417067290-20715-1-git-send-email-david@gibson.dropbear.id.au> <20141127090842.GA3899@grmbl.mre> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Zvl510+jvRFHh8wJ" Content-Disposition: inline In-Reply-To: <20141127090842.GA3899@grmbl.mre> Subject: Re: [Qemu-devel] [PATCH] Fix for crash after migration in virtio-rng on bi-endian targets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: mst@redhat.com, rusty@rustcorp.com.au, agraf@suse.de, qemu-devel@nongnu.org, quintela@redhat.com, pbonzini@redhat.com --Zvl510+jvRFHh8wJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 27, 2014 at 02:38:42PM +0530, Amit Shah wrote: > On (Thu) 27 Nov 2014 [16:48:10], David Gibson wrote: > > VirtIO devices now remember which endianness they're operating in in or= der > > to support targets which may have guests of either endianness, such as > > powerpc. This endianness state is transferred in a subsection of the > > virtio device's information. > >=20 > > With virtio-rng this can lead to an abort after a loadvm hitting the > > assert() in virtio_is_big_endian(). This can be reproduced by doing a > > migrate and load from file on a bi-endian target with a virtio-rng devi= ce. > > The actual guest state isn't particularly important to triggering this. > >=20 > > The cause is that virtio_rng_load_device() calls virtio_rng_process() w= hich > > accesses the ring and thus needs the endianness. However, > > virtio_rng_process() is called via virtio_load() before it loads the > > subsections. Essentially the ->load callback in VirtioDeviceClass shou= ld > > only be used for actually reading the device state from the stream, not= for > > post-load re-initialization. >=20 > Agreed. >=20 > > This patch fixes the bug by moving the virtio_rng_process() after the c= all > > to virtio_load(). Better yet would be to convert virtio to use vmsd and > > have the virtio_rng_process() as a post_load callback, but that's a big= ger > > project for another day. > >=20 > > This is bugfix, and should be considered for the 2.2 branch. >=20 > This is undoing most of 3902d49e13c2428bd6381cfdf183103ca4477c1f , > added Greg to CC list. >=20 > Did you try this on x86 guests, or with multiple rng devices? Not so far, I'll see what I can do. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --Zvl510+jvRFHh8wJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUd8brAAoJEGw4ysog2bOS2M8P/jgNj77dLCP3+gfTh72JmG65 utzLQPqqWSxXMXgtuN9g7wFl6njYYI+WVOMMvmCv7+bGk4M6OdEwHWUXqHdeKYdH G2a+qGlejTv63PWnEj1Y8sgCP0H+vLIUl0l9xamwCjNxh+Cm0Gh+UvVuHNtNOya9 4IDJvAiGUNSTXB6y2M/et+IpBRu5ExrBa0zSzUyBITdHrRlABf7qewsDlrrSKLrk 03vSgyinC8LowDY82FbSw2Mr3Px9cD+quLr9dAHSS8+XWGYj5CVZXj01V6majgVv JwYk1CIiJBkjgdgERmQxSsVXvWiteFKdCoGlvh40fGQUKCwnLFfbsZ/bOjRQbQJ/ J7eMlFuCv2d3khFmD2KTWpjp/j4g8rWeuZ74EU47g2R+/q68ZZT69BQCnWq2/mgi ytb+HBD5ByAwJFS1wFU/p2taU8E9GSknZ4glZ8uuzSvKHygVxYhoyj8318qR95vS yc9d6kj/yOhnrLpsArsxbZQ7PIlGuIEAnmgQspZFpqCw0zMU0FdwHzFdEfC/THJu m+XBns0Z47VNZvYyHe1D07Oh1LZ4d5d+1Lgn3Ot8b77833ZXRdrgeOX7NDounjQw XNViwAm8uxREXHbtjYxxivtoPp3BPxDNuZBH1OXYvKCrbF7zjAViDbbiyrXW5xVp jjTLdL7cDVYUHpB2XgFl =eeA2 -----END PGP SIGNATURE----- --Zvl510+jvRFHh8wJ--