On (Fri) 28 Nov 2014 [11:50:51], David Gibson wrote: > 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 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. > > > > Agreed. > > > > > 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. > > > > This is undoing most of 3902d49e13c2428bd6381cfdf183103ca4477c1f , > > added Greg to CC list. > > > > Did you try this on x86 guests, or with multiple rng devices? > > Not so far, I'll see what I can do.
Thanks. Amit