From patchwork Fri Mar 4 08:41:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changlong Xie X-Patchwork-Id: 8500111 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A6CFAC0553 for ; Fri, 4 Mar 2016 08:42:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70D8D201EF for ; Fri, 4 Mar 2016 08:42:22 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 338A9201DD for ; Fri, 4 Mar 2016 08:42:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ablHF-0006S8-PC; Fri, 04 Mar 2016 08:40:01 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ablHD-0006PK-Vz for xen-devel@lists.xen.org; Fri, 04 Mar 2016 08:40:00 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id BE/92-03301-FD949D65; Fri, 04 Mar 2016 08:39:59 +0000 X-Env-Sender: xiecl.fnst@cn.fujitsu.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1457080791!24937018!4 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20902 invoked from network); 4 Mar 2016 08:39:58 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-8.tower-27.messagelabs.com with SMTP; 4 Mar 2016 08:39:58 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4230646" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Mar 2016 16:39:51 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 5CE4642B4B01; Fri, 4 Mar 2016 16:39:49 +0800 (CST) Received: from changlox.g08.fujitsu.local (10.167.225.55) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 4 Mar 2016 16:39:48 +0800 From: Changlong Xie To: xen devel , Konrad Rzeszutek Wilk , Andrew Cooper , Ian Campbell , Ian Jackson , Wei Liu Date: Fri, 4 Mar 2016 16:41:12 +0800 Message-ID: <1457080891-26054-9-git-send-email-xiecl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1457080891-26054-1-git-send-email-xiecl.fnst@cn.fujitsu.com> References: <1457080891-26054-1-git-send-email-xiecl.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.225.55] X-yoursite-MailScanner-ID: 5CE4642B4B01.A3899 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: xiecl.fnst@cn.fujitsu.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Cc: Lars Kurth , Changlong Xie , Wen Congyang , Gui Jianfeng , Jiang Yunhong , Dong Eddie , Anthony Perard , Shriram Rajagopalan , Yang Hongyang Subject: [Xen-devel] [PATCH v11 08/27] libxc/migration: Specification update for DIRTY_PFN_LIST records X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wen Congyang Used by secondary to send it's dirty bitmap to primary under COLO. Signed-off-by: Yang Hongyang Signed-off-by: Wen Congyang Signed-off-by: Changlong Xie --- docs/specs/libxc-migration-stream.pandoc | 26 +++++++++++- tools/libxc/xc_sr_common.c | 31 ++++++++------- tools/libxc/xc_sr_stream_format.h | 31 ++++++++------- tools/python/xen/migration/libxc.py | 68 ++++++++++++++++++-------------- 4 files changed, 95 insertions(+), 61 deletions(-) diff --git a/docs/specs/libxc-migration-stream.pandoc b/docs/specs/libxc-migration-stream.pandoc index 8cd678f..18544e0 100644 --- a/docs/specs/libxc-migration-stream.pandoc +++ b/docs/specs/libxc-migration-stream.pandoc @@ -1,6 +1,8 @@ % LibXenCtrl Domain Image Format % David Vrabel <> Andrew Cooper <> + Wen Congyang <> + Yang Hongyang <> % Revision 1 Introduction @@ -227,7 +229,9 @@ type 0x00000000: END 0x0000000E: CHECKPOINT - 0x0000000F - 0x7FFFFFFF: Reserved for future _mandatory_ + 0x0000000F: CHECKPOINT_DIRTY_PFN_LIST (Secondary -> Primary) + + 0x00000010 - 0x7FFFFFFF: Reserved for future _mandatory_ records. 0x80000000 - 0xFFFFFFFF: Reserved for future _optional_ @@ -599,6 +603,26 @@ CHECKPOINT record or an END record. \clearpage +CHECKPOINT_DIRTY_PFN_LIST +------------ + +A checkpoint 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..3313a90 100644 --- a/tools/libxc/xc_sr_common.c +++ b/tools/libxc/xc_sr_common.c @@ -20,21 +20,22 @@ const char *dhdr_type_to_str(uint32_t type) static const char *mandatory_rec_types[] = { - [REC_TYPE_END] = "End", - [REC_TYPE_PAGE_DATA] = "Page data", - [REC_TYPE_X86_PV_INFO] = "x86 PV info", - [REC_TYPE_X86_PV_P2M_FRAMES] = "x86 PV P2M frames", - [REC_TYPE_X86_PV_VCPU_BASIC] = "x86 PV vcpu basic", - [REC_TYPE_X86_PV_VCPU_EXTENDED] = "x86 PV vcpu extended", - [REC_TYPE_X86_PV_VCPU_XSAVE] = "x86 PV vcpu xsave", - [REC_TYPE_SHARED_INFO] = "Shared info", - [REC_TYPE_TSC_INFO] = "TSC info", - [REC_TYPE_HVM_CONTEXT] = "HVM context", - [REC_TYPE_HVM_PARAMS] = "HVM params", - [REC_TYPE_TOOLSTACK] = "Toolstack", - [REC_TYPE_X86_PV_VCPU_MSRS] = "x86 PV vcpu msrs", - [REC_TYPE_VERIFY] = "Verify", - [REC_TYPE_CHECKPOINT] = "Checkpoint", + [REC_TYPE_END] = "End", + [REC_TYPE_PAGE_DATA] = "Page data", + [REC_TYPE_X86_PV_INFO] = "x86 PV info", + [REC_TYPE_X86_PV_P2M_FRAMES] = "x86 PV P2M frames", + [REC_TYPE_X86_PV_VCPU_BASIC] = "x86 PV vcpu basic", + [REC_TYPE_X86_PV_VCPU_EXTENDED] = "x86 PV vcpu extended", + [REC_TYPE_X86_PV_VCPU_XSAVE] = "x86 PV vcpu xsave", + [REC_TYPE_SHARED_INFO] = "Shared info", + [REC_TYPE_TSC_INFO] = "TSC info", + [REC_TYPE_HVM_CONTEXT] = "HVM context", + [REC_TYPE_HVM_PARAMS] = "HVM params", + [REC_TYPE_TOOLSTACK] = "Toolstack", + [REC_TYPE_X86_PV_VCPU_MSRS] = "x86 PV vcpu msrs", + [REC_TYPE_VERIFY] = "Verify", + [REC_TYPE_CHECKPOINT] = "Checkpoint", + [REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST] = "Checkpoint 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..3291b25 100644 --- a/tools/libxc/xc_sr_stream_format.h +++ b/tools/libxc/xc_sr_stream_format.h @@ -60,21 +60,22 @@ struct xc_sr_rhdr /* Somewhat arbitrary - 8MB */ #define REC_LENGTH_MAX (8U << 20) -#define REC_TYPE_END 0x00000000U -#define REC_TYPE_PAGE_DATA 0x00000001U -#define REC_TYPE_X86_PV_INFO 0x00000002U -#define REC_TYPE_X86_PV_P2M_FRAMES 0x00000003U -#define REC_TYPE_X86_PV_VCPU_BASIC 0x00000004U -#define REC_TYPE_X86_PV_VCPU_EXTENDED 0x00000005U -#define REC_TYPE_X86_PV_VCPU_XSAVE 0x00000006U -#define REC_TYPE_SHARED_INFO 0x00000007U -#define REC_TYPE_TSC_INFO 0x00000008U -#define REC_TYPE_HVM_CONTEXT 0x00000009U -#define REC_TYPE_HVM_PARAMS 0x0000000aU -#define REC_TYPE_TOOLSTACK 0x0000000bU -#define REC_TYPE_X86_PV_VCPU_MSRS 0x0000000cU -#define REC_TYPE_VERIFY 0x0000000dU -#define REC_TYPE_CHECKPOINT 0x0000000eU +#define REC_TYPE_END 0x00000000U +#define REC_TYPE_PAGE_DATA 0x00000001U +#define REC_TYPE_X86_PV_INFO 0x00000002U +#define REC_TYPE_X86_PV_P2M_FRAMES 0x00000003U +#define REC_TYPE_X86_PV_VCPU_BASIC 0x00000004U +#define REC_TYPE_X86_PV_VCPU_EXTENDED 0x00000005U +#define REC_TYPE_X86_PV_VCPU_XSAVE 0x00000006U +#define REC_TYPE_SHARED_INFO 0x00000007U +#define REC_TYPE_TSC_INFO 0x00000008U +#define REC_TYPE_HVM_CONTEXT 0x00000009U +#define REC_TYPE_HVM_PARAMS 0x0000000aU +#define REC_TYPE_TOOLSTACK 0x0000000bU +#define REC_TYPE_X86_PV_VCPU_MSRS 0x0000000cU +#define REC_TYPE_VERIFY 0x0000000dU +#define REC_TYPE_CHECKPOINT 0x0000000eU +#define REC_TYPE_CHECKPOINT_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..85a78f4 100644 --- a/tools/python/xen/migration/libxc.py +++ b/tools/python/xen/migration/libxc.py @@ -45,38 +45,40 @@ dhdr_type_to_str = { # Records RH_FORMAT = "II" -REC_TYPE_end = 0x00000000 -REC_TYPE_page_data = 0x00000001 -REC_TYPE_x86_pv_info = 0x00000002 -REC_TYPE_x86_pv_p2m_frames = 0x00000003 -REC_TYPE_x86_pv_vcpu_basic = 0x00000004 -REC_TYPE_x86_pv_vcpu_extended = 0x00000005 -REC_TYPE_x86_pv_vcpu_xsave = 0x00000006 -REC_TYPE_shared_info = 0x00000007 -REC_TYPE_tsc_info = 0x00000008 -REC_TYPE_hvm_context = 0x00000009 -REC_TYPE_hvm_params = 0x0000000a -REC_TYPE_toolstack = 0x0000000b -REC_TYPE_x86_pv_vcpu_msrs = 0x0000000c -REC_TYPE_verify = 0x0000000d -REC_TYPE_checkpoint = 0x0000000e +REC_TYPE_end = 0x00000000 +REC_TYPE_page_data = 0x00000001 +REC_TYPE_x86_pv_info = 0x00000002 +REC_TYPE_x86_pv_p2m_frames = 0x00000003 +REC_TYPE_x86_pv_vcpu_basic = 0x00000004 +REC_TYPE_x86_pv_vcpu_extended = 0x00000005 +REC_TYPE_x86_pv_vcpu_xsave = 0x00000006 +REC_TYPE_shared_info = 0x00000007 +REC_TYPE_tsc_info = 0x00000008 +REC_TYPE_hvm_context = 0x00000009 +REC_TYPE_hvm_params = 0x0000000a +REC_TYPE_toolstack = 0x0000000b +REC_TYPE_x86_pv_vcpu_msrs = 0x0000000c +REC_TYPE_verify = 0x0000000d +REC_TYPE_checkpoint = 0x0000000e +REC_TYPE_checkpoint_dirty_pfn_list = 0x0000000f rec_type_to_str = { - REC_TYPE_end : "End", - REC_TYPE_page_data : "Page data", - REC_TYPE_x86_pv_info : "x86 PV info", - REC_TYPE_x86_pv_p2m_frames : "x86 PV P2M frames", - REC_TYPE_x86_pv_vcpu_basic : "x86 PV vcpu basic", - REC_TYPE_x86_pv_vcpu_extended : "x86 PV vcpu extended", - REC_TYPE_x86_pv_vcpu_xsave : "x86 PV vcpu xsave", - REC_TYPE_shared_info : "Shared info", - REC_TYPE_tsc_info : "TSC info", - REC_TYPE_hvm_context : "HVM context", - REC_TYPE_hvm_params : "HVM params", - REC_TYPE_toolstack : "Toolstack", - REC_TYPE_x86_pv_vcpu_msrs : "x86 PV vcpu msrs", - REC_TYPE_verify : "Verify", - REC_TYPE_checkpoint : "Checkpoint", + REC_TYPE_end : "End", + REC_TYPE_page_data : "Page data", + REC_TYPE_x86_pv_info : "x86 PV info", + REC_TYPE_x86_pv_p2m_frames : "x86 PV P2M frames", + REC_TYPE_x86_pv_vcpu_basic : "x86 PV vcpu basic", + REC_TYPE_x86_pv_vcpu_extended : "x86 PV vcpu extended", + REC_TYPE_x86_pv_vcpu_xsave : "x86 PV vcpu xsave", + REC_TYPE_shared_info : "Shared info", + REC_TYPE_tsc_info : "TSC info", + REC_TYPE_hvm_context : "HVM context", + REC_TYPE_hvm_params : "HVM params", + REC_TYPE_toolstack : "Toolstack", + REC_TYPE_x86_pv_vcpu_msrs : "x86 PV vcpu msrs", + REC_TYPE_verify : "Verify", + REC_TYPE_checkpoint : "Checkpoint", + REC_TYPE_checkpoint_dirty_pfn_list : "Checkpoint 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_checkpoint_dirty_pfn_list(self, content): + """ checkpoint dirty pfn list """ + raise RecordError("Found checkpoint 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_checkpoint_dirty_pfn_list: + VerifyLibxc.verify_record_checkpoint_dirty_pfn_list, }