From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [Qemu-devel] Re: [PATCH] pc: e820 qemu_cfg tables need to be packed Date: Thu, 14 Oct 2010 14:59:04 -0600 Message-ID: <1287089944.2987.33.camel@x201> References: <20101014183249.23510.29196.stgit@s20.home> <4CB75EA4.9080004@codemonkey.ws> <1287086288.2987.10.camel@x201> <201010142220.26329.arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, Anthony Liguori , Jes Sorensen , kvm@vger.kernel.org To: Arnd Bergmann Return-path: Received: from mx1.redhat.com ([209.132.183.28]:6830 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755320Ab0JNU7K (ORCPT ); Thu, 14 Oct 2010 16:59:10 -0400 In-Reply-To: <201010142220.26329.arnd@arndb.de> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2010-10-14 at 22:20 +0200, Arnd Bergmann wrote: > 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. The structs in question only contain 4 & 8 byte elements, so there shouldn't be any change on x86-32 using one-byte aligned packing. AFAIK, e820 is x86-only, so we don't need to worry about breaking anyone else. Performance isn't much of a consideration for this type of interface since it's only used pre-boot. In fact, the channel between qemu and the bios is only one byte wide, so wider alignment can cost extra emulated I/O accesses. Thanks, Alex