From patchwork Tue Dec 24 15:19:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11309521 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD27513A4 for ; Tue, 24 Dec 2019 15:21:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8194206D3 for ; Tue, 24 Dec 2019 15:21:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="eODmVEGn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8194206D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijlyZ-0000La-6d; Tue, 24 Dec 2019 15:19:59 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijlyY-0000Kt-3H for xen-devel@lists.xenproject.org; Tue, 24 Dec 2019 15:19:58 +0000 X-Inumbo-ID: cdd8b881-2660-11ea-97e5-12813bfff9fa Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id cdd8b881-2660-11ea-97e5-12813bfff9fa; Tue, 24 Dec 2019 15:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1577200780; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x3AtcqfE3m4TuZR8xeTxCYK6xltXQe30zR1OuIH6L0s=; b=eODmVEGnLN/7TjjP7dZpFqH6IHYCRkgqOm1+jYBp0MKh2ErI7W8/oF6H 2ISYWD2wcZrRARs/059D4HIt9V0zjwRqtIuNDgffOYckAOt4J2QsMA2mF gRGGyOrMG9nSFYDpRhl4Lsk5zuFkX2EvJZN4ua3At3c96jmNlZcbFsb2b I=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: hZuGunqR0J+J7Uy0CxMiBTWIiBBOxeP3OCstwowXe6ug/qnt6lsoRDCKccCSpP6ir1M16W1DzG fxDgqjaezCGCmgj2iRMG3dgZ+XuueZrHRwoom2a//hhZpgoMo1YfQCTBYkT5iwdyiBvBJ/HXrK ZGtFTFrf5Qgnt3R+O+HDCKHsXjbwH3UEXu9PbZBY4mz4DwILPPIzrKZbM3ZpKKhmzl3Iq7GNa4 6OzOSf7EMkEuVvjYPdKwQoo4nn7wY+Irnc+dsGR3BFY1apE1yVRv0owi7f0QMFkm0ZMTH57gQe +mQ= X-SBRS: 2.7 X-MesageID: 10482751 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,351,1571716800"; d="scan'208";a="10482751" From: Andrew Cooper To: Xen-devel Date: Tue, 24 Dec 2019 15:19:26 +0000 Message-ID: <20191224151932.6304-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191224151932.6304-1-andrew.cooper3@citrix.com> References: <20191224151932.6304-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 06/12] docs/migration Specify migration v3 and STATIC_DATA_END X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Jan Beulich , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Migration data can be split into two parts - that which is invariant of guest execution, and that which is not. Separate these two with the STATIC_DATA_END record. The short term, we want to move the x86 CPU Policy data into the stream. In the longer term, we want to provisionally send the static data only to the destination as a more robust compatibility check. In both cases, we will want a callback into the higher level toolstack. Mandate the presence of the STATIC_DATA_END record, and declare this v3, along with instructions for how to compatibly interpret a v2 stream. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Wei Liu CC: Julien Grall CC: Marek Marczykowski-Górecki --- docs/specs/libxc-migration-stream.pandoc | 39 +++++++++++++++++++++++++++++--- tools/libxc/xc_sr_common.c | 1 + tools/libxc/xc_sr_stream_format.h | 1 + tools/python/xen/migration/libxc.py | 2 ++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/docs/specs/libxc-migration-stream.pandoc b/docs/specs/libxc-migration-stream.pandoc index a7a8a08936..22ff306e0b 100644 --- a/docs/specs/libxc-migration-stream.pandoc +++ b/docs/specs/libxc-migration-stream.pandoc @@ -127,7 +127,7 @@ marker 0xFFFFFFFFFFFFFFFF. id 0x58454E46 ("XENF" in ASCII). -version 0x00000002. The version of this specification. +version 0x00000003. The version of this specification. options bit 0: Endianness. 0 = little-endian, 1 = big-endian. @@ -620,6 +620,21 @@ The count of pfns is: record->length/sizeof(uint64_t). \clearpage +STATIC_DATA_END +--------------- + +A static data end record marks the end of the static state. I.e. state which +is invariant of guest execution. + + + 0 1 2 3 4 5 6 7 octet + +-------------------------------------------------+ + +The end record contains no fields; its body_length is 0. + +\clearpage + + Layout ====== @@ -639,7 +654,9 @@ A typical save record for an x86 PV guest image would look like: * Image header * Domain header -* X86_PV_INFO record +* Static data records: + * X86_PV_INFO record + * STATIC_DATA_END * X86_PV_P2M_FRAMES record * Many PAGE_DATA records * X86_TSC_INFO @@ -667,6 +684,8 @@ A typical save record for an x86 HVM guest image would look like: * Image header * Domain header +* Static data records: + * STATIC_DATA_END * Many PAGE_DATA records * X86_TSC_INFO * HVM_PARAMS @@ -675,9 +694,23 @@ A typical save record for an x86 HVM guest image would look like: HVM_PARAMS must precede HVM_CONTEXT, as certain parameters can affect the validity of architectural state in the context. +Compatibility with older versions +================================= + +v3 compat with v2 +----------------- + +A v3 stream is compatible with a v2 stream, but mandates the presense of a +STATIC_DATA_END record ahead of any memory/register content. This is to ease +the introduction of new static configuration records over time. + +A v3-compatible reciever interpreting a v2 stream should infer the position of +STATIC_DATA_END based on finding the first X86_PV_P2M_FRAMES record (for PV +guests), or PAGE_DATA record (for HVM guests) and behave as if STATIC_DATA_END +had been sent. Legacy Images (x86 only) -======================== +------------------------ Restoring legacy images from older tools shall be handled by translating the legacy format image into this new format. diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c index dd9a11b4b5..7f22cf0365 100644 --- a/tools/libxc/xc_sr_common.c +++ b/tools/libxc/xc_sr_common.c @@ -36,6 +36,7 @@ static const char *const mandatory_rec_types[] = [REC_TYPE_VERIFY] = "Verify", [REC_TYPE_CHECKPOINT] = "Checkpoint", [REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST] = "Checkpoint dirty pfn list", + [REC_TYPE_STATIC_DATA_END] = "Static data end", }; 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 ae7c0de393..81c9765b0a 100644 --- a/tools/libxc/xc_sr_stream_format.h +++ b/tools/libxc/xc_sr_stream_format.h @@ -73,6 +73,7 @@ struct xc_sr_rhdr #define REC_TYPE_VERIFY 0x0000000dU #define REC_TYPE_CHECKPOINT 0x0000000eU #define REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST 0x0000000fU +#define REC_TYPE_STATIC_DATA_END 0x00000010U #define REC_TYPE_OPTIONAL 0x80000000U diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py index 63b3558029..d0c4f3527d 100644 --- a/tools/python/xen/migration/libxc.py +++ b/tools/python/xen/migration/libxc.py @@ -56,6 +56,7 @@ REC_TYPE_verify = 0x0000000d REC_TYPE_checkpoint = 0x0000000e REC_TYPE_checkpoint_dirty_pfn_list = 0x0000000f +REC_TYPE_static_data_end = 0x00000010 rec_type_to_str = { REC_TYPE_end : "End", @@ -74,6 +75,7 @@ REC_TYPE_verify : "Verify", REC_TYPE_checkpoint : "Checkpoint", REC_TYPE_checkpoint_dirty_pfn_list : "Checkpoint dirty pfn list", + REC_TYPE_static_data_end : "Static data end", } # page_data