Received: from eggs.gnu.org ([2001:4830:134:3::10]:58544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtvLp-00040m-PR for qemu-devel@nongnu.org; Thu, 27 Nov 2014 04:27:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XtvLl-0000Lp-DO for qemu-devel@nongnu.org; Thu, 27 Nov 2014 04:27:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtvLl-0000Lj-5c for qemu-devel@nongnu.org; Thu, 27 Nov 2014 04:26:57 -0500 From: Markus Armbruster References: <1417067290-20715-1-git-send-email-david@gibson.dropbear.id.au> Date: Thu, 27 Nov 2014 10:26:50 +0100 In-Reply-To: <1417067290-20715-1-git-send-email-david@gibson.dropbear.id.au> (David Gibson's message of "Thu, 27 Nov 2014 16:48:10 +1100") Message-ID: <87y4qxj8o5.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: David Gibson Cc: mst@redhat.com, rusty@rustcorp.com.au, agraf@suse.de, qemu-devel@nongnu.org, quintela@redhat.com, pbonzini@redhat.com David Gibson writes: > VirtIO devices now remember which endianness they're operating in in order > 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 device. > 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 should > only be used for actually reading the device state from the stream, not 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 and > have the virtio_rng_process() as a post_load callback, but that's a bigger > 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 :)