From: Tim Deegan Subject: Re: [PATCH 5/5] xen: Add V4V implementation - padding question Date: Tue, 11 Jun 2013 19:04:09 +0100 Message-ID: <20130611180409.GD27333@ocelot.phlegethon.org> References: <1344023454-31425-1-git-send-email-jean.guyader@citrix.com> <1344023454-31425-6-git-send-email-jean.guyader@citrix.com> <501FA05C0200007800092CD7@nat28.tlf.novell.com> <51B75A12.4050202@citrix.com> <20130611172507.GC27333@ocelot.phlegethon.org> <51B76115.7000209@citrix.com> <51B76462.3030100@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <51B76462.3030100@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ross Philipson Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org At 13:54 -0400 on 11 Jun (1370958882), Ross Philipson wrote: > On 06/11/2013 01:40 PM, Ross Philipson wrote: > >On 06/11/2013 01:25 PM, Tim Deegan wrote: > >>At 13:10 -0400 on 11 Jun (1370956242), Ross Philipson wrote: > >>>> > >>>>>>... > >>>>>>+struct v4v_info > >>>>>>+{ > >>>>>>+ uint64_t ring_magic; > >>>>>>+ uint64_t data_magic; > >>>>>>+ evtchn_port_t evtchn; > >>>>> > >>>>>Missing padding at the end? > >>>>> > >>>> > >>>>ack. > >>>> > >>> > >>>At one point during the review of an earlier version of the V4V patch > >>>set, Jan requested that this pad be added to the v4v_info struct. I > >>>understand the padding in all the other structs but I don't understand > >>>this one. This struct is not included in any other structs and is not > >>>followed by any data. > >> > >>64-bit Xen would see this as a 24-byte struct, even without explicit > >>padding. That would surprise a 32-bit guest that allocated what it saw > >>as a 20-byte struct for Xen to copy into. > > > >Ah yes, of course. Thanks for the quick response. > > > >Ross > > I guess that means that this struct is unhappy then... > > typedef struct v4vtables_rule > { > v4v_addr_t src; -- 8b > v4v_addr_t dst; -- 8b > uint32_t accept; -- 4b > } v4vtables_rule_t; Surprisingly, no: since it contains no 8-byte fields, both x86 architectures will see it as a 20-byte (4-byte-aligned) struct. Not sure about ARM, though. Tim.