Received: from eggs.gnu.org ([2001:4830:134:3::10]:55890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2FyH-00030q-FG for qemu-devel@nongnu.org; Thu, 03 Nov 2016 07:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2FyC-0005i4-Hi for qemu-devel@nongnu.org; Thu, 03 Nov 2016 07:14:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58537 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c2FyC-0005hT-Bl for qemu-devel@nongnu.org; Thu, 03 Nov 2016 07:14:08 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA3B8Z1F089915 for ; Thu, 3 Nov 2016 07:14:07 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 26fwjg36mt-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Nov 2016 07:14:07 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Nov 2016 11:14:05 -0000 References: <1477943636-21024-1-git-send-email-duanj@linux.vnet.ibm.com> <1477943636-21024-3-git-send-email-duanj@linux.vnet.ibm.com> <87k2cm88j0.fsf@emacs.mitica> <64de4199-2588-fc76-a09d-132045a29ed0@redhat.com> From: Halil Pasic Date: Thu, 3 Nov 2016 12:14:01 +0100 MIME-Version: 1.0 In-Reply-To: <64de4199-2588-fc76-a09d-132045a29ed0@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <1240d14a-5e7a-ed37-4859-c70032f25e0a@linux.vnet.ibm.com> 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: Paolo Bonzini , quintela@redhat.com, Jianjun Duan Cc: veroniabahaa@gmail.com, peter.maydell@linaro.org, dgilbert@redhat.com, mdroth@linux.vnet.ibm.com, mst@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, mreitz@redhat.com, blauwirbel@gmail.com, amit.shah@redhat.com, qemu-ppc@nongnu.org, kraxel@redhat.com, dmitry@daynix.com, kwolf@redhat.com, rth@twiddle.net, leon.alrae@imgtec.com, aurelien@aurel32.net, david@gibson.dropbear.id.au On 11/02/2016 05:38 PM, Paolo Bonzini wrote: > > > On 02/11/2016 11:45, Juan Quintela wrote: >>>> + 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. > > One thing at a time? The allocation and "looping" are different > mechanisms. We can customize the allocation later. > > Paolo > +1 And while at it how about s/g_malloc/gmalloc0? This would possibly make something like mismatch in .start between source and target easier to detect, along with the 'untouched' fields mentioned by Jianjun. (Although I'm not sure how untouched fields and the virtio list use is connected. In my understanding the problem pointed out by Juan has something to do with the address of a element/node having significance beyond the list.) Halil