From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1t3C-00066y-A1 for qemu-devel@nongnu.org; Wed, 02 Nov 2016 06:45:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1t38-0001KE-Cm for qemu-devel@nongnu.org; Wed, 02 Nov 2016 06:45:46 -0400 From: Juan Quintela In-Reply-To: <1477943636-21024-3-git-send-email-duanj@linux.vnet.ibm.com> (Jianjun Duan's message of "Mon, 31 Oct 2016 12:53:55 -0700") References: <1477943636-21024-1-git-send-email-duanj@linux.vnet.ibm.com> <1477943636-21024-3-git-send-email-duanj@linux.vnet.ibm.com> Reply-To: quintela@redhat.com Date: Wed, 02 Nov 2016 11:45:39 +0100 Message-ID: <87k2cm88j0.fsf@emacs.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [QEMU PATCH v10 2/3] migration: migrate QTAILQ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jianjun Duan Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, dmitry@daynix.com, peter.maydell@linaro.org, kraxel@redhat.com, mst@redhat.com, david@gibson.dropbear.id.au, pbonzini@redhat.com, veroniabahaa@gmail.com, amit.shah@redhat.com, mreitz@redhat.com, kwolf@redhat.com, rth@twiddle.net, aurelien@aurel32.net, leon.alrae@imgtec.com, blauwirbel@gmail.com, mark.cave-ayland@ilande.co.uk, mdroth@linux.vnet.ibm.com, dgilbert@redhat.com Jianjun Duan wrote: > Currently we cannot directly transfer a QTAILQ instance because of the > limitation in the migration code. Here we introduce an approach to > transfer such structures. We created VMStateInfo vmstate_info_qtailq > for QTAILQ. Similar VMStateInfo can be created for other data structures > such as list. > > This approach will be used to transfer pending_events and ccs_list in spapr > state. > > We also create some macros in qemu/queue.h to access a QTAILQ using pointer > arithmetic. This ensures that we do not depend on the implementation > details about QTAILQ in the migration code. > > Signed-off-by: Jianjun Duan > + > + trace_get_qtailq(vmsd->name, version_id); > + if (version_id > vmsd->version_id) { > + error_report("%s %s", vmsd->name, "too new"); > + trace_get_qtailq_end(vmsd->name, "too new", -EINVAL); > + > + return -EINVAL; > + } > + if (version_id < vmsd->minimum_version_id) { > + error_report("%s %s", vmsd->name, "too old"); > + trace_get_qtailq_end(vmsd->name, "too old", -EINVAL); > + return -EINVAL; > + } > + > + while (qemu_get_byte(f)) { > + elm = g_malloc(size); I think this is not generic enough. We really need to allocate a new element, and then fill it with default values. virtio list code use it in this way. Thanks, Juan.