[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Domain Save Image Format proposal (draft B)

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) {

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;
    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


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.