From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frediano Ziglio Subject: Re: Domain Save Image Format proposal (draft B) Date: Wed, 12 Feb 2014 11:27:51 +0000 Message-ID: <1392204471.24787.15.camel@hamster.uk.xensource.com> References: <52F90A71.40802@citrix.com> <52FA043B020000780011B10C@nat28.tlf.novell.com> <21242.21415.38574.210861@mariner.uk.xensource.com> <1392138928.26657.134.camel@kazak.uk.xensource.com> <1392139881.27767.6.camel@hamster.uk.xensource.com> <21242.25519.844862.598762@mariner.uk.xensource.com> <1392141590.26657.137.camel@kazak.uk.xensource.com> <1392196023.24787.1.camel@hamster.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1392196023.24787.1.camel@hamster.uk.xensource.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: Ian Campbell Cc: Stefano Stabellini , Ian Jackson , "Xen-devel@lists.xen.org" , David Vrabel , Jan Beulich , rshriram@cs.ubc.ca List-Id: xen-devel@lists.xenproject.org On Wed, 2014-02-12 at 09:07 +0000, Frediano Ziglio wrote: > On Tue, 2014-02-11 at 17:59 +0000, Ian Campbell wrote: > > On Tue, 2014-02-11 at 17:53 +0000, Ian Jackson wrote: > > > Frediano Ziglio writes ("Re: [Xen-devel] Domain Save Image Format proposal (draft B)"): > > > David is entirely correct to specify a fixed endianness for the image > > > header. > > > > Full ack. > > > > > Me too. I was not speaking about the image header but all others > records. Obviously by native endianess I mean the endianess of the VM. > If I have a ARMBE this would save as big endian because the VM is big > endian. On the same host an ARMLE would save using little endian. > > Frediano > More about endianess and protocols. Why the network defined a network byte order? 1- you don't need to specify a flag 2- you always have to convert or not, that's no if Consider point 2. Considering you have a function to get a 32 bit in the native format uint32_t get_native32(uint32_t n) { XXX } Now, in the case you use always the same endian XXX is either a NOP or a a swap. The case you support both is more complicated, something like if (is_my_format) return n; else return swap(n); If we inline it we expand the code, if we not inline we slow down a bit. Considering that in many platforms swapping is so easy that can be inlined implementing get_native32 can be easily inlined. In the case we need to handle large structures and you have to call may times these kind of functions perhaps the time spent for the conversion and size of the code does not matter (we could use a template system to optimize the two cases spending extra code or device to not inline) but if choosing a protocol specification instead of another could help why not choosing the proper endian schema considering the pro/cons of all cases? Frediano