From: Jimi Xenidis Subject: Re: RFC: 32 bits as smallest atomic size. Date: Fri, 25 Mar 2005 18:49:17 -0500 Message-ID: <16964.41853.43756.836319@kitch0.watson.ibm.com> References: <16964.33214.921809.324278@kitch0.watson.ibm.com> <74f362598b4e1a0d46aacb1a514706ac@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit In-Reply-To: <74f362598b4e1a0d46aacb1a514706ac@cl.cam.ac.uk> Sender: xen-devel-admin@lists.sourceforge.net Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Keir Fraser Cc: xen-devel@lists.sourceforge.net List-Id: xen-devel@lists.xenproject.org >>>>> "KF" == Keir Fraser writes: KF> I expect we can fix that up in the ppc macros: if the atomic access is KF> sub-32-bit aligned then round the address down to 32-bit boundary and KF> do a 32-bit cmpxchg. A few issues: 1) this assumes that the quantity is wholy contained in our atomic unit, by using packed there is no way to guarantee that. 2) it would have to be a runtime decision on all PPC atomic operations that could fail with no real failure path available. We could also program it out, consider this alternative: typedef struct { struct { u16 flags; /* 0 */ domid_t domid; /* 2 */ } atomic; u32 frame; /* 4 */ } grant_entry_t; /* 8 bytes */ Few things to note: 1) packed is necessary since the ABI will do the right thing 2) would simplify the code at grant_table.c:162 3) will have better performance since all access are guranteed to be aligned. I understand the usefulness of packed, but its gratuitous use unecessarily complicates other architectures, and can hurt even x86 if it results in a data that "straddles" cachelines. -JX ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click