From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: Re: [PATCH] pc: e820 qemu_cfg tables need to be packed Date: Thu, 14 Oct 2010 22:20:25 +0200 Message-ID: <201010142220.26329.arnd@arndb.de> References: <20101014183249.23510.29196.stgit@s20.home> <4CB75EA4.9080004@codemonkey.ws> <1287086288.2987.10.camel@x201> Mime-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: Jes Sorensen , Alex Williamson , kvm@vger.kernel.org To: qemu-devel@nongnu.org Return-path: In-Reply-To: <1287086288.2987.10.camel@x201> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org On Thursday 14 October 2010 21:58:08 Alex Williamson wrote: > If it works anywhere (I assume it works on 32bit), then it's only > because it happened to get the alignment right. This just makes 64bit > hosts get it right too. I don't see any compatibility issues, > non-packed + 64bit = broken. Thanks, I would actually assume that only x86-32 hosts got it right, because all 32 bit hosts I've seen other than x86 also define 8 byte alignment for uint64_t. You might however consider making it __attribute((__packed__, __aligned__(4))) instead of just packed, because otherwise you make the alignment one byte, which is not only different from what it used to be on x86-32 but also will cause inefficient compiler outpout on platforms that don't have unaligned word accesses in hardware. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37163 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6UIP-0004hU-2N for qemu-devel@nongnu.org; Thu, 14 Oct 2010 16:21:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6UIO-0007HS-3P for qemu-devel@nongnu.org; Thu, 14 Oct 2010 16:21:01 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:52323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6UIN-0007Gi-Oz for qemu-devel@nongnu.org; Thu, 14 Oct 2010 16:21:00 -0400 From: Arnd Bergmann Subject: Re: [Qemu-devel] Re: [PATCH] pc: e820 qemu_cfg tables need to be packed Date: Thu, 14 Oct 2010 22:20:25 +0200 References: <20101014183249.23510.29196.stgit@s20.home> <4CB75EA4.9080004@codemonkey.ws> <1287086288.2987.10.camel@x201> In-Reply-To: <1287086288.2987.10.camel@x201> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010142220.26329.arnd@arndb.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jes Sorensen , Alex Williamson , kvm@vger.kernel.org On Thursday 14 October 2010 21:58:08 Alex Williamson wrote: > If it works anywhere (I assume it works on 32bit), then it's only > because it happened to get the alignment right. This just makes 64bit > hosts get it right too. I don't see any compatibility issues, > non-packed + 64bit = broken. Thanks, I would actually assume that only x86-32 hosts got it right, because all 32 bit hosts I've seen other than x86 also define 8 byte alignment for uint64_t. You might however consider making it __attribute((__packed__, __aligned__(4))) instead of just packed, because otherwise you make the alignment one byte, which is not only different from what it used to be on x86-32 but also will cause inefficient compiler outpout on platforms that don't have unaligned word accesses in hardware. Arnd