From nobody Mon Feb 9 01:07:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580135745573518.0948533472592; Mon, 27 Jan 2020 06:35:45 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iw5To-0001e4-6r; Mon, 27 Jan 2020 14:35:08 +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 1iw5Tm-0001ca-RC for xen-devel@lists.xenproject.org; Mon, 27 Jan 2020 14:35:06 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2dfb9f2b-4112-11ea-855c-12813bfff9fa; Mon, 27 Jan 2020 14:34:53 +0000 (UTC) X-Inumbo-ID: 2dfb9f2b-4112-11ea-855c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580135694; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pCcCf0Qf97HTuetLmatBuIzDe46g+JOWxvGQNTxhwcs=; b=Hf8H8JiUetV5lKZjQV1AA74y0rPcwYB8Mx7373cIcJW6G2cGdYrCdD6e SPJefAdb6Ol92z5h4dRcAfARr8yxQnZxcYVMx0gT2dhhOyg3P6M3ibqG9 hIbNxjc6PIr3+tdOdvgnwEyFG7yFKtPVK8enNTr5AIUdd1tUkP4B8IM5f 8=; Authentication-Results: esa1.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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: q+An6nXEr/ePBARVvBBjl9otGh3Bki+ZRzOiHhjZOLO9Ggmc2Hjmj8kLPwRhgr1u1JNPPwSS5Y ijAYUQcCX1YkmcG4PNFQ9dPodWv3TSLH46iJ7qnivYbyP0CEK2v9oelF88JR48ZhN9etBPI1aq jvadiao2HTJSFZupuWaaXWpmQHC1Tq365Dz4sE5B4vNazvk/xyrFHKZIreT5teM/UV1hamwPt9 b8e8vCkx8AtAxq1zG4nYWblSXjGD6Ee9LZ+3PTjQYjcn/ivCTUeV8Xb4AWg2xcViccf8mxT04c EL8= X-SBRS: 2.7 X-MesageID: 11664978 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,370,1574139600"; d="scan'208";a="11664978" From: Andrew Cooper To: Xen-devel Date: Mon, 27 Jan 2020 14:34:35 +0000 Message-ID: <20200127143444.25538-9-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200127143444.25538-1-andrew.cooper3@citrix.com> References: <20200127143444.25538-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 08/17] libxc/save: Write a v3 stream 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: Andrew Cooper , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Introduce a new static_data() hook which is responsible for writing out any static data records. The HVM side continues to be a no-op, while the PV side moves write_x86_pv_info() into this earlier hook. The the common code writes out a STATIC_DATA_END record, and the stream version is bumped to 3. Update convert-legacy-stream to write a v3 stream, because this will bypass the compatibly logic in libxc. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Marek Marczykowski-G=C3=B3recki --- tools/libxc/xc_sr_common.h | 10 ++++++++-- tools/libxc/xc_sr_save.c | 20 +++++++++++++++++++- tools/libxc/xc_sr_save_x86_hvm.c | 6 ++++++ tools/libxc/xc_sr_save_x86_pv.c | 10 ++++++---- tools/python/scripts/convert-legacy-stream | 9 ++++++++- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h index 51e3d3ee3b..fd7fb67305 100644 --- a/tools/libxc/xc_sr_common.h +++ b/tools/libxc/xc_sr_common.h @@ -63,8 +63,14 @@ struct xc_sr_save_ops int (*setup)(struct xc_sr_context *ctx); =20 /** - * Send records which need to be at the start of the stream. This is - * called once, after the Image and Domain headers are written. + * Send static records at the head of the stream. This is called once, + * after the Image and Domain headers are written. + */ + int (*static_data)(struct xc_sr_context *ctx); + + /** + * Send dynamic records which need to be at the start of the stream. = This + * is called after the STATIC_DATA_END record is written. */ int (*start_of_stream)(struct xc_sr_context *ctx); =20 diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c index 5c5ce18ac3..2b6c55af2a 100644 --- a/tools/libxc/xc_sr_save.c +++ b/tools/libxc/xc_sr_save.c @@ -13,7 +13,7 @@ static int write_headers(struct xc_sr_context *ctx, uint1= 6_t guest_type) struct xc_sr_ihdr ihdr =3D { .marker =3D IHDR_MARKER, .id =3D htonl(IHDR_ID), - .version =3D htonl(2), + .version =3D htonl(3), .options =3D htons(IHDR_OPT_LITTLE_ENDIAN), }; struct xc_sr_dhdr dhdr =3D { @@ -55,6 +55,16 @@ static int write_end_record(struct xc_sr_context *ctx) } =20 /* + * Writes a STATIC_DATA_END record into the stream. + */ +static int write_static_data_end_record(struct xc_sr_context *ctx) +{ + struct xc_sr_record end =3D { .type =3D REC_TYPE_STATIC_DATA_END }; + + return write_record(ctx, &end); +} + +/* * Writes a CHECKPOINT record into the stream. */ static int write_checkpoint_record(struct xc_sr_context *ctx) @@ -849,6 +859,14 @@ static int save(struct xc_sr_context *ctx, uint16_t gu= est_type) if ( rc ) goto err; =20 + rc =3D ctx->save.ops.static_data(ctx); + if ( rc ) + goto err; + + rc =3D write_static_data_end_record(ctx); + if ( rc ) + goto err; + rc =3D ctx->save.ops.start_of_stream(ctx); if ( rc ) goto err; diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_= hvm.c index d99efe65e5..93bcc1c273 100644 --- a/tools/libxc/xc_sr_save_x86_hvm.c +++ b/tools/libxc/xc_sr_save_x86_hvm.c @@ -170,6 +170,11 @@ static int x86_hvm_setup(struct xc_sr_context *ctx) return 0; } =20 +static int x86_hvm_static_data(struct xc_sr_context *ctx) +{ + return 0; +} + static int x86_hvm_start_of_stream(struct xc_sr_context *ctx) { return 0; @@ -228,6 +233,7 @@ struct xc_sr_save_ops save_ops_x86_hvm =3D .pfn_to_gfn =3D x86_hvm_pfn_to_gfn, .normalise_page =3D x86_hvm_normalise_page, .setup =3D x86_hvm_setup, + .static_data =3D x86_hvm_static_data, .start_of_stream =3D x86_hvm_start_of_stream, .start_of_checkpoint =3D x86_hvm_start_of_checkpoint, .end_of_checkpoint =3D x86_hvm_end_of_checkpoint, diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_p= v.c index f3ccf5bb4b..46019d962d 100644 --- a/tools/libxc/xc_sr_save_x86_pv.c +++ b/tools/libxc/xc_sr_save_x86_pv.c @@ -1052,14 +1052,15 @@ static int x86_pv_setup(struct xc_sr_context *ctx) return 0; } =20 +static int x86_pv_static_data(struct xc_sr_context *ctx) +{ + return write_x86_pv_info(ctx); +} + static int x86_pv_start_of_stream(struct xc_sr_context *ctx) { int rc; =20 - rc =3D write_x86_pv_info(ctx); - if ( rc ) - return rc; - /* * Ideally should be able to change during migration. Currently * corruption will occur if the contents or location of the P2M changes @@ -1126,6 +1127,7 @@ struct xc_sr_save_ops save_ops_x86_pv =3D .pfn_to_gfn =3D x86_pv_pfn_to_gfn, .normalise_page =3D x86_pv_normalise_page, .setup =3D x86_pv_setup, + .static_data =3D x86_pv_static_data, .start_of_stream =3D x86_pv_start_of_stream, .start_of_checkpoint =3D x86_pv_start_of_checkpoint, .end_of_checkpoint =3D x86_pv_end_of_checkpoint, diff --git a/tools/python/scripts/convert-legacy-stream b/tools/python/scri= pts/convert-legacy-stream index 02a194178f..ca93a93848 100755 --- a/tools/python/scripts/convert-legacy-stream +++ b/tools/python/scripts/convert-legacy-stream @@ -79,7 +79,7 @@ def write_libxc_ihdr(): stream_write(pack(libxc.IHDR_FORMAT, libxc.IHDR_MARKER, # Marker libxc.IHDR_IDENT, # Ident - 2, # Version + 3, # Version libxc.IHDR_OPT_LE, # Options 0, 0)) # Reserved =20 @@ -166,6 +166,9 @@ def write_libxc_hvm_params(params): pack(libxc.HVM_PARAMS_FORMAT, len(params) / 2, 0), pack("Q" * len(params), *params)) =20 +def write_libxc_static_data_end(): + write_record(libxc.REC_TYPE_static_data_end) + def write_libxl_end(): write_record(libxl.REC_TYPE_end) =20 @@ -590,6 +593,10 @@ def read_legacy_stream(vm): =20 if pv: read_pv_extended_info(vm) + + write_libxc_static_data_end() + + if pv: read_pv_p2m_frames(vm) =20 read_chunks(vm) --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel