Received: from eggs.gnu.org ([2001:4830:134:3::10]:34831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5yWJ-0005Oj-4N for qemu-devel@nongnu.org; Thu, 26 May 2016 12:52:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5yWD-0008N8-86 for qemu-devel@nongnu.org; Thu, 26 May 2016 12:52:26 -0400 References: <1464112509-21806-1-git-send-email-duanj@linux.vnet.ibm.com> <1464112509-21806-5-git-send-email-duanj@linux.vnet.ibm.com> <5745D4E7.2000003@linux.vnet.ibm.com> <1171824705.17235966.1464198715349.JavaMail.zimbra@redhat.com> <5745EF5D.8050705@linux.vnet.ibm.com> <275886818.17251052.1464204154028.JavaMail.zimbra@redhat.com> <57460856.4070505@linux.vnet.ibm.com> <48adc175-46bb-28f8-e52b-e5427bb60afd@redhat.com> <574727B7.6070505@linux.vnet.ibm.com> From: Paolo Bonzini Message-ID: <020e24ca-a553-717f-5f32-75dd23b367b7@redhat.com> Date: Thu, 26 May 2016 18:52:14 +0200 MIME-Version: 1.0 In-Reply-To: <574727B7.6070505@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [QEMU RFC PATCH v2 4/6] Migration: migrate QTAILQ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jianjun Duan Cc: quintela@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, amit shah , david@gibson.dropbear.id.au On 26/05/2016 18:43, Jianjun Duan wrote: >>> The user may only care the position of head and entry. But to >>> implement QTAILQ_RAW_***, we need more offset information than that. >>> If we don't query the offsets using something like offset() and store >>> it in a metadata, we have to make the assumption that all the pointer >>> types have the same size. >> >> We make this assumption elsewhere anyway. _You_ are making it by doing >> loads and stores through void** in QTAILQ_RAW_*. > > I thought every data pointer can be converted to and from void type of > pointer. Anyway we can make that assumption here. Yes, you can do that. > How about alignment? Is it OK to assume pointers are always aligned at > 4byte for 32 bit and 8byte for 64 bit? If yes then we can just add the > size of a void pointer to first to get last in QTAILQ head. We will get > something like: > first=0 > last = sizeof(void *) > next=0 > prev=sizeof(void *) Yes, that's my point. These four are constants. Thanks, Paolo