On Thu, 10 Sep 2015 12:02:44 +0300 "Michael S. Tsirkin" <m...@redhat.com> wrote:
> On Fri, Sep 04, 2015 at 10:54:26AM +0200, Cornelia Huck wrote: > > We allow guests to change the size of the virtqueue rings by supplying > > a number of buffers that is different from the number of buffers the > > device was initialized with. Current code has some problems, however, > > since reset does not reset the ringsizes to the default values (as this > > is not saved anywhere). > > > > Let's extend the core code to keep track of the default ringsizes and > > migrate them once the guest changed them for any of the virtqueues > > for a device. > > > > Signed-off-by: Cornelia Huck <cornelia.h...@de.ibm.com> > > --- > > hw/virtio/virtio.c | 63 > > ++++++++++++++++++++++++++++++++++++++++++++++ > > include/hw/virtio/virtio.h | 1 + > > 2 files changed, 64 insertions(+) > > > > diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h > > index cccae89..29870c8 100644 > > --- a/include/hw/virtio/virtio.h > > +++ b/include/hw/virtio/virtio.h > > @@ -90,6 +90,7 @@ struct VirtIODevice > > VMChangeStateEntry *vmstate; > > char *bus_name; > > uint8_t device_endian; > > + bool non_default_ringsizes; > > > Let's not try to track this separately. Just go over > rings before migration, and check whether guest changed > anything. I dunno. If we try to figure this out while doing migration, we'll need to go over the rings and check whether any of them has changed, then go over the rings again to save the values - while here, we just set this bool once when the driver changes the value, check once to find out whether we need to migrate the values and reset once. > > > QLIST_HEAD(, VirtQueue) *vector_queues; > > }; > > > > -- > > 2.3.8 >