From patchwork Fri Jan 15 12:01:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 568050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0C60F140BF9 for ; Fri, 15 Jan 2016 23:05:31 +1100 (AEDT) Received: from localhost ([::1]:46475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK38C-0001JA-AX for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2016 07:05:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK34i-0003cG-B1 for qemu-devel@nongnu.org; Fri, 15 Jan 2016 07:02:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK34f-0003d7-4P for qemu-devel@nongnu.org; Fri, 15 Jan 2016 07:01:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK34e-0003d1-Sf for qemu-devel@nongnu.org; Fri, 15 Jan 2016 07:01:49 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 512743299; Fri, 15 Jan 2016 12:01:48 +0000 (UTC) Received: from work-vm (ovpn-116-88.ams2.redhat.com [10.36.116.88]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0FC1iBq004847 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 15 Jan 2016 07:01:46 -0500 Date: Fri, 15 Jan 2016 12:01:44 +0000 From: "Dr. David Alan Gilbert" To: Sascha Silbe Message-ID: <20160115120143.GB2432@work-vm> References: <1452083019-15141-1-git-send-email-dgilbert@redhat.com> <1452083019-15141-2-git-send-email-dgilbert@redhat.com> <871t9jhnfs.fsf@oc4731375738.ibm.com> <20160115092419.GA2432@work-vm> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160115092419.GA2432@work-vm> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: amit.shah@redhat.com, Cornelia Huck , mst@redhat.com, qemu-devel@nongnu.org, quintela@redhat.com Subject: Re: [Qemu-devel] [PATCH 2/2] migration/virtio: Remove simple .get/.put use X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi Sascha, Can you try this and let me know if it fixes it for you; I've still not managed to persuade x86-64 to fail. Dave From f300fa0dd902b28417744d364986c71dd8357a88 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Fri, 15 Jan 2016 11:02:02 +0000 Subject: [PATCH] Fix virito migration I misunderstood the vmstate macro definition when I reworked the virtio .get/.put - but I can't get it to break for me, which suggests I'm perhaps not managing to get that structure into being sent in my tests. Fixes as per Sascha's suggestions/debug. Signed-off-by: Dr. David Alan Gilbert Reported-by: Sascha Silbe Fixes: 50e5ae4dc3e4f21e874512f9e87b93b5472d26e0 Fixes: 2cf0148674430b6693c60d42b7eef721bfa9509f Tested-By: Sascha Silbe Reviewed-By: Sascha Silbe --- hw/virtio/virtio.c | 8 ++++---- include/migration/vmstate.h | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index bd6b4df..41a8a8a 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1143,8 +1143,8 @@ static const VMStateDescription vmstate_virtio_virtqueues = { .minimum_version_id = 1, .needed = &virtio_virtqueue_needed, .fields = (VMStateField[]) { - VMSTATE_STRUCT_VARRAY_KNOWN(vq, struct VirtIODevice, VIRTIO_QUEUE_MAX, - 0, vmstate_virtqueue, VirtQueue), + VMSTATE_STRUCT_VARRAY_POINTER_KNOWN(vq, struct VirtIODevice, + VIRTIO_QUEUE_MAX, 0, vmstate_virtqueue, VirtQueue), VMSTATE_END_OF_LIST() } }; @@ -1165,8 +1165,8 @@ static const VMStateDescription vmstate_virtio_ringsize = { .minimum_version_id = 1, .needed = &virtio_ringsize_needed, .fields = (VMStateField[]) { - VMSTATE_STRUCT_VARRAY_KNOWN(vq, struct VirtIODevice, VIRTIO_QUEUE_MAX, - 0, vmstate_ringsize, VirtQueue), + VMSTATE_STRUCT_VARRAY_POINTER_KNOWN(vq, struct VirtIODevice, + VIRTIO_QUEUE_MAX, 0, vmstate_ringsize, VirtQueue), VMSTATE_END_OF_LIST() } }; diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 97d44d3..4a5d1dd 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -374,19 +374,6 @@ extern const VMStateInfo vmstate_info_bitmap; .offset = vmstate_offset_array(_state, _field, _type, _num),\ } -/* a variable length array (i.e. _type *_field) but we know the - * length - */ -#define VMSTATE_STRUCT_VARRAY_KNOWN(_field, _state, _num, _version, _vmsd, _type) { \ - .name = (stringify(_field)), \ - .num = (_num), \ - .version_id = (_version), \ - .vmsd = &(_vmsd), \ - .size = sizeof(_type), \ - .flags = VMS_STRUCT|VMS_ARRAY, \ - .offset = offsetof(_state, _field), \ -} - #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \ .name = (stringify(_field)), \ .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \ @@ -397,6 +384,19 @@ extern const VMStateInfo vmstate_info_bitmap; .offset = offsetof(_state, _field), \ } +/* a variable length array (i.e. _type *_field) but we know the + * length + */ +#define VMSTATE_STRUCT_VARRAY_POINTER_KNOWN(_field, _state, _num, _version, _vmsd, _type) { \ + .name = (stringify(_field)), \ + .num = (_num), \ + .version_id = (_version), \ + .vmsd = &(_vmsd), \ + .size = sizeof(_type), \ + .flags = VMS_STRUCT|VMS_ARRAY|VMS_POINTER, \ + .offset = offsetof(_state, _field), \ +} + #define VMSTATE_STRUCT_VARRAY_POINTER_INT32(_field, _state, _field_num, _vmsd, _type) { \ .name = (stringify(_field)), \ .version_id = 0, \