From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuJz3-0006bd-2Y for qemu-devel@nongnu.org; Fri, 28 Nov 2014 06:45:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XuJyz-0004LW-20 for qemu-devel@nongnu.org; Fri, 28 Nov 2014 06:45:09 -0500 Received: from ozlabs.org ([103.22.144.67]:42181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuJyy-0004El-OD for qemu-devel@nongnu.org; Fri, 28 Nov 2014 06:45:05 -0500 Date: Fri, 28 Nov 2014 22:30:40 +1100 From: David Gibson Message-ID: <20141128113040.GB17176@voom.fritz.box> References: <1417067290-20715-1-git-send-email-david@gibson.dropbear.id.au> <87y4qxj8o5.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FsscpQKzF/jJk6ya" Content-Disposition: inline In-Reply-To: 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: Peter Maydell Cc: Juan Quintela , Markus Armbruster , Rusty Russell , QEMU Developers , Alexander Graf , "Michael S. Tsirkin" , Paolo Bonzini --FsscpQKzF/jJk6ya Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 28, 2014 at 09:14:46AM +0000, Peter Maydell wrote: > On 27 November 2014 at 09:26, Markus Armbruster wrote: > > David Gibson writes: > > > >> VirtIO devices now remember which endianness they're operating in in o= rder > >> 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. > >> > >> 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 dev= ice. > >> The actual guest state isn't particularly important to triggering this. > >> > >> The cause is that virtio_rng_load_device() calls virtio_rng_process() = which > >> 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 sho= uld > >> only be used for actually reading the device state from the stream, no= t for > >> post-load re-initialization. > >> > >> This patch fixes the bug by moving the virtio_rng_process() after the = call > >> to virtio_load(). Better yet would be to convert virtio to use vmsd a= nd > >> have the virtio_rng_process() as a post_load callback, but that's a bi= gger > >> project for another day. > >> > >> This is bugfix, and should be considered for the 2.2 branch. > > > > "[PATCH for-2.2]" would have been a good idea then. Next time :) >=20 > So do you want this patch in 2.2? I was planning to put in the > virtio-vs-xen fixes today and tag rc4, so it's not too late if you're > confident this patch is good. Let me know if you think it should go in, > and I can apply it to master directly. Yes, I think it should be applied. --=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 --FsscpQKzF/jJk6ya Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUeFzgAAoJEGw4ysog2bOSFW4P/2FSuEl2+aIrnw68cjEjwlV6 zdfg2gBg+hipqdtXXdMXRvQXc/UXL0fu3m1RVl9YaO6I3IBIJqoEeLwtkKY2SZ6W OL/QJpdeCGxTFn/cNOIk8bK4tT6N8Qw9uP07bqq3WMjkqsj4UAW9zvQlrOyo3DO8 g69RE6/nuicHq2XVKtTUqKUn+9dlGYA2C4ADupn4T1RLNgbnWoTdzKXdN9JCWjI6 ckQyF8/Tb7hEHE0LqWmPy4eCwav1VjtjB0e6HyWZMHbVZ23FoypAqDcG31uzHy4P fa3KaKLVuW/DOowAy36FDX8HThaJ6v/dy0vs+ZfO1Ev1Hi9gUQhBrpUF3JRrwJV1 0L7XXc8gXyRA8AdsZPeEWdku5VPK2gx/j1TMZSSeEk35YAwIkEdgmCyLz0wkqgDo gwyCOM0sD59XgTHz0v19I6j96DoDjBQ28uTafzTUKi+kkc1eclA3F6oItE+gkEn4 xX/GUFE9ha7pWJx13uk2m646qOubNRWLFmUOh4M2ZJLpEPvTZ9ko2kVWldgmz+Yw uW8pbywd56hS6d6IPPetc/ab2/P72azTScFRUMuQUU8rioILNh4X6HrV1dHGGQE3 feMdU8c64D+8t17hdM/YR4M6wcumfnBZ5E0O5LCClV/PWrzWFfbq/peHLPEHHbRI gs4zMLXnJm0PWq+jw6Se =ddK7 -----END PGP SIGNATURE----- --FsscpQKzF/jJk6ya--