From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvm0I-0001ea-Lw for qemu-devel@nongnu.org; Mon, 09 Nov 2015 07:57:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zvm0F-00040M-FX for qemu-devel@nongnu.org; Mon, 09 Nov 2015 07:56:58 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:34230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvm0F-00040D-69 for qemu-devel@nongnu.org; Mon, 09 Nov 2015 07:56:55 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Nov 2015 12:56:52 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6AFB61B08069 for ; Mon, 9 Nov 2015 12:57:06 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tA9CuoHg10092810 for ; Mon, 9 Nov 2015 12:56:50 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tA9Cuoxb032746 for ; Mon, 9 Nov 2015 05:56:50 -0700 Date: Mon, 9 Nov 2015 13:56:48 +0100 From: Cornelia Huck Message-ID: <20151109135648.061eaaeb.cornelia.huck@de.ibm.com> In-Reply-To: <1446796969-8049-2-git-send-email-jasowang@redhat.com> References: <1446796969-8049-1-git-send-email-jasowang@redhat.com> <1446796969-8049-2-git-send-email-jasowang@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V3 1/6] virtio-pci: fix 1.0 virtqueue migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: qemu-devel@nongnu.org, mst@redhat.com On Fri, 6 Nov 2015 16:02:44 +0800 Jason Wang wrote: > We don't migrate the followings fields for virtio-pci: > > uint32_t dfselect; > uint32_t gfselect; > uint32_t guest_features[2]; > struct { > uint16_t num; > bool enabled; > uint32_t desc[2]; > uint32_t avail[2]; > uint32_t used[2]; > } vqs[VIRTIO_QUEUE_MAX]; > > This will confuse driver if migrating during initialization. Solves > this issue by: > > - introduce transport specific callbacks to load and store extra > virtqueue states. > - add a new subsection for virtio to migrate transport specific modern > device state. > - implement pci specific callbacks. > - add a new property for virtio-pci for whether or not to migrate > extra state. > - compat the migration for 2.4 and elder machine types > > Cc: Michael S. Tsirkin > Signed-off-by: Jason Wang > --- > hw/virtio/virtio-pci.c | 129 +++++++++++++++++++++++++++++++++++++++++ > hw/virtio/virtio-pci.h | 20 ++++--- > hw/virtio/virtio.c | 58 ++++++++++++++++++ > include/hw/compat.h | 4 ++ > include/hw/virtio/virtio-bus.h | 3 + > 5 files changed, 207 insertions(+), 7 deletions(-) > @@ -133,6 +256,7 @@ static int virtio_pci_load_queue(DeviceState *d, int n, QEMUFile *f) > if (vector != VIRTIO_NO_VECTOR) { > return msix_vector_use(&proxy->pci_dev, vector); > } > + whitespace change :) > return 0; > } > (...) > +static void put_extra_state(QEMUFile *f, void *pv, size_t size) > +{ > + VirtIODevice *vdev = pv; > + BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); > + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); > + I'd probably put an 'assert(k->save_extra_state)' here. (I think we have discussed this before, but I can't recall the outcome.) > + k->save_extra_state(qbus->parent, f); > +} Otherwise, this looks good to me. With or with out the assert, Reviewed-by: Cornelia Huck