From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvymT-0008ON-3r for qemu-devel@nongnu.org; Mon, 09 Nov 2015 21:35:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvymP-0007DN-Qk for qemu-devel@nongnu.org; Mon, 09 Nov 2015 21:35:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvymP-0007CF-Kp for qemu-devel@nongnu.org; Mon, 09 Nov 2015 21:35:29 -0500 References: <1446796969-8049-1-git-send-email-jasowang@redhat.com> <1446796969-8049-2-git-send-email-jasowang@redhat.com> <20151109135648.061eaaeb.cornelia.huck@de.ibm.com> From: Jason Wang Message-ID: <564157EB.9000104@redhat.com> Date: Tue, 10 Nov 2015 10:35:23 +0800 MIME-Version: 1.0 In-Reply-To: <20151109135648.061eaaeb.cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=windows-1252 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: Cornelia Huck Cc: qemu-devel@nongnu.org, mst@redhat.com On 11/09/2015 08:56 PM, Cornelia Huck wrote: > 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 :) Right, I will wait for other comments to see if v4 is needed (and fix there). >> 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.) Yes, may help to hunt bugs earlier. > >> + k->save_extra_state(qbus->parent, f); >> +} > Otherwise, this looks good to me. With or with out the assert, > > Reviewed-by: Cornelia Huck > >