diff mbox

[v9,03/25] libxc/migration: Specification update for DIRTY_PFN_LIST records

Message ID 1451443075-27428-4-git-send-email-wency@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wen Congyang Dec. 30, 2015, 2:37 a.m. UTC
Used by secondary to send it's dirty bitmap to primary under COLO.

Signed-off-by: Yang Hongyang <hongyang.yang@easystack.cn>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
---
 docs/specs/libxc-migration-stream.pandoc | 24 +++++++++++++++++++++++-
 tools/libxc/xc_sr_common.c               |  1 +
 tools/libxc/xc_sr_stream_format.h        |  1 +
 tools/python/xen/migration/libxc.py      |  8 ++++++++
 4 files changed, 33 insertions(+), 1 deletion(-)

Comments

Konrad Rzeszutek Wilk Jan. 26, 2016, 8:44 p.m. UTC | #1
> +             0x0000000F: DIRTY_PFN_LIST
> +

Perhaps make it part of the optional and prefix it with CHECKPOINT?

> +             0x00000010 - 0x7FFFFFFF: Reserved for future _mandatory_
>               records.
>  
>               0x80000000 - 0xFFFFFFFF: Reserved for future _optional_
Wen Congyang Jan. 27, 2016, 6:47 a.m. UTC | #2
On 01/27/2016 04:44 AM, Konrad Rzeszutek Wilk wrote:
>> +             0x0000000F: DIRTY_PFN_LIST
>> +
> 
> Perhaps make it part of the optional and prefix it with CHECKPOINT?

Will be fixed in the next version.

Thanks
Wen Congyang

> 
>> +             0x00000010 - 0x7FFFFFFF: Reserved for future _mandatory_
>>               records.
>>  
>>               0x80000000 - 0xFFFFFFFF: Reserved for future _optional_
> 
> 
> .
>
Wen Congyang Jan. 27, 2016, 7:12 a.m. UTC | #3
On 01/27/2016 04:44 AM, Konrad Rzeszutek Wilk wrote:
>> +             0x0000000F: DIRTY_PFN_LIST
>> +
> 
> Perhaps make it part of the optional and prefix it with CHECKPOINT?

IIUC, optional record can be ignored, but this record cannot be ignored.

To Andrew Cooper:
Should I mark this record as optional record?

Thanks
Wen Congyang

> 
>> +             0x00000010 - 0x7FFFFFFF: Reserved for future _mandatory_
>>               records.
>>  
>>               0x80000000 - 0xFFFFFFFF: Reserved for future _optional_
> 
> 
> .
>
Ian Campbell Jan. 27, 2016, 10 a.m. UTC | #4
On Wed, 2016-01-27 at 15:12 +0800, Wen Congyang wrote:
> On 01/27/2016 04:44 AM, Konrad Rzeszutek Wilk wrote:
> > > +             0x0000000F: DIRTY_PFN_LIST
> > > +
> > 
> > Perhaps make it part of the optional and prefix it with CHECKPOINT?
> 
> IIUC, optional record can be ignored, but this record cannot be ignored.
> 
> To Andrew Cooper:
> Should I mark this record as optional record?

My understanding was that this indicated things for which support was
mandatory (whereas unknown optional ones may be ignored), not that they
must be present in every stream.

IOW placing this in the mandatory flags is correct, since the restorer
cannot simply ignore a checkpoint flag.

Ian.
Andrew Cooper Jan. 27, 2016, 11:01 a.m. UTC | #5
On 27/01/16 10:00, Ian Campbell wrote:
> On Wed, 2016-01-27 at 15:12 +0800, Wen Congyang wrote:
>> On 01/27/2016 04:44 AM, Konrad Rzeszutek Wilk wrote:
>>>> +             0x0000000F: DIRTY_PFN_LIST
>>>> +
>>> Perhaps make it part of the optional and prefix it with CHECKPOINT?
>> IIUC, optional record can be ignored, but this record cannot be ignored.
>>
>> To Andrew Cooper:
>> Should I mark this record as optional record?
> My understanding was that this indicated things for which support was
> mandatory (whereas unknown optional ones may be ignored), not that they
> must be present in every stream.
>
> IOW placing this in the mandatory flags is correct, since the restorer
> cannot simply ignore a checkpoint flag.

Both correct on all points.  This should be a mandatory record.

~Andrew
diff mbox

Patch

diff --git a/docs/specs/libxc-migration-stream.pandoc b/docs/specs/libxc-migration-stream.pandoc
index 8cd678f..ae1f1d0 100644
--- a/docs/specs/libxc-migration-stream.pandoc
+++ b/docs/specs/libxc-migration-stream.pandoc
@@ -227,7 +227,9 @@  type         0x00000000: END
 
              0x0000000E: CHECKPOINT
 
-             0x0000000F - 0x7FFFFFFF: Reserved for future _mandatory_
+             0x0000000F: DIRTY_PFN_LIST
+
+             0x00000010 - 0x7FFFFFFF: Reserved for future _mandatory_
              records.
 
              0x80000000 - 0xFFFFFFFF: Reserved for future _optional_
@@ -599,6 +601,26 @@  CHECKPOINT record or an END record.
 
 \clearpage
 
+DIRTY_PFN_LIST
+------------
+
+A dirty pfn list record is used to convey information about dirty memory
+in the VM. It is an unordered list of PFNs. Currently only applicable in
+the backchannel of a checkpointed stream.
+
+     0     1     2     3     4     5     6     7 octet
+    +-------------------------------------------------+
+    | pfn[0]                                          |
+    +-------------------------------------------------+
+    ...
+    +-------------------------------------------------+
+    | pfn[C-1]                                        |
+    +-------------------------------------------------+
+
+The count of pfns is: record->length/sizeof(uint64_t).
+
+\clearpage
+
 Layout
 ======
 
diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c
index 945cfa6..8150140 100644
--- a/tools/libxc/xc_sr_common.c
+++ b/tools/libxc/xc_sr_common.c
@@ -35,6 +35,7 @@  static const char *mandatory_rec_types[] =
     [REC_TYPE_X86_PV_VCPU_MSRS]     = "x86 PV vcpu msrs",
     [REC_TYPE_VERIFY]               = "Verify",
     [REC_TYPE_CHECKPOINT]           = "Checkpoint",
+    [REC_TYPE_DIRTY_PFN_LIST]       = "Dirty pfn list",
 };
 
 const char *rec_type_to_str(uint32_t type)
diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_format.h
index 6d0f8fd..8b8533f 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -75,6 +75,7 @@  struct xc_sr_rhdr
 #define REC_TYPE_X86_PV_VCPU_MSRS     0x0000000cU
 #define REC_TYPE_VERIFY               0x0000000dU
 #define REC_TYPE_CHECKPOINT           0x0000000eU
+#define REC_TYPE_DIRTY_PFN_LIST       0x0000000fU
 
 #define REC_TYPE_OPTIONAL             0x80000000U
 
diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py
index b0255ac..47da5e3 100644
--- a/tools/python/xen/migration/libxc.py
+++ b/tools/python/xen/migration/libxc.py
@@ -60,6 +60,7 @@  REC_TYPE_toolstack            = 0x0000000b
 REC_TYPE_x86_pv_vcpu_msrs     = 0x0000000c
 REC_TYPE_verify               = 0x0000000d
 REC_TYPE_checkpoint           = 0x0000000e
+REC_TYPE_dirty_pfn_list       = 0x0000000f
 
 rec_type_to_str = {
     REC_TYPE_end                  : "End",
@@ -77,6 +78,7 @@  rec_type_to_str = {
     REC_TYPE_x86_pv_vcpu_msrs     : "x86 PV vcpu msrs",
     REC_TYPE_verify               : "Verify",
     REC_TYPE_checkpoint           : "Checkpoint",
+    REC_TYPE_dirty_pfn_list       : "Dirty pfn list"
 }
 
 # page_data
@@ -403,6 +405,10 @@  class VerifyLibxc(VerifyBase):
         if len(content) != 0:
             raise RecordError("Checkpoint record with non-zero length")
 
+    def verify_record_dirty_pfn_list(self, content):
+        """ dirty pfn list """
+        raise RecordError("Found dirty pfn list record in stream")
+
 
 record_verifiers = {
     REC_TYPE_end:
@@ -443,4 +449,6 @@  record_verifiers = {
         VerifyLibxc.verify_record_verify,
     REC_TYPE_checkpoint:
         VerifyLibxc.verify_record_checkpoint,
+    REC_TYPE_dirty_pfn_list:
+        VerifyLibxc.verify_record_dirty_pfn_list,
     }