Domain Save Image Format proposal (draft B)
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
http://xenbits.xen.org/people/dvrabel/domain-save-format-B.pdf
Introduction
============
Revision History
----------------
--------------------------------------------------------------------
Version Date Changes ------- ----------- ---------------------------------------------- Draft A 6 Feb 2014 Initial draft.
Draft B 10 Feb 2014 Corrected image header field widths.
Minor updates and clarifications.
--------------------------------------------------------------------
Purpose
-------
The _domain save image_ is the context of a running domain used for snapshots of a domain or for transferring domains between hosts during migration.
There are a number of problems with the format of the domain save image used in Xen 4.4 and earlier (the _legacy format_).
* Dependant on toolstack word size. A number of fields within the image are native types such as unsigned long which have different sizes between 32-bit and 64-bit hosts. This prevents domains from being migrated between 32-bit and 64-bit hosts.
* There is no header identifying the image.
* The image has no version information.
A new format that addresses the above is required.
ARM does not yet have have a domain save image format specified and the format described in this specification should be suitable.
Overview
========
The image format consists of two main sections:
* _Headers_
* _Records_
Headers
-------
There are two headers: the _image header_, and the _domain header_. The image header describes the format of the image (version etc.). The _domain header_ contains general information about the domain (architecture, type etc.).
Records
-------
The main part of the format is a sequence of different _records_. Each record type contains information about the domain context. At a minimum there is a END record marking the end of the records section.
Fields
------
All the fields within the headers and records have a fixed width.
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
Integer (numeric) fields in the image header are always in big-endian byte order.
Integer fields in the domain header and in the records are in the endianess described in the image header (which will typically be the native ordering).
Headers
=======
Image Header
------------
The image header identifies an image as a Xen domain save image. It includes the version of this specification that the image complies with.
Tools supporting version _V_ of the specification shall always save images using version _V_. Tools shall support restoring from version _V_ and version _V_ - 1. Tools may additionally support restoring from earlier versions.
The marker field can be used to distinguish between legacy images and those corresponding to this specification. Legacy images will have at one or more zero bits within the first 8 octets of the image.
Fields within the image header are always in _big-endian_ byte order, regardless of the setting of the endianness bit.
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
| marker |
+-----------------------+-------------------------+
| id | version |
+-----------+-----------+-------------------------+
| options | |
+-----------+-------------------------------------+
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
marker 0xFFFFFFFFFFFFFFFF.
id 0x58454E46 ("XENF" in ASCII).
version 0x00000001. The version of this specification.
options bit 0: Endianness. 0 = little-endian, 1 = big-endian.
bit 1-15: Reserved.
--------------------------------------------------------------------
Domain Header
-------------
The domain header includes general properties of the domain.
0 1 2 3 4 5 6 7 octet
+-----------+-----------+-----------+-------------+
| arch | type | page_shift| (reserved) |
+-----------+-----------+-----------+-------------+
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch 0x0000: Reserved.
0x0001: x86.
0x0002: ARM.type 0x0000: Reserved.
0x0001: x86 PV.
0x0002 - 0xFFFF: Reserved.page_shift Size of a guest page as a power of two.
i.e., page size = 2^page_shift^.
--------------------------------------------------------------------
Records
=======
A record has a record header, type specific data and a trailing footer. If body_length is not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary.
0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
| type | body_length |
+-----------+-----------+-------------------------+
| options | (reserved) |
+-----------+-------------------------------------+
...
Record body of length body_length octets followed by
0 to 7 octets of padding.
...
+-----------------------+-------------------------+
| checksum | (reserved) |
+-----------------------+-------------------------+--------------------------------------------------------------------
Field Description ----------- ------------------------------------------------------- type 0x00000000: END
0x00000001: PAGE_DATA
0x00000002: VCPU_INFO
0x00000003: VCPU_CONTEXT
0x00000004: X86_PV_INFO
0x00000005: P2M
0x00000006 - 0xFFFFFFFF: Reservedbody_length Length in octets of the record body.
options Bit 0: 0 - checksum invalid, 1 = checksum valid.
Bit 1-15: Reserved.
checksum CRC-32 checksum of the record body (including any trailing
padding), or 0x00000000 if the checksum field is invalid.
--------------------------------------------------------------------
The following sub-sections specify the record body format for each of the record types.
END
----
A end record marks the end of the image.
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
The end record contains no fields; its body_length is 0.
PAGE_DATA
---------
The bulk of an image consists of many PAGE_DATA records containing the memory contents.
0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
| count (C) | (reserved) |
+-----------------------+-------------------------+
| pfn[0] |
+-------------------------------------------------+
...
+-------------------------------------------------+
| pfn[C-1] |
+-------------------------------------------------+
| page_data[0]... |
...
+-------------------------------------------------+
| page_data[N-1]... |
...
+-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.
pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
page_data page_size octets of uncompressed page contents for each page
set as present in the pfn array.
--------------------------------------------------------------------
VCPU_INFO
---------
Quoted 2 lines
[ This is a combination of parts of the extended-info and
XC_SAVE_ID_VCPU_INFOchunks. ]
The VCPU_INFO record includes the maximum possible VCPU ID. This will be followed a VCPU_CONTEXT record for each online VCPU.
0 1 2 3 4 5 6 7 octet
+-----------------------+------------------------+
| max_vcpu_id | (reserved) |
+-----------------------+------------------------+
--------------------------------------------------------------------
Field Description ----------- --------------------------------------------------- max_vcpu_id Maximum possible VCPU ID.
--------------------------------------------------------------------
VCPU_CONTEXT
------------
The context for a single VCPU.
0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
| vcpu_id | (reserved) |
+-----------------------+-------------------------+
| vcpu_ctx... |
...
+-------------------------------------------------+--------------------------------------------------------------------
Field Description ----------- --------------------------------------------------- vcpu_id The VCPU ID.
vcpu_ctx Context for this VCPU.
--------------------------------------------------------------------
[ vcpu_ctx format TBD. ]
X86_PV_INFO
-----------
Quoted 1 line
[ This record replaces part of the extended-info chunk. ]
0 1 2 3 4 5 6 7 octet
+-----+-----+-----+-------------------------------+
| w | ptl | o | (reserved) |
+-----+-----+-----+-------------------------------+
--------------------------------------------------------------------
Field Description ----------- --------------------------------------------------- guest_width (w) Guest width in octets (either 4 or 8).
pt_levels (ptl) Number of page table levels (either 3 or 4).
options (o) Bit 0: 0 - no VMASST_pae_extended_cr3,
1 - VMASST_pae_extended_cr3.
Bit 1-7: Reserved.
--------------------------------------------------------------------
P2M
---
[ This is a more flexible replacement for the old p2m_size field and p2m array. ]
The P2M record contains a portion of the source domain's P2M. Multiple P2M records may be sent if the source P2M changes during the stream.
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
| pfn_begin |
+-------------------------------------------------+
| pfn_end |
+-------------------------------------------------+
| mfn[0] |
+-------------------------------------------------+
...
+-------------------------------------------------+
| mfn[N-1] |
+-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------pfn_begin The first PFN in this portion of the P2M
pfn_end One past the last PFN in this portion of the P2M.
mfn Array of (pfn_end - pfn-begin) MFNs corresponding to
the set of PFNs in the range [pfn_begin, pfn_end).
--------------------------------------------------------------------
Layout
======
The set of valid records depends on the guest architecture and type.
x86 PV Guest
------------
An x86 PV guest image will have in this order:
1. Image header
2. Domain header
3. X86_PV_INFO record
4. At least one P2M record
5. At least one PAGE_DATA record
6. VCPU_INFO record
6. At least one VCPU_CONTEXT record
7. END record
Legacy Images (x86 only)
========================
Restoring legacy images from older tools shall be handled by translating the legacy format image into this new format.
It shall not be possible to save in the legacy format.
There are two different legacy images depending on whether they were generated by a 32-bit or a 64-bit toolstack. These shall be distinguished by inspecting octets 4-7 in the image. If these are zero then it is a 64-bit image.
Toolstack Field Value --------- ----- ----- 64-bit Bit 31-63 of the p2m_size field 0 (since p2m_size < 2^32^) 32-bit extended-info chunk ID (PV) 0xFFFFFFFF 32-bit Chunk type (HVM) < 0 32-bit Page count (HVM) > 0
Table: Possible values for octet 4-7 in legacy images
This assumes the presence of the extended-info chunk which was introduced in Xen 3.0.
Future Extensions
=================
All changes to this format require the image version to be increased.
The format may be extended by adding additional record types.
Extending an existing record type must be done by adding a new record type. This allows old images with the old record to still be restored.
The image header may be extended by _appending_ additional fields. In particular, the marker, id and version fields must never change size or location.
Quoted 29 lines · David Vrabel
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
http://xenbits.xen.org/people/dvrabel/domain-save-format-B.pdf
Introduction
============Revision History
------------------------------------------------------------------------------------
Version Date Changes ------- ----------- ---------------------------------------------- Draft A 6 Feb 2014 Initial draft.Draft B 10 Feb 2014 Corrected image header field widths.
Minor updates and clarifications.
--------------------------------------------------------------------Purpose
-------The
_domainsaveimage_is the context of a running domain used for snapshots of a domain or for transferring domains between hosts during migration.
Quoted 7 lines
There are a number of problems with the format of the domain save image used in Xen 4.4 and earlier (the
_legacyformat_).* Dependant on toolstack word size. A number of fields within the image are native types such as
unsigned longwhich have different sizes between 32-bit and 64-bit hosts. This prevents domains from being migrated between 32-bit and 64-bit hosts.
s/hosts/toolstacks/ (or toolstack domains)
~Andrew
Quoted 6 lines · David Vrabel
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
http://xenbits.xen.org/people/dvrabel/domain-save-format-B.pdf
....
Quoted 5 lines
Integer fields in the domain header and in the records are in the endianess described in the image header (which will typically be the native ordering).
This mean that we could have a Intel image coded in big endian format. It's fine but we have to support native and not native images.
...
Frediano
Quoted 37 lines · David Vrabel
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
http://xenbits.xen.org/people/dvrabel/domain-save-format-B.pdf
Introduction
============Revision History
------------------------------------------------------------------------------------
Version Date Changes ------- ----------- ---------------------------------------------- Draft A 6 Feb 2014 Initial draft.Draft B 10 Feb 2014 Corrected image header field widths.
Minor updates and clarifications.
--------------------------------------------------------------------Purpose
-------The
_domainsaveimage_is the context of a running domain used for snapshots of a domain or for transferring domains between hosts during migration.There are a number of problems with the format of the domain save image used in Xen 4.4 and earlier (the
_legacyformat_).* Dependant on toolstack word size. A number of fields within the image are native types such as
unsigned longwhich have different sizes between 32-bit and 64-bit hosts. This prevents domains from being migrated between 32-bit and 64-bit hosts.
Quoted 10 lines
* There is no header identifying the image.
* The image has no version information.
A new format that addresses the above is required.
ARM does not yet have have a domain save image format specified and the format described in this specification should be suitable.
I suggest keeping the processing overhead in mind when designing the new image format. Some key things have been addressed, such as making sure data is always padded to maintain alignment. But there are also some aspects of this
proposal that seem awfully unnecessary.. More details below.
Quoted 28 lines
Overview
========The image format consists of two main sections:
* _Headers_
* _Records_Headers
-------There are two headers: the
_imageheader_, and the_domainheader_. The image header describes the format of the image (version etc.). The_domainheader_contains general information about the domain (architecture, type etc.).Records
-------The main part of the format is a sequence of different _records_. Each record type contains information about the domain context. At a minimum there is a END record marking the end of the records section.
Fields
------
Quoted 8 lines
All the fields within the headers and records have a fixed width.
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
So far so good.
Quoted 8 lines
Integer (numeric) fields in the image header are always in big-endian byte order.
Integer fields in the domain header and in the records are in the endianess described in the image header (which will typically be the native ordering).
Its tempting to adopt all the TCP-style madness for transferring a set of structured data. Why this endian-ness mess? Am I missing something here? I am assuming that a lion's share of Xen's deployment is on x86 (not including Amazon). So that leaves ARM. Why not let these processors take the hit of endian-ness conversion?
Headers
Quoted 14 lines
=======
Image Header
------------The image header identifies an image as a Xen domain save image. It includes the version of this specification that the image complies with.
Tools supporting version _V_ of the specification shall always save images using version _V_. Tools shall support restoring from version _V_ and version _V_ - 1. Tools may additionally support restoring from earlier versions.
Quoted 7 lines
The marker field can be used to distinguish between legacy images and those corresponding to this specification. Legacy images will have at one or more zero bits within the first 8 octets of the image.
Fields within the image header are always in _big-endian_ byte order, regardless of the setting of the endianness bit.
and more endian-ness mess.
Quoted 62 lines
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
| marker |
+-----------------------+-------------------------+
| id | version |
+-----------+-----------+-------------------------+
| options | |
+-----------+-------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
marker0xFFFFFFFFFFFFFFFF.id
0x58454E46("XENF" in ASCII).version
0x00000001. The version of this specification.options bit 0: Endianness. 0 = little-endian, 1 = big-endian.
bit 1-15: Reserved.--------------------------------------------------------------------
Domain Header
-------------The domain header includes general properties of the domain.
0 1 2 3 4 5 6 7 octet
+-----------+-----------+-----------+-------------+
| arch | type | page_shift| (reserved) |
+-----------+-----------+-----------+-------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.type
0x0000: Reserved.0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved.
page_shiftSize of a guest page as a power of two.i.e., page size = 2^page_shift^.--------------------------------------------------------------------
Records
=======A record has a record header, type specific data and a trailing footer. If
body_lengthis not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary.
Quoted 15 lines
0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
| type | body_length |
+-----------+-----------+-------------------------+
| options | (reserved) |
+-----------+-------------------------------------+
...
Record body of length body_length octets followed by
0 to 7 octets of padding.
...
+-----------------------+-------------------------+
| checksum | (reserved) |
+-----------------------+-------------------------+I am assuming that you the checksum field is present only for debugging purposes? Otherwise, I see no reason for the computational overhead, given that we are already sending data over a reliable channel + IIRC we already have an image-wide checksum when saving the image to disk.
If debugging is the only use case, then I guess, the type field can be prefixed with a 1/0 bit, eliminating the need for the 1-bit checkum options field + 7-byte padding. Similarly, if debugging mode is not set, why waste another 8 bytes in the end for the checksum field.
Unless you think there may be more types with need of special options,
Feel free to correct me if I am missing something elementary here..
Quoted 68 lines
--------------------------------------------------------------------
Field Description ----------- ------------------------------------------------------- type 0x00000000: END0x00000001: PAGE_DATA 0x00000002: VCPU_INFO 0x00000003: VCPU_CONTEXT 0x00000004: X86_PV_INFO 0x00000005: P2M 0x00000006 - 0xFFFFFFFF: Reserved
body_lengthLength in octets of the record body.options Bit 0: 0 - checksum invalid, 1 = checksum valid.
Bit 1-15: Reserved.checksum CRC-32 checksum of the record body (including any trailing
padding), or 0x00000000 if the checksum field is invalid.--------------------------------------------------------------------
The following sub-sections specify the record body format for each of the record types.
END
----A end record marks the end of the image.
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+The end record contains no fields; its
body_lengthis 0.
PAGE_DATA
---------The bulk of an image consists of many
PAGE_DATArecords containing the memory contents.0 1 2 3 4 5 6 7 octet +-----------------------+-------------------------+ | count (C) | (reserved) | +-----------------------+-------------------------+ | pfn[0] | +-------------------------------------------------+ ... +-------------------------------------------------+ | pfn[C-1] | +-------------------------------------------------+ | page_data[0]... | ... +-------------------------------------------------+ | page_data[N-1]... | ... +-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.
Quoted 8 lines
pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
page_datapage_sizeoctets of uncompressed page contents for each page
set as present in the pfn array.
--------------------------------------------------------------------
s/uncompressed/(compressed/uncompressed)/
(Remus sends compressed data)
Quoted 112 lines
VCPU_INFO
---------Quoted 2 lines
[ This is a combination of parts of the extended-info and
XC_SAVE_ID_VCPU_INFOchunks. ]The
VCPU_INFOrecord includes the maximum possible VCPU ID. This will be followed aVCPU_CONTEXTrecord for each online VCPU.0 1 2 3 4 5 6 7 octet
+-----------------------+------------------------+
|max_vcpu_id| (reserved) |
+-----------------------+------------------------+--------------------------------------------------------------------
Field Description ----------- --------------------------------------------------- max_vcpu_id Maximum possible VCPU ID.--------------------------------------------------------------------
VCPU_CONTEXT
------------The context for a single VCPU.
0 1 2 3 4 5 6 7 octet +-----------------------+-------------------------+ | vcpu_id | (reserved) | +-----------------------+-------------------------+ | vcpu_ctx... | ... +-------------------------------------------------+--------------------------------------------------------------------
Field Description ----------- --------------------------------------------------- vcpu_id The VCPU ID.
vcpu_ctxContext for this VCPU.
--------------------------------------------------------------------[
vcpu_ctxformat TBD. ]
X86_PV_INFO
-----------Quoted 1 line
[ This record replaces part of the extended-info chunk. ]
0 1 2 3 4 5 6 7 octet
+-----+-----+-----+-------------------------------+
| w | ptl | o | (reserved) |
+-----+-----+-----+-------------------------------+--------------------------------------------------------------------
Field Description ----------- --------------------------------------------------- guest_width (w) Guest width in octets (either 4 or 8).
pt_levels(ptl) Number of page table levels (either 3 or 4).options (o) Bit 0: 0 - no
VMASST_pae_extended_cr3,
1 -VMASST_pae_extended_cr3.Bit 1-7: Reserved.
--------------------------------------------------------------------P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]The P2M record contains a portion of the source domain's P2M. Multiple P2M records may be sent if the source P2M changes during the stream.
0 1 2 3 4 5 6 7 octet +-------------------------------------------------+ | pfn_begin | +-------------------------------------------------+ | pfn_end | +-------------------------------------------------+ | mfn[0] | +-------------------------------------------------+ ... +-------------------------------------------------+ | mfn[N-1] | +-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------pfn_beginThe first PFN in this portion of the P2M
pfn_endOne past the last PFN in this portion of the P2M.mfn Array of (
pfn_end- pfn-begin) MFNs corresponding to
the set of PFNs in the range [pfn_begin,pfn_end).
--------------------------------------------------------------------Layout
======The set of valid records depends on the guest architecture and type.
x86 PV Guest
------------
Quoted 7 lines
An x86 PV guest image will have in this order:
1. Image header
2. Domain header
3.X86_PV_INFOrecord
4. At least one P2M record
5. At least onePAGE_DATArecord
6. VCPU_INFO record
Quoted 1 line
6. At least one
VCPU_CONTEXTrecord
7. END record
Quoted 2 lines
There seems to be a bunch of info missing. Here are some missing elements that I can recall at the moment:
a) there is no support for sending over one time markers that switch the receiver's operating mode in the middle of a data stream. E.g., XC_SAVE_ENABLE_COMPRESSION, XC_SAVE_ID_LAST_CHECKPOINT, etc. XC_SAVE_ENABLE_VERIFY_MODE,
b) in pv case, the tail also has a list of unmapped PFNs at the end of every iteration.
c) XC_SAVE_ID_TOOLSTACK -- used by xl to pass device context information (generally
for HVMs).
Quoted 34 lines
Legacy Images (x86 only)
========================Restoring legacy images from older tools shall be handled by translating the legacy format image into this new format.
It shall not be possible to save in the legacy format.
There are two different legacy images depending on whether they were generated by a 32-bit or a 64-bit toolstack. These shall be distinguished by inspecting octets 4-7 in the image. If these are zero then it is a 64-bit image.
Toolstack Field Value --------- ----- ----- 64-bit Bit 31-63 of the p2m_size field 0 (since p2m_size < 2^32^) 32-bit extended-info chunk ID (PV) 0xFFFFFFFF 32-bit Chunk type (HVM) < 0 32-bit Page count (HVM) > 0Table: Possible values for octet 4-7 in legacy images
This assumes the presence of the extended-info chunk which was introduced in Xen 3.0.
Future Extensions
=================All changes to this format require the image version to be increased.
The format may be extended by adding additional record types.
Quoted 9 lines
Extending an existing record type must be done by adding a new record type. This allows old images with the old record to still be restored.
The image header may be extended by _appending_ additional fields. In particular, the
marker,idandversionfields must never change size or location.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 107 lines · Shriram Rajagopalan
On Mon, Feb 10, 2014 at 9:20 AM, David Vrabel <[email protected] <mailto:[email protected]>> wrote:
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
http://xenbits.xen.org/people/dvrabel/domain-save-format-B.pdf
Introduction
============Revision History
------------------------------------------------------------------------------------
Version Date Changes
------- ----------- ----------------------------------------------
Draft A 6 Feb 2014 Initial draft.Draft B 10 Feb 2014 Corrected image header field widths.
Minor updates and clarifications.
--------------------------------------------------------------------Purpose
-------The
_domainsaveimage_is the context of a running domain used for snapshots of a domain or for transferring domains between hosts during migration.There are a number of problems with the format of the domain save image used in Xen 4.4 and earlier (the
_legacyformat_).* Dependant on toolstack word size. A number of fields within the image are native types such as
unsigned longwhich have different sizes between 32-bit and 64-bit hosts. This prevents domains from being migrated between 32-bit and 64-bit hosts.* There is no header identifying the image.
* The image has no version information.
A new format that addresses the above is required.
ARM does not yet have have a domain save image format specified and the format described in this specification should be suitable.
I suggest keeping the processing overhead in mind when designing the new image format. Some key things have been addressed, such as making sure data
is always padded to maintain alignment. But there are also some aspects of this
proposal that seem awfully unnecessary.. More details below.Overview
========The image format consists of two main sections:
* _Headers_
* _Records_Headers
-------There are two headers: the
_imageheader_, and the_domainheader_. The image header describes the format of the image (version etc.). The_domainheader_contains general information about the domain (architecture, type etc.).Records
-------The main part of the format is a sequence of different _records_. Each record type contains information about the domain context. At a minimum there is a END record marking the end of the records section.
Fields
------All the fields within the headers and records have a fixed width.
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
So far so good.
Integer (numeric) fields in the image header are always in big-endian byte order.
Integer fields in the domain header and in the records are in the endianess described in the image header (which will typically be the native ordering).
Quoted 5 lines
Its tempting to adopt all the TCP-style madness for transferring a set of structured data. Why this endian-ness mess? Am I missing something here? I am assuming that a lion's share of Xen's deployment is on x86 (not including Amazon). So that leaves ARM. Why not let these processors take the hit of endian-ness conversion?
The large majority is indeed x86, but don't discount ARM because it is currently in the minority. With the current requirements, the vast majority of the data will still be little endian on x86.
Quoted 20 lines
Headers
=======Image Header
------------The image header identifies an image as a Xen domain save image. It includes the version of this specification that the image complies with.
Tools supporting version _V_ of the specification shall always save images using version _V_. Tools shall support restoring from version _V_ and version _V_ - 1. Tools may additionally support restoring from earlier versions.
The marker field can be used to distinguish between legacy images and those corresponding to this specification. Legacy images will have at one or more zero bits within the first 8 octets of the image.
Quoted 5 lines
Fields within the image header are always in _big-endian_ byte order, regardless of the setting of the endianness bit.
and more endian-ness mess.
Network order is perfectly valid. Is is how all your network packets arrive...
Quoted 91 lines
0 1 2 3 4 5 6 7 octet +-------------------------------------------------+ | marker | +-----------------------+-------------------------+ | id | version | +-----------+-----------+-------------------------+ | options | | +-----------+-------------------------------------+ -------------------------------------------------------------------- Field Description ----------- -------------------------------------------------------- marker 0xFFFFFFFFFFFFFFFF. id 0x58454E46 ("XENF" in ASCII). version 0x00000001. The version of this specification. options bit 0: Endianness. 0 = little-endian, 1 = big-endian. bit 1-15: Reserved. -------------------------------------------------------------------- Domain Header ------------- The domain header includes general properties of the domain. 0 1 2 3 4 5 6 7 octet +-----------+-----------+-----------+-------------+ | arch | type | page_shift| (reserved) | +-----------+-----------+-----------+-------------+ -------------------------------------------------------------------- Field Description ----------- -------------------------------------------------------- arch 0x0000: Reserved. 0x0001: x86. 0x0002: ARM. type 0x0000: Reserved. 0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved. page_shift Size of a guest page as a power of two. i.e., page size = 2^page_shift^. -------------------------------------------------------------------- Records ======= A record has a record header, type specific data and a trailing footer. If body_length is not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary. 0 1 2 3 4 5 6 7 octet +-----------------------+-------------------------+ | type | body_length | +-----------+-----------+-------------------------+ | options | (reserved) | +-----------+-------------------------------------+ ... Record body of length body_length octets followed by 0 to 7 octets of padding. ... +-----------------------+-------------------------+ | checksum | (reserved) | +-----------------------+-------------------------+I am assuming that you the checksum field is present only for debugging purposes? Otherwise, I see no reason for the computational overhead, given that we are already sending data over a reliable channel + IIRC we already have an image-wide checksum when saving the image to disk.
If debugging is the only use case, then I guess, the type field can be prefixed with a 1/0 bit, eliminating the need for the 1-bit checkum options field + 7-byte padding. Similarly, if debugging mode is not set, why waste another 8 bytes in the end for the checksum field.
Quoted 3 lines
Unless you think there may be more types with need of special options,
Feel free to correct me if I am missing something elementary here..
What image-wide checksum?
Are you certain that all your data is moving over reliable channels? Are you certain that your hard drives are bit perfect. Are you certain that your network connection is bit perfect?
Given the amount of data sent as part of a migration, 8 bytes per record is not a substantial overhead.
Quoted 82 lines
--------------------------------------------------------------------
Field Description
----------- -------------------------------------------------------
type 0x00000000: END
0x00000001: PAGE_DATA
0x00000002: VCPU_INFO
0x00000003: VCPU_CONTEXT
0x00000004: X86_PV_INFO
0x00000005: P2M
0x00000006 - 0xFFFFFFFF: Reserved
body_length Length in octets of the record body.
options Bit 0: 0 - checksum invalid, 1 = checksum valid.
Bit 1-15: Reserved.
checksum CRC-32 checksum of the record body (including any
trailing
padding), or 0x00000000 if the checksum field is invalid.
--------------------------------------------------------------------
The following sub-sections specify the record body format for each of
the record types.
END
----
A end record marks the end of the image.
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
The end record contains no fields; its body_length is 0.
PAGE_DATA
---------
The bulk of an image consists of many PAGE_DATA records containing the
memory contents.
0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
| count (C) | (reserved) |
+-----------------------+-------------------------+
| pfn[0] |
+-------------------------------------------------+
...
+-------------------------------------------------+
| pfn[C-1] |
+-------------------------------------------------+
| page_data[0]... |
...
+-------------------------------------------------+
| page_data[N-1]... |
...
+-------------------------------------------------+
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.
pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
page_data page_size octets of uncompressed page contents for
each page
set as present in the pfn array.
--------------------------------------------------------------------Quoted 2 lines
s/uncompressed/(compressed/uncompressed)/
(Remus sends compressed data)
IIRC, remus sends XOR+RLE encoded pages? Along with HVM domains, this needs covering in a future draft.
~Andrew
Quoted 188 lines
VCPU_INFO
---------> [ This is a combination of parts of the extended-info and >
XC_SAVE_ID_VCPU_INFOchunks. ]The
VCPU_INFOrecord includes the maximum possible VCPU ID. This will be followed aVCPU_CONTEXTrecord for each online VCPU.0 1 2 3 4 5 6 7 octet
+-----------------------+------------------------+
|max_vcpu_id| (reserved) |
+-----------------------+------------------------+--------------------------------------------------------------------
Field Description
----------- ---------------------------------------------------max_vcpu_idMaximum possible VCPU ID.
--------------------------------------------------------------------
VCPU_CONTEXT
------------The context for a single VCPU.
0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
|vcpu_id| (reserved) |
+-----------------------+-------------------------+
|vcpu_ctx... |
...
+-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- ---------------------------------------------------
vcpu_idThe VCPU ID.
vcpu_ctxContext for this VCPU.
--------------------------------------------------------------------[
vcpu_ctxformat TBD. ]
X86_PV_INFO
-----------> [ This record replaces part of the extended-info chunk. ]
0 1 2 3 4 5 6 7 octet
+-----+-----+-----+-------------------------------+
| w | ptl | o | (reserved) |
+-----+-----+-----+-------------------------------+--------------------------------------------------------------------
Field Description
----------- ---------------------------------------------------
guest_width(w) Guest width in octets (either 4 or 8).
pt_levels(ptl) Number of page table levels (either 3 or 4).options (o) Bit 0: 0 - no
VMASST_pae_extended_cr3,
1 -VMASST_pae_extended_cr3.Bit 1-7: Reserved.
--------------------------------------------------------------------P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]The P2M record contains a portion of the source domain's P2M. Multiple P2M records may be sent if the source P2M changes during the stream.
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
|pfn_begin|
+-------------------------------------------------+
|pfn_end|
+-------------------------------------------------+
| mfn[0] |
+-------------------------------------------------+
...
+-------------------------------------------------+
| mfn[N-1] |
+-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
pfn_beginThe first PFN in this portion of the P2M
pfn_endOne past the last PFN in this portion of the P2M.mfn Array of (
pfn_end- pfn-begin) MFNs corresponding to
the set of PFNs in the range [pfn_begin,pfn_end).
--------------------------------------------------------------------Layout
======The set of valid records depends on the guest architecture and type.
x86 PV Guest
------------An x86 PV guest image will have in this order:
1. Image header
2. Domain header
3.X86_PV_INFOrecord
4. At least one P2M record
5. At least onePAGE_DATArecord6.
VCPU_INFOrecord
6. At least oneVCPU_CONTEXTrecord7. END record
There seems to be a bunch of info missing. Here are some missing elements that I can recall at the moment:
a) there is no support for sending over one time markers that switch the receiver's operating mode in the middle of a data stream. E.g.,XC_SAVE_ENABLE_COMPRESSION,XC_SAVE_ID_LAST_CHECKPOINT, etc.XC_SAVE_ENABLE_VERIFY_MODE,b) in pv case, the tail also has a list of unmapped PFNs at the end of every iteration.
c)
XC_SAVE_ID_TOOLSTACK-- used by xl to pass device context information (generally
for HVMs).Legacy Images (x86 only)
========================Restoring legacy images from older tools shall be handled by translating the legacy format image into this new format.
It shall not be possible to save in the legacy format.
There are two different legacy images depending on whether they were generated by a 32-bit or a 64-bit toolstack. These shall be distinguished by inspecting octets 4-7 in the image. If these are zero then it is a 64-bit image.
Toolstack Field Value
--------- ----- -----
64-bit Bit 31-63 of thep2m_sizefield 0 (sincep2m_size< 2^32^)
32-bit extended-info chunk ID (PV)0xFFFFFFFF
32-bit Chunk type (HVM) < 0
32-bit Page count (HVM) > 0Table: Possible values for octet 4-7 in legacy images
This assumes the presence of the extended-info chunk which was introduced in Xen 3.0.
Future Extensions
=================All changes to this format require the image version to be increased.
The format may be extended by adding additional record types.
Extending an existing record type must be done by adding a new record type. This allows old images with the old record to still be restored.
The image header may be extended by _appending_ additional fields. In particular, the
marker,idandversionfields must never change size or location.
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 144 lines · Andrew Cooper
On 10/02/2014 20:00, Shriram Rajagopalan wrote:
Quoted 37 lines · David Vrabel
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
http://xenbits.xen.org/people/dvrabel/domain-save-format-B.pdf
Introduction
============Revision History
------------------------------------------------------------------------------------
Version Date Changes ------- ----------- ---------------------------------------------- Draft A 6 Feb 2014 Initial draft.Draft B 10 Feb 2014 Corrected image header field widths.
Minor updates and clarifications.
--------------------------------------------------------------------Purpose
-------The
_domainsaveimage_is the context of a running domain used for snapshots of a domain or for transferring domains between hosts during migration.There are a number of problems with the format of the domain save image used in Xen 4.4 and earlier (the
_legacyformat_).* Dependant on toolstack word size. A number of fields within the image are native types such as
unsigned longwhich have different sizes between 32-bit and 64-bit hosts. This prevents domains from being migrated between 32-bit and 64-bit hosts.Quoted 10 lines
* There is no header identifying the image.
* The image has no version information.
A new format that addresses the above is required.
ARM does not yet have have a domain save image format specified and the format described in this specification should be suitable.
I suggest keeping the processing overhead in mind when designing the new
image format. Some key things have been addressed, such as making sure data
is always padded to maintain alignment. But there are also some aspects
of this
proposal that seem awfully unnecessary.. More details below.Quoted 28 lines
Overview
========The image format consists of two main sections:
* _Headers_
* _Records_Headers
-------There are two headers: the
_imageheader_, and the_domainheader_. The image header describes the format of the image (version etc.). The_domainheader_contains general information about the domain (architecture, type etc.).Records
-------The main part of the format is a sequence of different _records_. Each record type contains information about the domain context. At a minimum there is a END record marking the end of the records section.
Fields
------Quoted 8 lines
All the fields within the headers and records have a fixed width.
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
So far so good.
Quoted 8 lines
Integer (numeric) fields in the image header are always in big-endian byte order.
Integer fields in the domain header and in the records are in the endianess described in the image header (which will typically be the native ordering).
Its tempting to adopt all the TCP-style madness for transferring a set
of
structured data. Why this endian-ness mess? Am I missing something here? I am assuming that a lion's share of Xen's deployment is on x86 (not including Amazon). So that leaves ARM. Why not let these processors take the hit of endian-ness conversion?The large majority is indeed x86, but don't discount ARM because it is currently in the minority. With the current requirements, the vast majority of the data will still be little endian on x86.
Headers
Quoted 14 lines
=======
Image Header
------------The image header identifies an image as a Xen domain save image. It includes the version of this specification that the image complies with.
Tools supporting version _V_ of the specification shall always save images using version _V_. Tools shall support restoring from version _V_ and version _V_ - 1. Tools may additionally support restoring from earlier versions.
Quoted 7 lines
The marker field can be used to distinguish between legacy images and those corresponding to this specification. Legacy images will have at one or more zero bits within the first 8 octets of the image.
Fields within the image header are always in _big-endian_ byte order, regardless of the setting of the endianness bit.
Quoted 8 lines
and more endian-ness mess.
Network order is perfectly valid. Is is how all your network packets arrive...
True. But why should we explicitly convert the application level data to network byte order and then convert it back to host byte order, when its already going to be done by the underlying stack, as you put it?
Quoted 91 lines
Quoted 64 lines
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
| marker |
+-----------------------+-------------------------+
| id | version |
+-----------+-----------+-------------------------+
| options | |
+-----------+-------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
marker0xFFFFFFFFFFFFFFFF.id
0x58454E46("XENF" in ASCII).version
0x00000001. The version of this specification.options bit 0: Endianness. 0 = little-endian, 1 = big-endian.
bit 1-15: Reserved.--------------------------------------------------------------------
Domain Header
-------------The domain header includes general properties of the domain.
0 1 2 3 4 5 6 7 octet
+-----------+-----------+-----------+-------------+
| arch | type | page_shift| (reserved) |
+-----------+-----------+-----------+-------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.type
0x0000: Reserved.0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved.
page_shiftSize of a guest page as a power of two.i.e., page size = 2^page_shift^.--------------------------------------------------------------------
Records
=======A record has a record header, type specific data and a trailing footer. If
body_lengthis not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary.Quoted 15 lines
0 1 2 3 4 5 6 7 octet +-----------------------+-------------------------+ | type | body_length | +-----------+-----------+-------------------------+ | options | (reserved) | +-----------+-------------------------------------+ ... Record body of length body_length octets followed by 0 to 7 octets of padding. ... +-----------------------+-------------------------+ | checksum | (reserved) | +-----------------------+-------------------------+I am assuming that you the checksum field is present only
for debugging purposes? Otherwise, I see no reason for the computational overhead, given that we are already sending data over a reliable channel + IIRC we already have an image-wide checksum when saving the image to disk.If debugging is the only use case, then I guess, the type field
can be prefixed with a 1/0 bit, eliminating the need for the 1-bit checkum options field + 7-byte padding. Similarly, if debugging mode is not set, why waste another 8 bytes in the end for the checksum field.
Quoted 8 lines
Unless you think there may be more types with need of special options,
Feel free to correct me if I am missing something elementary here..
What image-wide checksum?
May be I got it wrong. I vaguely recall some sort of a crc checksum being stored along with
the saved memory snapshots. But that could have been someone else's research code. Sorry..
Quoted 2 lines
Are you certain that all your data is moving over reliable channels?
Lets see.. Am I certain that all migration is happening over TCP ? yes. Worst case reliable UDP.
By reliable, I just mean no bit errors or such stuff. I am not talking about security.
Quoted 2 lines
Are you certain that your hard drives are bit perfect.
Absolutely not. Which is why I was under the impression that the image wide checksum
would detect a corrupt image.
Are you certain that your network connection is bit perfect?
Quoted 2 lines
Nope. But I am fairly certain that good old TCP and IP checksums + the ethernet's checksum have
been put in place to detect these errors and recover transparent to the application. Are you are implying
that there is some remote corner case that allows corrupt data to escape all of these three checks in
the network stack and percolate to the application layer? I don't think so.
If you are implying that the DRAMs cause memory bit errors that flip bits here and here, wreaking havoc,
then probably yes, checksums make sense. However, with ECC memory modules being the norm (please
correct me if I wrong about this), why start bothering now, if we didn't over the last 3 years? What has changed?
My point here being, checksums seem like unnecessary compute overhead when doing live migration
or Remus. One can simply set this field to 0 when doing live migration/Remus.
And, as you said later in this mail, data transmission overhead is not that much.
However, as far as storing snapshots in disks is concerned, I totally agree that there needs to be some
form of a checksum to ensure that the data has not been corrupted. But why have record-level checksums?
It is not as if we can recover the corrupted records. Majority of the use cases are, IMO, do or die. If checksum
is correct, then start the restore process. Else abort. So why not have an image wide checksum?
Quoted 4 lines
Given the amount of data sent as part of a migration, 8 bytes per record
is not a substantial overhead.
thanks
shriram
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 3 lines · David Vrabel
It
does not currently cover all use cases (e.g., images for HVM guest are not considered).
Other currently missing cases:
* live migration
* remus
* page compression
* ...?
I think it is useful to enumerate them, and if necessary to note which ones you aren't planning to consider in the immediate future.
Quoted 6 lines
Headers
=======Image Header
------------
Quoted 7 lines
The image header identifies an image as a Xen domain save image. It includes the version of this specification that the image complies with.
Tools supporting version _V_ of the specification shall always save images using version _V_. Tools shall support restoring from version _V_ and version _V_ - 1.
This isn't quite right since it is in terms of image format version and not Xen version (unless the two are to be linked somehow). The Xen project supports migration from version X-1 to version X (where X is the Xen version). It's not inconceivable that the image format version wouldn't change over Xen releases.
This might become a more obvious issue once you add HVM to the spec and introduce the necessary Xen HVM save state block.
Quoted 24 lines
Tools may additionally support restoring from earlier versions.
The marker field can be used to distinguish between legacy images and those corresponding to this specification. Legacy images will have at one or more zero bits within the first 8 octets of the image.
Fields within the image header are always in _big-endian_ byte order, regardless of the setting of the endianness bit.
0 1 2 3 4 5 6 7 octet
+-------------------------------------------------+
| marker |
+-----------------------+-------------------------+
| id | version |
+-----------+-----------+-------------------------+
| options | |
+-----------+-------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
marker0xFFFFFFFFFFFFFFFF.
Quoted 5 lines
id
0x58454E46("XENF" in ASCII).version
0x00000001. The version of this specification.options bit 0: Endianness. 0 = little-endian, 1 = big-endian.
Couldn't we just specify that things are in a specific endianness related to the header's arch field?
I appreciate the desire to make the format endian neutral and explicit about which is in use but (apart from the header) why would you ever want to go non-native endian for a given arch?
Quoted 22 lines
bit 1-15: Reserved.--------------------------------------------------------------------
Domain Header
-------------The domain header includes general properties of the domain.
0 1 2 3 4 5 6 7 octet
+-----------+-----------+-----------+-------------+
| arch | type | page_shift| (reserved) |
+-----------+-----------+-----------+-------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.
Quoted 5 lines
type
0x0000: Reserved.0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved.
Is the type field per-arch? i.e. if arch=0x0002 can we use type = 0x0001 for ARM domains?
Quoted 3 lines
page_shiftSize of a guest page as a power of two.i.e., page size = 2^page_shift^.
This doesn't really need 16 bits, no harm though I suppose.
Quoted 41 lines
--------------------------------------------------------------------
Records
=======A record has a record header, type specific data and a trailing footer. If
body_lengthis not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary.0 1 2 3 4 5 6 7 octet +-----------------------+-------------------------+ | type | body_length | +-----------+-----------+-------------------------+ | options | (reserved) | +-----------+-------------------------------------+ ... Record body of length body_length octets followed by 0 to 7 octets of padding. ... +-----------------------+-------------------------+ | checksum | (reserved) | +-----------------------+-------------------------+--------------------------------------------------------------------
Field Description ----------- ------------------------------------------------------- type 0x00000000: END0x00000001: PAGE_DATA 0x00000002: VCPU_INFO 0x00000003: VCPU_CONTEXT 0x00000004: X86_PV_INFO 0x00000005: P2M 0x00000006 - 0xFFFFFFFF: Reserved
Quoted 8 lines
body_lengthLength in octets of the record body.options Bit 0: 0 - checksum invalid, 1 = checksum valid.
Bit 1-15: Reserved.checksum CRC-32 checksum of the record body (including any trailing
padding), or 0x00000000 if the checksum field is invalid.
Which CRC-32 :-P
(wikipedia claims there are 6 variants using various polynomials...)
Quoted 5 lines
P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]
What is the latter for again?
I don't know if it really fits into this spec, but it might be useful to include the rationale for the inclusion of each record type.
Quoted 23 lines
PAGE_DATA
---------The bulk of an image consists of many
PAGE_DATArecords containing the memory contents.0 1 2 3 4 5 6 7 octet +-----------------------+-------------------------+ | count (C) | (reserved) | +-----------------------+-------------------------+ | pfn[0] | +-------------------------------------------------+ ... +-------------------------------------------------+ | pfn[C-1] | +-------------------------------------------------+ | page_data[0]... | ... +-------------------------------------------------+ | page_data[N-1]... | ... +-------------------------------------------------+
Quoted 7 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
Now might be a good time to remove this intertwining? I suppose 60-bits is a lot of pfn's, but if the VMs address space is sparse it isn't out of the question.
It might be useful to be explicit (perhaps in a glossary) about what you mean by "PFN" for various guest types -- some of the terminology can be a bit confused in actual usage between the various guest types, including in some of the existing interface definitions.
Quoted 10 lines
Layout
======The set of valid records depends on the guest architecture and type.
x86 PV Guest
------------An x86 PV guest image will have in this order:
Quoted 8 lines
1. Image header
2. Domain header
3.X86_PV_INFOrecord
4. At least one P2M record
5. At least onePAGE_DATArecord
6.VCPU_INFOrecord
6. At least oneVCPU_CONTEXTrecord
7. END record
It might be good to be more flexible in the ordering (or rather, less prescriptive here), unless there is a reason for a strict ordering i.e. dependencies between records.
For example it seems like the p2m cannot change after you start sending page_data, which I don't think works for live migration (although I'm not sure you've yet incorporated that as a feature).
Ian.
Quoted 10 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Fields
------All the fields within the headers and records have a fixed width.
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
Meaning it would be impossible to assign a meaning to these fields later. I'd rather mandate that the restore side has to check these fields are zero, and bail if they aren't.
Quoted 2 lines
Integer (numeric) fields in the image header are always in big-endian byte order.
Why would big endian be preferable when both currently supported architectures use little endian?
Quoted 19 lines
Domain Header
-------------The domain header includes general properties of the domain.
0 1 2 3 4 5 6 7 octet
+-----------+-----------+-----------+-------------+
| arch | type | page_shift| (reserved) |
+-----------+-----------+-----------+-------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.
Quoted 5 lines
type
0x0000: Reserved.0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved.
So how would ARM, x86 HVM, and x86 PVH be expressed?
Quoted 23 lines
P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]The P2M record contains a portion of the source domain's P2M. Multiple P2M records may be sent if the source P2M changes during the stream.
0 1 2 3 4 5 6 7 octet +-------------------------------------------------+ | pfn_begin | +-------------------------------------------------+ | pfn_end | +-------------------------------------------------+ | mfn[0] | +-------------------------------------------------+ ... +-------------------------------------------------+ | mfn[N-1] | +-------------------------------------------------+
Quoted 6 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------pfn_beginThe first PFN in this portion of the P2M
pfn_endOne past the last PFN in this portion of the P2M.
I'd favor an inclusive range here, such that if we ever reach a fully populatable 64-bit PFN space (on some future architecture) there'd still be no issue with special casing the then unavoidable wraparound.
Quoted 10 lines
Layout
======The set of valid records depends on the guest architecture and type.
x86 PV Guest
------------An x86 PV guest image will have in this order:
Quoted 8 lines
1. Image header
2. Domain header
3.X86_PV_INFOrecord
4. At least one P2M record
5. At least onePAGE_DATArecord
6.VCPU_INFOrecord
6. At least oneVCPU_CONTEXTrecord
7. END record
Is it necessary to require this strict ordering? Obviously the headers have to be first and the END record last, but at least some of the other records don't seem to need to be at exactly the place you list them.
Quoted 8 lines
Legacy Images (x86 only)
========================Restoring legacy images from older tools shall be handled by translating the legacy format image into this new format.
It shall not be possible to save in the legacy format.
Quoted 8 lines
There are two different legacy images depending on whether they were generated by a 32-bit or a 64-bit toolstack. These shall be distinguished by inspecting octets 4-7 in the image. If these are zero then it is a 64-bit image.
Toolstack Field Value --------- ----- ----- 64-bit Bit 31-63 of the p2m_size field 0 (since p2m_size < 2^32^)
Afaics this is being determined via xc_domain_maximum_gpfn(), which I don't think guarantees the result to be limited to 2^32. Or in fact the libxc interface wrongly limits the value (by truncating the "long" returned from the hypercall to an "int"). So in practice consistent images would have the field limited to 2^31 on 64-bit tool stacks (since for larger values the negative function return value would get converted by sign-extension, but all sorts of other trouble would result due to the now huge p2m_size).
Quoted 4 lines
Future Extensions
=================All changes to this format require the image version to be increased.
Oh, okay, this partly deals with the first question above. Question is whether that's a useful requirement, i.e. whether that wouldn't lead to an inflation of versions needing conversion (for a tool stack that wants to support more than just migration from N-1).
Jan
Quoted 20 lines · Shriram Rajagopalan
On Mon, Feb 10, 2014 at 7:35 PM, Andrew Cooper
Quoted 6 lines
The marker field can be used to distinguish between legacy images and
those corresponding to this specification. Legacy images will have at
one or more zero bits within the first 8 octets of the image.Quoted 6 lines
Fields within the image header are always in _big-endian_ byte order,
regardless of the setting of the endianness bit.and more endian-ness mess.
Network order is perfectly valid. Is is how all your network packets arrive...
Quoted 3 lines
True. But why should we explicitly convert the application level data to network byte order and then convert it back to host byte order, when its already going to be done by the underlying stack, as you put it?
TCP doesn't change the byte order of the payload, only header fields are defined to be in big endian, AFAIK.
Zoli
Quoted 11 lines · Ian Campbell
Quoted 4 lines · David Vrabel
Tools supporting version _V_ of the specification shall always save images using version _V_. Tools shall support restoring from version _V_ and version _V_ - 1.
This isn't quite right since it is in terms of image format version and not Xen version (unless the two are to be linked somehow). The Xen project supports migration from version X-1 to version X (where X is the Xen version). It's not inconceivable that the image format version wouldn't change over Xen releases.
I was expecting it to be only necessary to bump the format version with each Xen x.y release but I think you're right. It may be needed to bump the version of a x.y.z release.
Quoted 9 lines
Quoted 9 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
marker0xFFFFFFFFFFFFFFFF.id
0x58454E46("XENF" in ASCII).version
0x00000001. The version of this specification.
Quoted 8 lines
Quoted 1 line
options bit 0: Endianness. 0 = little-endian, 1 = big-endian.
Couldn't we just specify that things are in a specific endianness related to the header's arch field?
I appreciate the desire to make the format endian neutral and explicit about which is in use but (apart from the header) why would you ever want to go non-native endian for a given arch?
I am anticipating bi-endian architectures which could mean (for example) migrating a little-endian guest from a little-endian host to a big-endian host.
I would prefer to retain this bit, but I think we can specify that certain architectures always use a specific endianness so initially we wouldn't need to support anything other than the native endianness (little-endian on both x86 and ARM).
Quoted 9 lines
Quoted 9 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.
Quoted 8 lines
Quoted 5 lines
type
0x0000: Reserved.0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved.Is the type field per-arch? i.e. if arch=0x0002 can we use type =
0x0001for ARM domains?
I think it would be best to avoid reusing types for different architectures -- it's not like we're going to be short on types.
Quoted 8 lines
Quoted 5 lines
P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]What is the latter for again?
Er. I think I've misunderstood the code and gotten confused here.
Quoted 11 lines
Quoted 7 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.Now might be a good time to remove this intertwining? I suppose 60-bits is a lot of pfn's, but if the VMs address space is sparse it isn't out of the question.
I don't think we want to consider systems with > 64 bits of address space so 60-bits is more than enough for PFNs.
David
Quoted 9 lines · Shriram Rajagopalan
On Mon, Feb 10, 2014 at 9:20 AM, David Vrabel <[email protected] <mailto:[email protected]>> wrote:
Its tempting to adopt all the TCP-style madness for transferring a set of structured data. Why this endian-ness mess? Am I missing something here? I am assuming that a lion's share of Xen's deployment is on x86 (not including Amazon). So that leaves ARM. Why not let these processors take the hit of endian-ness conversion?
I'm not sure I would characterize a spec being precise about byte ordering as "endianness mess".
I think it would be a pretty poor specification if it didn't specify byte ordering -- we can't have the tools having to make assumptions about the ordering.
However, I do think it can be specified in such a way that all the current use cases don't have to do any byte swapping (except for the minimal header).
Quoted 10 lines
+-----------------------+-------------------------+ | checksum | (reserved) | +-----------------------+-------------------------+I am assuming that you the checksum field is present only for debugging purposes? Otherwise, I see no reason for the computational overhead, given that we are already sending data over a reliable channel + IIRC we already have an image-wide checksum when saving the image to disk.
I'm not aware of any image wide checksum.
The checksum seems like a potentially useful feature but I don't have a requirement for it so if no one else thinks it is useful it can be removed.
Quoted 2 lines
PAGE_DATA
---------[...]
Quoted 8 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
Quoted 7 lines
page_datapage_sizeoctets of uncompressed page contents for each page
set as present in the pfn array.
--------------------------------------------------------------------s/uncompressed/(compressed/uncompressed)/
(Remus sends compressed data)
No. I think compressed page data should have its own record type. The current scheme of mode flipping records seems crazy to me.
Quoted 17 lines
x86 PV Guest
------------An x86 PV guest image will have in this order:
1. Image header
2. Domain header
3.X86_PV_INFOrecord
4. At least one P2M record
5. At least onePAGE_DATArecord6.
VCPU_INFOrecord
6. At least oneVCPU_CONTEXTrecord7. END record
Quoted 6 lines
There seems to be a bunch of info missing. Here are some missing elements that I can recall at the moment:
a) there is no support for sending over one time markers that switch the receiver's operating mode in the middle of a data stream. E.g.,XC_SAVE_ENABLE_COMPRESSION,XC_SAVE_ID_LAST_CHECKPOINT, etc.XC_SAVE_ENABLE_VERIFY_MODE,
Yes. As I noted, this specification is not yet complete.
David
Quoted 13 lines · David Vrabel
Quoted 11 lines · Ian Campbell
Quoted 4 lines · David Vrabel
Tools supporting version _V_ of the specification shall always save images using version _V_. Tools shall support restoring from version _V_ and version _V_ - 1.
This isn't quite right since it is in terms of image format version and not Xen version (unless the two are to be linked somehow). The Xen project supports migration from version X-1 to version X (where X is the Xen version). It's not inconceivable that the image format version wouldn't change over Xen releases.
Quoted 3 lines
I was expecting it to be only necessary to bump the format version with each Xen x.y release but I think you're right. It may be needed to bump the version of a x.y.z release.
We try very hard to avoid that (i.e. changing the save format in a stable branch) actually.
What I meant was:
Xen = 4.5, V = 1 Xen = 4.6, V = 1 (nothing changed in the save file spec for 4.5) Xen = 4.7, V = 2
The spec with it's current wording about V would seem to say the Xen 4.7 must support migration from Xen 4.5, which is not the case.
For HVM support there are going to be (at least) two additional record types "opaque blob of Xen state" and "opaque blob of qemu state". It is very unlikely that anyone will remember to bump V in the tools when changing those.
I think the solution is to also include the Xen version in the header, as well as the "file format" version V. You could do this as part of the header of those opaque blobs, but it might be better in the actual overall headers (/as well).
I've no idea how to deal with the qemu blob -- but I think qemu upstream has been working to make cross version migration work better, so maybe it isn't a problem any more.
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
marker0xFFFFFFFFFFFFFFFF.id
0x58454E46("XENF" in ASCII).version
0x00000001. The version of this specification.options bit 0: Endianness. 0 = little-endian, 1 = big-endian.
Couldn't we just specify that things are in a specific endianness related to the header's arch field?
Quoted 7 lines
Quoted 3 lines
I appreciate the desire to make the format endian neutral and explicit about which is in use but (apart from the header) why would you ever want to go non-native endian for a given arch?
I am anticipating bi-endian architectures which could mean (for example) migrating a little-endian guest from a little-endian host to a big-endian host.
It's possible that this would end up looking like a totally separate arch anyway (cf "armbe"), not just at the save format level, but at the hypercall and PVIO layers too.
Quoted 4 lines
I would prefer to retain this bit, but I think we can specify that certain architectures always use a specific endianness so initially we wouldn't need to support anything other than the native endianness (little-endian on both x86 and ARM).
I think that makes sense initially.
It's always a bit tricky with a spec to separate the notion of what is possible within the spec from what you actually intend to implement now.
Perhaps a reasonable compromise is to document a requirement that savers populate this field accurately but only require restorers to support their nativeness (leaving anything further as optional).
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.type
0x0000: Reserved.0x0001: x86 PV.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
0x0002 - 0xFFFF: Reserved.Is the type field per-arch? i.e. if arch=0x0002 can we use type =
0x0001for ARM domains?I think it would be best to avoid reusing types for different architectures -- it's not like we're going to be short on types.
Any reason not to combine the arch+type into a single field then?
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
Quoted 6 lines
Quoted 3 lines
Now might be a good time to remove this intertwining? I suppose 60-bits is a lot of pfn's, but if the VMs address space is sparse it isn't out of the question.
I don't think we want to consider systems with > 64 bits of address space so 60-bits is more than enough for PFNs.
Is it? What about systems with 61..63 bits of address space?
Ian.
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Fields
------All the fields within the headers and records have a fixed width.
Quoted 8 lines
Quoted 4 lines
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
Meaning it would be impossible to assign a meaning to these fields later. I'd rather mandate that the restore side has to check these fields are zero, and bail if they aren't.
Reserved fields/bits can be used but it would require a new record type and a bump of the format version.
I was aiming to minimize the number of ways the format can be extended.
Quoted 5 lines
Quoted 2 lines
Integer (numeric) fields in the image header are always in big-endian byte order.
Why would big endian be preferable when both currently supported architectures use little endian?
Mostly to encourage tools to pay attention to byte order rather than assuming native and getting away with it...
Quoted 19 lines
Quoted 19 lines
Domain Header
-------------The domain header includes general properties of the domain.
0 1 2 3 4 5 6 7 octet
+-----------+-----------+-----------+-------------+
| arch | type | page_shift| (reserved) |
+-----------+-----------+-----------+-------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.
Quoted 7 lines
Quoted 5 lines
type
0x0000: Reserved.0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved.So how would ARM, x86 HVM, and x86 PVH be expressed?
Something like:
0x0001: x86 PV.
0x0002: x86 HVM.
0x0003: x86 PVH.
0x0004: ARM.
Which does make the arch field a bit redundant, I suppose.
Quoted 28 lines
Quoted 28 lines
P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]The P2M record contains a portion of the source domain's P2M. Multiple P2M records may be sent if the source P2M changes during the stream.
0 1 2 3 4 5 6 7 octet +-------------------------------------------------+ | pfn_begin | +-------------------------------------------------+ | pfn_end | +-------------------------------------------------+ | mfn[0] | +-------------------------------------------------+ ... +-------------------------------------------------+ | mfn[N-1] | +-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------pfn_beginThe first PFN in this portion of the P2M
Quoted 6 lines
Quoted 1 line
pfn_endOne past the last PFN in this portion of the P2M.I'd favor an inclusive range here, such that if we ever reach a fully populatable 64-bit PFN space (on some future architecture) there'd still be no issue with special casing the then unavoidable wraparound.
Ok, but 64-bit PFN space would suggest 76 bit of address space which seems somewhat far off. Is that something we want to consider now?
Quoted 17 lines
Quoted 8 lines
Legacy Images (x86 only)
========================Restoring legacy images from older tools shall be handled by translating the legacy format image into this new format.
It shall not be possible to save in the legacy format.
Quoted 8 lines
There are two different legacy images depending on whether they were generated by a 32-bit or a 64-bit toolstack. These shall be distinguished by inspecting octets 4-7 in the image. If these are zero then it is a 64-bit image.
Toolstack Field Value --------- ----- ----- 64-bit Bit 31-63 of the p2m_size field 0 (since p2m_size < 2^32^)
Quoted 8 lines
Afaics this is being determined via
xc_domain_maximum_gpfn(), which I don't think guarantees the result to be limited to 2^32. Or in fact the libxc interface wrongly limits the value (by truncating the "long" returned from the hypercall to an "int"). So in practice consistent images would have the field limited to 2^31 on 64-bit tool stacks (since for larger values the negative function return value would get converted by sign-extension, but all sorts of other trouble would result due to the now hugep2m_size).
For the handling of legacy images I think we need to only consider images that could have been practically generated by older tools.
Quoted 9 lines
Quoted 4 lines
Future Extensions
=================All changes to this format require the image version to be increased.
Oh, okay, this partly deals with the first question above. Question is whether that's a useful requirement, i.e. whether that wouldn't lead to an inflation of versions needing conversion (for a tool stack that wants to support more than just migration from N-1).
Only legacy images would be converted to the newest format. I would expect version V-1 images would be handled by (mostly) the same code as V images. Particularly if V is V-1 with extra record types.
David
Quoted 12 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 10 lines · David Vrabel
Quoted 9 lines · Ian Campbell
Quoted 7 lines · David Vrabel
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Now might be a good time to remove this intertwining? I suppose 60-bits is a lot of pfn's, but if the VMs address space is sparse it isn't out of the question.
I don't think we want to consider systems with > 64 bits of address space so 60-bits is more than enough for PFNs.
Is it? What about systems with 61..63 bits of address space?
Their PFNs would, assuming 4k page size, still only be 49..51 bits wide.
That said - if reasonably cleanly doable within such a revised save image format, I would second Ian's desire to split the type from the PFN. Not so much because of limited PFN space, but because of the chance of needing to introduce further types, requiring more than 4 bits.
Jan
Quoted 14 lines · Ian Campbell
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--------------------------------------------------------------------
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Field Description
-------------------------------------------------------------------
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
count Number of pages described in this record.
pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.Now might be a good time to remove this intertwining? I suppose
60-bits
Quoted 8 lines
Quoted 1 line
Quoted 1 line
is a lot of pfn's, but if the VMs address space is sparse it isn't
out
Quoted 4 lines
Quoted 1 line
of the question.
I don't think we want to consider systems with > 64 bits of address space so 60-bits is more than enough for PFNs.
Is it? What about systems with 61..63 bits of address space?
Nevermind, another reply in the thread reminded me that these are PFNs, so 64-bit PFN == 72 bits of address space.
Although, perhaps it would be better to spec this as nibble and a 60-bit field rather than by pretending the top of a 64-bit field is special.
(or an octet and a 7 octet field if you prefer)
Ian.
Quoted 28 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 26 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Domain Header
-------------The domain header includes general properties of the domain.
0 1 2 3 4 5 6 7 octet
+-----------+-----------+-----------+-------------+
| arch | type | page_shift| (reserved) |
+-----------+-----------+-----------+-------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
arch0x0000: Reserved.0x0001: x86. 0x0002: ARM.type
0x0000: Reserved.0x0001: x86 PV. 0x0002 - 0xFFFF: Reserved.
Quoted 8 lines
Quoted 1 line
So how would ARM, x86 HVM, and x86 PVH be expressed?
Something like:
0x0001: x86 PV.
0x0002: x86 HVM.
0x0003: x86 PVH.
0x0004: ARM.
Ah, so the list above wasn't meant to be exhaustive (for the current set of things to care about).
Quoted 1 line
Which does make the arch field a bit redundant, I suppose.
Indeed.
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]The P2M record contains a portion of the source domain's P2M. Multiple P2M records may be sent if the source P2M changes during the stream.
0 1 2 3 4 5 6 7 octet +-------------------------------------------------+ | pfn_begin | +-------------------------------------------------+ | pfn_end | +-------------------------------------------------+ | mfn[0] | +-------------------------------------------------+ ... +-------------------------------------------------+ | mfn[N-1] | +-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------pfn_beginThe first PFN in this portion of the P2M
pfn_endOne past the last PFN in this portion of the P2M.
Quoted 7 lines
Quoted 4 lines
I'd favor an inclusive range here, such that if we ever reach a fully populatable 64-bit PFN space (on some future architecture) there'd still be no issue with special casing the then unavoidable wraparound.
Ok, but 64-bit PFN space would suggest 76 bit of address space which seems somewhat far off. Is that something we want to consider now?
If it's as cheap as using an inclusive range instead of a half-inclusive one, I'd say yes.
Quoted 26 lines
Quoted 17 lines
Quoted 8 lines
Legacy Images (x86 only)
========================Restoring legacy images from older tools shall be handled by translating the legacy format image into this new format.
It shall not be possible to save in the legacy format.
Quoted 8 lines
There are two different legacy images depending on whether they were generated by a 32-bit or a 64-bit toolstack. These shall be distinguished by inspecting octets 4-7 in the image. If these are zero then it is a 64-bit image.
Toolstack Field Value --------- ----- ----- 64-bit Bit 31-63 of the p2m_size field 0 (since p2m_size < 2^32^)Quoted 8 lines
Afaics this is being determined via
xc_domain_maximum_gpfn(), which I don't think guarantees the result to be limited to 2^32. Or in fact the libxc interface wrongly limits the value (by truncating the "long" returned from the hypercall to an "int"). So in practice consistent images would have the field limited to 2^31 on 64-bit tool stacks (since for larger values the negative function return value would get converted by sign-extension, but all sorts of other trouble would result due to the now hugep2m_size).
Quoted 2 lines
For the handling of legacy images I think we need to only consider images that could have been practically generated by older tools.
Right. That's what I meant to say with everything following the first sentence.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Future Extensions
=================All changes to this format require the image version to be increased.
Quoted 8 lines
Quoted 4 lines
Oh, okay, this partly deals with the first question above. Question is whether that's a useful requirement, i.e. whether that wouldn't lead to an inflation of versions needing conversion (for a tool stack that wants to support more than just migration from N-1).
Only legacy images would be converted to the newest format. I would expect version V-1 images would be handled by (mostly) the same code as V images. Particularly if V is V-1 with extra record types.
Just consider distros, namely such that have a lower release frequency than we. They'd necessarily want to cover at least the range between their V'-1 and V', which could just end up being V-2 ... V from Xen pov, but - especially if we were to further shorten the release cycle - could easily become a larger range.
Jan
Quoted 12 lines · David Vrabel
Quoted 6 lines · Shriram Rajagopalan
On Mon, Feb 10, 2014 at 9:20 AM, David Vrabel <[email protected] <mailto:[email protected]>> wrote:
Its tempting to adopt all the TCP-style madness for transferring a set of structured data. Why this endian-ness mess? Am I missing something
here?
Quoted 3 lines
I am assuming that a lion's share of Xen's deployment is on x86 (not including Amazon). So that leaves ARM. Why not let these processors take the hit of endian-ness conversion?
Quoted 8 lines
I'm not sure I would characterize a spec being precise about byte ordering as "endianness mess".
I think it would be a pretty poor specification if it didn't specify byte ordering -- we can't have the tools having to make assumptions about the ordering.
Totally agree. But as someone else put it (and you did as well), my point was
that its sufficient to specify it once, somewhere in the image header and making
sure that (as you put it below), that the current use cases don't have to go through
needless endian conversion.
Quoted 9 lines
However, I do think it can be specified in such a way that all the current use cases don't have to do any byte swapping (except for the minimal header).
Quoted 5 lines
+-----------------------+-------------------------+ | checksum | (reserved) | +-----------------------+-------------------------+
Quoted 8 lines
Quoted 5 lines
I am assuming that you the checksum field is present only for debugging purposes? Otherwise, I see no reason for the computational overhead, given that we are already sending data over a reliable channel + IIRC we already have an image-wide checksum when saving the image to disk.
I'm not aware of any image wide checksum.
Yep. I was mistaken.
Quoted 4 lines
The checksum seems like a potentially useful feature but I don't have a requirement for it so if no one else thinks it is useful it can be removed.
My suggestion is that when saving the image to disk, why not have a single image-wide checksum to ensure that the image from disk being restored is still valid?
Quoted 17 lines
Quoted 2 lines
PAGE_DATA ---------[...]
Quoted 9 lines
--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------
count Number of pages described in this record.pfn An array of count PFNs. Bits 63-60 contain
the XEN\_DOMCTL\_PFINFO_* value for that PFN.
page_datapage_sizeoctets of uncompressed page contents for eachpage
Quoted 4 lines
set as present in the pfn array.
--------------------------------------------------------------------
Quoted 7 lines
Quoted 2 lines
s/uncompressed/(compressed/uncompressed)/
(Remus sends compressed data)No. I think compressed page data should have its own record type. The current scheme of mode flipping records seems crazy to me.
What record flipping? For page compression, Remus basically has a simple XOR+RLE encoded sequence of bytes, preceded by a 4-byte length field. Instead of sending the usual 4K per-page page_data, this compressed chunk is sent.
The additional code on the remote side is an additional "if" block, that uses
xc_uncompess instead of memcpy to get the uncompressed page.
It would not change the way the PAGE_DATA record would be transmitted.
Though, one potentially cooler addition could be to use the option field of the record header
to indicate whether the data is compressed or not. Given that we have 64 bits, we could even
go as far as specifying the type of compression module used (e.g., none, remus, gzip, etc.).
This might be really helpful when one wants to save/restore large images (a 8GB VM for example)
to/from disks. Is this better/worse than simply gzipping the entire saved image? I don't know yet.
However, for live migration, this would be pretty helpful (especially when migrating over long latency
networks). Remus' compression technique cannot be used for live migration as it requires a previous
version of pages for XOR+RLE compression. However, gzip and other such compression algorithms
would be pretty handy in the live migration case, over WAN or even a clogged LAN, where there
are tons of VMs being moved back and forth.
Feel free to shoot down this idea if it seems unfeasible.
Thanks
shriram
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
David Vrabel writes ("Domain Save Image Format proposal (draft B)"):
Quoted 13 lines
Records
=======A record has a record header, type specific data and a trailing footer. If
body_lengthis not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary.0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
| type |body_length|
+-----------+-----------+-------------------------+
| options | (reserved) |
+-----------+-------------------------------------+
...
Quoted 1 line
options Bit 0: 0 - checksum invalid, 1 = checksum valid.
There needs to be a flag saying what the receiver should do if it sees a record it doesn't understand. There are two possible behaviours:
ignore the record, and abandon the restore attempt.
Quoted 6 lines
VCPU_INFO
---------Quoted 2 lines
[ This is a combination of parts of the extended-info and
XC_SAVE_ID_VCPU_INFOchunks. ]
Quoted 7 lines
The
VCPU_INFOrecord includes the maximum possible VCPU ID. This will be followed aVCPU_CONTEXTrecord for each online VCPU.0 1 2 3 4 5 6 7 octet
+-----------------------+------------------------+
|max_vcpu_id| (reserved) |
+-----------------------+------------------------+
For ease of extensibility, it might be worth saying that the VCPU_INFO may contain additional data which should be ignored by receivers that don't understand it.
Quoted 4 lines
Future Extensions
=================All changes to this format require the image version to be increased.
It would be better to have a more fine-grained extensibility mechanism.
Ian.
Jan Beulich writes ("Re: [Xen-devel] Domain Save Image Format proposal (draft B)"):
Quoted 6 lines · David Vrabel
Quoted 5 lines
Fields
------All the fields within the headers and records have a fixed width.
Quoted 8 lines
Quoted 4 lines
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
Meaning it would be impossible to assign a meaning to these fields later. I'd rather mandate that the restore side has to check these fields are zero, and bail if they aren't.
I disagree. It is precisely the fact that they are ignored which makes it possible to assign meaning to them later.
It is easy enough to make old readers bail. What is good about David's spec is the room for enhancement _without_ making old readers bail.
I would like to see is that the version number does not normally need to be incremented. For example, the .deb package format which I designed in 1993 has stayed at version 2.0 even though it has been heavily extended in a number of directions.
Quoted 5 lines
Quoted 2 lines
Integer (numeric) fields in the image header are always in big-endian byte order.
Why would big endian be preferable when both currently supported architectures use little endian?
Because (a) that's Network Byte Order (b) there are convenient functions for dealing with endian-conversion.
Quoted 9 lines
Quoted 8 lines
1. Image header
2. Domain header
3.X86_PV_INFOrecord
4. At least one P2M record
5. At least onePAGE_DATArecord
6.VCPU_INFOrecord
6. At least oneVCPU_CONTEXTrecord
7. END record
Quoted 4 lines
Is it necessary to require this strict ordering? Obviously the headers have to be first and the END record last, but at least some of the other records don't seem to need to be at exactly the place you list them.
It's necessary to define some constraints on the ordering. In practice the receiving implementation may or may not work with all orderings and defining a particular ordering is probably easiest.
Ian.
David Vrabel writes ("Domain Save Image Format proposal (draft B)"):
Quoted 3 lines
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
I think this is a good start. I've made some other comments already.
Quoted 2 lines
Overview
========
I would like to make another perhaps controversial suggestion. We should explicitly specify that the receiver may advertise its capabilities to the sender, so that backwards-migration _can_ be supported if we choose to do so.
In practice I think that means a capability advertisement block. Probably, one bit per version, one bit per record type, etc.
I greatly prefer doing forward-compatibility with new record type enums etc. than with version numbers. Version numbers presuppose a strict global order on all the implementations' capabilities, which is of course not necessarily true in free software.
Ian.
Quoted 14 lines · Ian Jackson
David Vrabel writes ("Domain Save Image Format proposal (draft B)"):
Quoted 7 lines
Records
=======A record has a record header, type specific data and a trailing footer. If
body_lengthis not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary.Quoted 6 lines
0 1 2 3 4 5 6 7 octet
+-----------------------+-------------------------+
| type |body_length|
+-----------+-----------+-------------------------+
| options | (reserved) |
+-----------+-------------------------------------+
Quoted 5 lines
...
Quoted 1 line
options Bit 0: 0 - checksum invalid, 1 = checksum valid.
There needs to be a flag saying what the receiver should do if it sees a record it doesn't understand. There are two possible behaviours:
ignore the record, and abandon the restore attempt.
No need. Any unrecognised records can be safely ignored. Any record which couldn't be ignored would be required to bump the main stream version number at which point the older reader would bail on that basis.
This would allow adding new backward compatible features without breaking older systems, which is the way compatibility is maintained in the current code.
~Andrew
Andrew Cooper writes ("Re: [Xen-devel] Domain Save Image Format proposal (draft B)"):
Quoted 3 lines
No need. Any unrecognised records can be safely ignored. Any record which couldn't be ignored would be required to bump the main stream version number at which point the older reader would bail on that basis.
See my other comment about why I don't like version numbers for forward compatibility in free software.
Ian.
Quoted 29 lines · Ian Jackson
Jan Beulich writes ("Re: [Xen-devel] Domain Save Image Format proposal (draft B)"):
Quoted 6 lines · David Vrabel
Quoted 5 lines
Fields
------All the fields within the headers and records have a fixed width.
Quoted 8 lines
Quoted 4 lines
Fields are always aligned to their size.
Padding and reserved fields are set to zero on save and must be ignored during restore.
Meaning it would be impossible to assign a meaning to these fields later. I'd rather mandate that the restore side has to check these fields are zero, and bail if they aren't.
I disagree. It is precisely the fact that they are ignored which makes it possible to assign meaning to them later.
It is easy enough to make old readers bail. What is good about David's spec is the room for enhancement _without_ making old readers bail.
I would like to see is that the version number does not normally need to be incremented. For example, the .deb package format which I designed in 1993 has stayed at version 2.0 even though it has been heavily extended in a number of directions.
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
Integer (numeric) fields in the image header are always in big-endian byte order.
Why would big endian be preferable when both currently supported architectures use little endian?
Because (a) that's Network Byte Order (b) there are convenient functions for dealing with endian-conversion.
Yes and Yes. But why resort to Network Byte Order at all when we don't have support any architectures using big endian?
Are we thinking of transferring images or migrating data between machines that have
different endian-ness? Its not like network elements such as middleboxes (which could probably be big-endian ) are going to interpret the application
level data and take routing decisions.
I am not that familiar with ARM, but from what I read, its bi-endian past v3.
Don't think we have plans to support SPARC, which too is bi-endian beyond a certain version IIRC.
That leaves legacy ARMs and SPARC that use big endian mode.
So am I missing something elementary here Ian? Why the emphasis on network byte order? I certainly agree that the byte order should be declared once in the header, so that there would be no confusion on how to interpret it.
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
1. Image header
2. Domain header
3.X86_PV_INFOrecord
4. At least one P2M record
5. At least onePAGE_DATArecord
6.VCPU_INFOrecord
6. At least oneVCPU_CONTEXTrecord
7. END recordQuoted 4 lines
Is it necessary to require this strict ordering? Obviously the headers have to be first and the END record last, but at least some of the other records don't seem to need to be at exactly the place you list them.
Quoted 7 lines
It's necessary to define some constraints on the ordering. In practice the receiving implementation may or may not work with all orderings and defining a particular ordering is probably easiest.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 15 lines · Ian Jackson
David Vrabel writes ("Domain Save Image Format proposal (draft B)"):
Quoted 3 lines
Here is a draft of a proposal for a new domain save image format. It does not currently cover all use cases (e.g., images for HVM guest are not considered).
I think this is a good start. I've made some other comments already.
Quoted 2 lines
Overview
========I would like to make another perhaps controversial suggestion. We should explicitly specify that the receiver may advertise its capabilities to the sender, so that backwards-migration _can_ be supported if we choose to do so.
Quoted 7 lines
In practice I think that means a capability advertisement block. Probably, one bit per version, one bit per record type, etc.
I greatly prefer doing forward-compatibility with new record type enums etc. than with version numbers. Version numbers presuppose a strict global order on all the implementations' capabilities, which is of course not necessarily true in free software.
I think I quite like this idea. There would still need to be a central repository of record types.
David
Quoted 2 lines · Shriram Rajagopalan
I am not that familiar with ARM, but from what I read, its bi-endian past v3.
Modern ARMs can still do big endian, and are sometimes used that way too.
I expect that this would be expressed as a new guest arch/type (ARMBE) though.
But there's nothing wrong per-se with having the endianness of an image be explicit in the file formats header, even if it is a bit redundant.
Note that the initial header has to be in some fixed endianness, but it's a small handful of bytes which only occurs once, I don't think the byte swapping is an issue there.
Ian.
David Vrabel writes ("Re: Domain Save Image Format proposal (draft B)"):
Quoted 8 lines · Ian Jackson
Quoted 4 lines
I greatly prefer doing forward-compatibility with new record type enums etc. than with version numbers. Version numbers presuppose a strict global order on all the implementations' capabilities, which is of course not necessarily true in free software.
I think I quite like this idea. There would still need to be a central repository of record types.
Right.
One thing you can do is like PNG and have separate ranges of record type numbers for (a) ok to ignore this if not understood and (b) fatal if not understood.
I think PNG also has subset of the namespace for "private use".
Ian.
Ian Campbell writes ("Re: [Xen-devel] Domain Save Image Format proposal (draft B)"):
Quoted 2 lines
But there's nothing wrong per-se with having the endianness of an image be explicit in the file formats header, even if it is a bit redundant.
Right.
Quoted 3 lines
Note that the initial header has to be in some fixed endianness, but it's a small handful of bytes which only occurs once, I don't think the byte swapping is an issue there.
Given that it has to be some fixed endianness, and we don't want to write code which will go wrong if we want to support a big endian arcdh in the future, the code we write now must include byteswapping calls.
Those calls are simple if the specified endianness is big endian. Also, making it be the opposite of the native for popular platforms means we're more likely to notice if we miss any endian fix calls.
Ian.
Quoted 11 lines · Ian Campbell
Quoted 2 lines · Shriram Rajagopalan
I am not that familiar with ARM, but from what I read, its bi-endian past v3.
Modern ARMs can still do big endian, and are sometimes used that way too.
I expect that this would be expressed as a new guest
arch/type(ARMBE) though.
Quoted 9 lines
But there's nothing wrong per-se with having the endianness of an image be explicit in the file formats header, even if it is a bit redundant.
Note that the initial header has to be in some fixed endianness, but it's a small handful of bytes which only occurs once, I don't think the byte swapping is an issue there.
Ian.
I think we should just stick with the native format. It's easy to handle.
If a Xen x86 receive an ARM image it probably cannot cope with it. It can only store it in some form. On the other end is much easy to restore as x86 is always little-endian and we know images to restore will be little endian.
Considering architecture which support both endianess we will never restore a little-endian image in a big-endian guest. Although we could convert headers and stuff like that we can't convert memory inside the guest so the guest must have the same endianess. If a machine can handle both endianess just setting some CPU flags in this case it will make sense (but it will still maintain the VM endianess!) but why slow down on system that can't handle it?
Frediano
Frediano Ziglio writes ("Re: [Xen-devel] Domain Save Image Format proposal (draft B)"):
Quoted 1 line
[stuff]
I think this is in danger of becoming a bikeshed issue. I am unconvinced by the arguments made on the other side. The performance and code complexity implications of byteswapping the image header are IMO minimal. So I'm going to put my foot down and say this:
David is entirely correct to specify a fixed endianness for the image header. As a tools maintainer I would accept patches for David's format (subject to the other comments that are being discussed). I would be very reluctant to accept patches for a similar format with a variable-endianness image header. I would certainly not accept patches which purport to implement a nominally-fixed-endianness format but where the implementation is not in fact portable to the other endianness.
Ian.
Quoted 3 lines · Ian Jackson
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.
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Ian Jackson
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
Quoted 9 lines · Frediano Ziglio
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Ian Jackson
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.
Quoted 7 lines
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
Quoted 1 line · Frediano Ziglio
More about endianess and protocols.
I don't think we need more on this. It has already gotten far more discussion than needed for such a minor issue and I trust David to take on board any useful feedback and to update the spec accordingly as needed.
It would be more useful if people were to spend their time thinking about the core of the proposal instead of nitpicking around the edges.
Ian.
Quoted 4 lines · Shriram Rajagopalan
My point here being, checksums seem like unnecessary compute overhead when doing live migration
or Remus. One can simply set this field to 0 when doing live migration/Remus.
Remus _compresses_ the payload, right? CRC32 is basically free compared to that.
But I think the point about checksumming the whole image is sound. That will catch _more_ classes of corruption than a per-block data checksum, and the class of bugs caught by per-block checksums (basically, that the header and the data don't match for some reason) are pretty small in this design.
Tim.
Quoted 4 lines · Ian Campbell
Quoted 2 lines
checksum CRC-32 checksum of the record body (including any trailing
padding), or 0x00000000 if the checksum field is invalid.Which CRC-32 :-P
CRC32C please; it's got hardware acceleration in SSE4.2. There are also options like Adler which are supposed to be faster in normal arithmetic (not sure if that's still the case if you include tricks like using vector multiply to fold the payload).
Tim.
Hi,
This draft has my wholehearted support. Even without addressing any of the points under discussion something along these lines would be a vast improvement on the current format.
I have two general questions:
- The existing save-format definition is spread across a number of
places: libxc for hypervisor state, qemu for DM state, and the main toolstack (libxl/xend/xapi/&c) for other config runes and a general wrapper. This is clearly a reworking of the libxc parts -- do you think there's anything currently defined elsewhere that belongs in this spec?
- Have you given any thought to making this into a wire protocol rather than just a file format? Would there be any benefit to having records individually acked by the receiver in a live migration, or having the receiver send instructions about compatibility? Or is that again left to the toolstack to manage?
and a few nits:
Quoted 38 lines · David Vrabel
Records
=======A record has a record header, type specific data and a trailing footer. If
body_lengthis not a multiple of 8, the body is padded with zeroes to align the checksum field on an 8 octet boundary.0 1 2 3 4 5 6 7 octet +-----------------------+-------------------------+ | type | body_length | +-----------+-----------+-------------------------+ | options | (reserved) | +-----------+-------------------------------------+ ... Record body of length body_length octets followed by 0 to 7 octets of padding. ... +-----------------------+-------------------------+ | checksum | (reserved) | +-----------------------+-------------------------+--------------------------------------------------------------------
Field Description ----------- ------------------------------------------------------- type 0x00000000: END0x00000001: PAGE_DATA 0x00000002: VCPU_INFO 0x00000003: VCPU_CONTEXT 0x00000004: X86_PV_INFO 0x00000005: P2M 0x00000006 - 0xFFFFFFFF: Reserved
Quoted 8 lines
body_lengthLength in octets of the record body.options Bit 0: 0 - checksum invalid, 1 = checksum valid.
Bit 1-15: Reserved.checksum CRC-32 checksum of the record body (including any trailing
padding), or 0x00000000 if the checksum field is invalid.
Apart from any discussion of the merits of per-record vs whole-file checksums, it would be useful for this checksum to cover the header too. E.g., by declaring it to be the checksum of header+data where the checksum field is 0, or by declaring that it shall be that pattern which causes the finished header+data to checksum to 0.
Quoted 14 lines
VCPU_INFO
---------Quoted 2 lines
[ This is a combination of parts of the extended-info and
XC_SAVE_ID_VCPU_INFOchunks. ]The
VCPU_INFOrecord includes the maximum possible VCPU ID. This will be followed aVCPU_CONTEXTrecord for each online VCPU.0 1 2 3 4 5 6 7 octet
+-----------------------+------------------------+
|max_vcpu_id| (reserved) |
+-----------------------+------------------------+
Quoted 5 lines
--------------------------------------------------------------------
Field Description ----------- --------------------------------------------------- max_vcpu_id Maximum possible VCPU ID.--------------------------------------------------------------------
If this is all that's in this record, maybe it should be called VCPU_COUNT?
Quoted 28 lines
P2M
---[ This is a more flexible replacement for the old
p2m_sizefield and p2m array. ]The P2M record contains a portion of the source domain's P2M. Multiple P2M records may be sent if the source P2M changes during the stream.
0 1 2 3 4 5 6 7 octet +-------------------------------------------------+ | pfn_begin | +-------------------------------------------------+ | pfn_end | +-------------------------------------------------+ | mfn[0] | +-------------------------------------------------+ ... +-------------------------------------------------+ | mfn[N-1] | +-------------------------------------------------+--------------------------------------------------------------------
Field Description
----------- --------------------------------------------------------pfn_beginThe first PFN in this portion of the P2M
Quoted 5 lines
pfn_endOne past the last PFN in this portion of the P2M.mfn Array of (
pfn_end- pfn-begin) MFNs corresponding to
the set of PFNs in the range [pfn_begin,pfn_end).
--------------------------------------------------------------------
The current save record doesn't contain the p2m itself, but rather the p2m_frame_list, an array of the MFNs (in the save record, PFNs) that hold the actual p2m. Frames in that list are used to populate the p2m as memory is allocated on the receiving side.
I'm not sure what it would mean to allow the guest to change the location of its p2m table (as distinct from the contents) on the fly during a migration. We would at least have to re-send the contents of any frames that are no longer in the p2m table, in case the receiver has already overwritten them. And I think it should be fine to just send the whole list every time (or else we need to manage deltas carefully too).
Also, while I'm thinking about record names, this probably ought to be called X86_PV_P2M or something like that.
Cheers,
Tim.
Quoted 6 lines · Tim Deegan
Hi,
This draft has my wholehearted support. Even without addressing any of the points under discussion something along these lines would be a vast improvement on the current format.
Quoted 8 lines
I have two general questions:
- The existing save-format definition is spread across a number of
places: libxc for hypervisor state, qemu for DM state, and the main toolstack (libxl/xend/xapi/&c) for other config runes and a general wrapper. This is clearly a reworking of the libxc parts -- do you think there's anything currently defined elsewhere that belongs in this spec?
I was considering this format as a container for those blobs, but I think there should be enough flexibility that additional things could be moved into the spec in the future.
Quoted 5 lines
- Have you given any thought to making this into a wire protocol rather than just a file format? Would there be any benefit to having records individually acked by the receiver in a live migration, or having the receiver send instructions about compatibility? Or is that again left to the toolstack to manage?
I don't see how having the restorer send anything back to the saver would work with image files[1] so any two way stuff must be optional so this can be left for future.
Ian J had some suggestions for how to handle compatibility better without having the restorer report its capabilities.
Quoted 8 lines
Quoted 2 lines
checksum CRC-32 checksum of the record body (including any trailing
padding), or 0x00000000 if the checksum field is invalid.Apart from any discussion of the merits of per-record vs whole-file checksums, it would be useful for this checksum to cover the header too. E.g., by declaring it to be the checksum of header+data where the checksum field is 0, or by declaring that it shall be that pattern which causes the finished header+data to checksum to 0.
A single checksum for a multi GB file doesn't seem robust enough, which is why I made it per-record. Per-record checksums also mean you can discard records the restorer isn't interested in without having to read them to calculate the checksum.
I'm not entirely convinced by the usefulness of checksums, though. If no one else thinks they would be useful I'll probably drop them.
Quoted 2 lines
Quoted 2 lines
P2M
---
[...]
Quoted 4 lines
The current save record doesn't contain the p2m itself, but rather the
p2m_frame_list, an array of the MFNs (in the save record, PFNs) that hold the actual p2m. Frames in that list are used to populate the p2m as memory is allocated on the receiving side.
Er. Yes, I got confused by the code here and misunderstood it.
David
Quoted 42 lines · David Vrabel
Quoted 6 lines · Tim Deegan
Hi,
This draft has my wholehearted support. Even without addressing any of the points under discussion something along these lines would be a vast improvement on the current format.
Quoted 8 lines
I have two general questions:
- The existing save-format definition is spread across a number of
places: libxc for hypervisor state, qemu for DM state, and the main toolstack (libxl/xend/xapi/&c) for other config runes and a general wrapper. This is clearly a reworking of the libxc parts -- do you think there's anything currently defined elsewhere that belongs in this spec?I was considering this format as a container for those blobs, but I think there should be enough flexibility that additional things could be moved into the spec in the future.
Quoted 5 lines
- Have you given any thought to making this into a wire protocol rather than just a file format? Would there be any benefit to having records individually acked by the receiver in a live migration, or having the receiver send instructions about compatibility? Or is that again left to the toolstack to manage?
I don't see how having the restorer send anything back to the saver would work with image files[1] so any two way stuff must be optional so this can be left for future.
Ian J had some suggestions for how to handle compatibility better without having the restorer report its capabilities.
Quoted 8 lines
Quoted 2 lines
checksum CRC-32 checksum of the record body (including any trailing
padding), or 0x00000000 if the checksum field is invalid.Apart from any discussion of the merits of per-record vs whole-file checksums, it would be useful for this checksum to cover the header too. E.g., by declaring it to be the checksum of header+data where the checksum field is 0, or by declaring that it shall be that pattern which causes the finished header+data to checksum to 0.
Quoted 8 lines
A single checksum for a multi GB file doesn't seem robust enough, which is why I made it per-record. Per-record checksums also mean you can discard records the restorer isn't interested in without having to read them to calculate the checksum.
I'm not entirely convinced by the usefulness of checksums, though. If no one else thinks they would be useful I'll probably drop them.
<paranoia mode>
I think it depends if you want to detect some type of corruption. Images can be send through wire or saved to disk and then restored. Although network put a lot of checks and disk know when data are corrupted in the physical layer (as sectors have CRCs too) corruptions occurring on memory transfers or bus (like SATA or PCI) are not detected.
CRC could also be useful for Remus to detect corruption and request updating it.
</paranoia mode>
Quoted 12 lines
Quoted 2 lines
Quoted 2 lines
P2M
---[...]
Quoted 4 lines
The current save record doesn't contain the p2m itself, but rather the
p2m_frame_list, an array of the MFNs (in the save record, PFNs) that hold the actual p2m. Frames in that list are used to populate the p2m as memory is allocated on the receiving side.Er. Yes, I got confused by the code here and misunderstood it.
David
Frediano