From: Ian Campbell Subject: Re: [PATCH] blkif: add indirect descriptors interface to public headers Date: Wed, 13 Nov 2013 11:11:07 +0000 Message-ID: <1384341067.5406.70.camel@kazak.uk.xensource.com> References: <1384252612-22573-1-git-send-email-roger.pau@citrix.com> <9AAE0902D5BC7E449B7C8E4E778ABCD017021D@AMSPEX01CL01.citrite.net> <20131112142254.GC9306@phenom.dumpdata.com> <1384266541.10204.14.camel@kazak.uk.xensource.com> <9AAE0902D5BC7E449B7C8E4E778ABCD0170550@AMSPEX01CL01.citrite.net> <1384334807.5406.3.camel@kazak.uk.xensource.com> <9AAE0902D5BC7E449B7C8E4E778ABCD017132F@AMSPEX01CL01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VgYO0-0007UL-8c for xen-devel@lists.xenproject.org; Wed, 13 Nov 2013 11:13:28 +0000 In-Reply-To: <9AAE0902D5BC7E449B7C8E4E778ABCD017132F@AMSPEX01CL01.citrite.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Paul Durrant Cc: "xen-devel@lists.xenproject.org" , Roger Pau Monne , "Keir (Xen.org)" , Jan Beulich List-Id: xen-devel@lists.xenproject.org On Wed, 2013-11-13 at 11:07 +0000, Paul Durrant wrote: > > -----Original Message----- > > From: Ian Campbell > > Sent: 13 November 2013 09:27 > > To: Paul Durrant > > Cc: Konrad Rzeszutek Wilk; xen-devel@lists.xenproject.org; Keir (Xen.org); > > Jan Beulich; Roger Pau Monne > > Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface to > > public headers > > > > On Tue, 2013-11-12 at 15:16 +0000, Paul Durrant wrote: > > > > -----Original Message----- > > > > From: Ian Campbell > > > > Sent: 12 November 2013 14:29 > > > > To: Konrad Rzeszutek Wilk > > > > Cc: Paul Durrant; xen-devel@lists.xenproject.org; Keir (Xen.org); Jan > > Beulich; > > > > Roger Pau Monne > > > > Subject: Re: [Xen-devel] [PATCH] blkif: add indirect descriptors interface > > to > > > > public headers > > > > > > > > On Tue, 2013-11-12 at 09:22 -0500, Konrad Rzeszutek Wilk wrote: > > > > > > > > > > > +struct blkif_request_indirect { > > > > > > > + uint8_t operation; /* BLKIF_OP_INDIRECT */ > > > > > > > + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE} */ > > > > > > > + uint16_t nr_segments; /* number of segments */ > > > > > > > > > > > > This is going to be a problem. What alignment boundary are you > > > > > expecting the next field to start on? AFAIK 32-bit gcc will 4-byte > > > > > align it, 32-bit MSVC will 8-byte align it. > > > > > > > > > > > > > > > > Oh no. I thought that the Linux one had this set correctly, ah it did: > > > > > > > > > > > > > > > struct blkif_request_indirect { > > > > > [...] > > > > > } __attribute__((__packed__)); > > > > > > > > That attribute packed isn't allowed in the public interface headers. > > > > > > > > Since compilers do differ in their packing, and guests may be using > > > > various pragmas, it might be useful to write down that for x86 these > > > > headers are to be treated as using the ABI (gcc? Some Intel > > > > standard?). > > > > > > > > > > Can we go for types aligned on their size then rather than gcc brokenness. > > > > We should go for some existing well defined ABI spec not make up our > > own. > > > > In effect the x86 ABI has historically been de-facto specified as the > > gcc ABI. > > > > Since the linux headers seem to hardcode the x64 ABI for this struct, > do we need to support an x86 variant? After all there's no backwards > compatibility issue here. I am talking about the general case for all xen/include/public headers, not these structs specifically. There should be a well specified default for the struct layout. If particular structs diverge from this (and being consistent across 32- and 64-bit is a good reason to do so) then suitable padding and perhaps #ifdefs might be needed. Ian.