From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZzKa-0002VX-So for qemu-devel@nongnu.org; Thu, 10 Sep 2015 06:43:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZzKX-00019i-Mc for qemu-devel@nongnu.org; Thu, 10 Sep 2015 06:43:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZzKX-00019e-H5 for qemu-devel@nongnu.org; Thu, 10 Sep 2015 06:43:49 -0400 Date: Thu, 10 Sep 2015 13:43:46 +0300 From: "Michael S. Tsirkin" Message-ID: <20150910134252-mutt-send-email-mst@redhat.com> References: <1441356869-57861-1-git-send-email-cornelia.huck@de.ibm.com> <1441356869-57861-2-git-send-email-cornelia.huck@de.ibm.com> <20150910120130-mutt-send-email-mst@redhat.com> <20150910122254.090917f6.cornelia.huck@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150910122254.090917f6.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 1/4] virtio: ring sizes vs. reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: borntraeger@de.ibm.com, jasowang@redhat.com, qemu-devel@nongnu.org On Thu, Sep 10, 2015 at 12:22:54PM +0200, Cornelia Huck wrote: > On Thu, 10 Sep 2015 12:02:44 +0300 > "Michael S. Tsirkin" 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 > > > --- > > > 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. Then restore it on load ... State is worse than stateless, without a state you are never out of sync. > > > > > QLIST_HEAD(, VirtQueue) *vector_queues; > > > }; > > > > > > -- > > > 2.3.8 > >