From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC][PATCH 3/5] ksm source code Date: Thu, 24 Jan 2008 21:41:06 +0200 Message-ID: <4798E9D2.8030503@qumranet.com> References: <4794C477.3090708@qumranet.com> <20080124072432.GQ3627@sequoia.sous-sol.org> <4798554D.1010300@qumranet.com> <20080124175132.GR3627@sequoia.sous-sol.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , andrea-atKUWr5tajBWk0Htik3J/w@public.gmane.org, yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org To: Chris Wright Return-path: In-Reply-To: <20080124175132.GR3627-JyIX8gxvWYPr2PDY2+4mTGD2FQJk+8+b@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Chris Wright wrote: >>> struct ksm_memory_region { >>> __u32 npages; /* number of pages to share */ >>> __u64 addr; /* the begining of the virtual address */ >>> }; >>> >> why isnt it compat safe? >> > > 32-bit has more relaxed alignment requirement for __u64 (4 bytes) > than 64-bit (8 bytes). choices are reverse the order or add padding > (can test by compiling structure in 32 and 64 bit). > Reversing the order isn't good enough, since the structure size would be different, and that is embedded in the ioctl number. Padding is necessary. [wishlist: struct { ... } __attribute__((abi_x86_64));] -- Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4798E9D2.8030503@qumranet.com> Date: Thu, 24 Jan 2008 21:41:06 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [kvm-devel] [RFC][PATCH 3/5] ksm source code References: <4794C477.3090708@qumranet.com> <20080124072432.GQ3627@sequoia.sous-sol.org> <4798554D.1010300@qumranet.com> <20080124175132.GR3627@sequoia.sous-sol.org> In-Reply-To: <20080124175132.GR3627@sequoia.sous-sol.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Chris Wright Cc: Izik Eidus , andrea@qumranet.com, yaniv@qumranet.com, kvm-devel , linux-mm@kvack.org List-ID: Chris Wright wrote: >>> struct ksm_memory_region { >>> __u32 npages; /* number of pages to share */ >>> __u64 addr; /* the begining of the virtual address */ >>> }; >>> >> why isnt it compat safe? >> > > 32-bit has more relaxed alignment requirement for __u64 (4 bytes) > than 64-bit (8 bytes). choices are reverse the order or add padding > (can test by compiling structure in 32 and 64 bit). > Reversing the order isn't good enough, since the structure size would be different, and that is embedded in the ioctl number. Padding is necessary. [wishlist: struct { ... } __attribute__((abi_x86_64));] -- Any sufficiently difficult bug is indistinguishable from a feature. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org