From nobody Tue Feb 10 04:15:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1597746666; cv=none; d=zohomail.com; s=zohoarc; b=kyTCe6vbg34D7R09Bv5dN/F4WvcQfHiJlZO1UJFgbpwvMiTDN5KLXgjZIGiFDU6qMePGVh2LJmv7GQJDQcBJCDuTbxTCqsvjh9ehj6ScoV2zwVYkrLPemOWp5qAkYM+IIJNk41SXgz0dShpXG/QMANHCTMB30MC7XxZdJUh8b8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597746666; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nABtIpE3ocPIbmrY/Y6TR8lqLGhPX2t/r6AUyXMJ7rQ=; b=nqcEseVPGakIpP4du2ZEPWENls9tQoW1ffnBl+SC4wp4WmHEfzW/uC3pccmosD1J9MTWpm7ds6jkbDaGE+FBVdetBez3jODGMFbTagiyRMAQgFCu04acQlnsUUNPY23NELjwEuGWpNVtecLVjbKKs2ua2UZW4Veznkqh0ehU6MU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1597746666598319.6815431514783; Tue, 18 Aug 2020 03:31:06 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k7ytH-00067M-BC; Tue, 18 Aug 2020 10:30:51 +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.92) (envelope-from ) id 1k7ytF-0005zo-Mw for xen-devel@lists.xenproject.org; Tue, 18 Aug 2020 10:30:49 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9e8c31ba-2ac6-408d-a3f2-7ae4f002bea8; Tue, 18 Aug 2020 10:30:43 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k7yt9-000145-1w; Tue, 18 Aug 2020 10:30:43 +0000 Received: from host31-48-92-96.range31-48.btcentralplus.com ([31.48.92.96] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k7yt8-0003Rw-Ql; Tue, 18 Aug 2020 10:30:43 +0000 X-Inumbo-ID: 9e8c31ba-2ac6-408d-a3f2-7ae4f002bea8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=nABtIpE3ocPIbmrY/Y6TR8lqLGhPX2t/r6AUyXMJ7rQ=; b=IoU2922M7bsU8yeqsYH6tiihY2 MshAGFNsqPc9jChRx63ddW1Tnzs1arwkJnNJf/hsJPYzd3UfT7dD8BL+cNST851In1hjxrAJPJ/Fm FfBQNVMEeuTNM5S1jG/VeVXy+7K3Z2M4gD3+GkSxUqNkRaduD9aUP/K8NUnoH/rp/vgc=; From: Paul Durrant To: xen-devel@lists.xenproject.org Cc: Paul Durrant , Ian Jackson , Wei Liu Subject: [PATCH v7 6/9] tools/libxc: split restore handler handle_shared_info() functionality Date: Tue, 18 Aug 2020 11:30:29 +0100 Message-Id: <20200818103032.3050-7-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200818103032.3050-1-paul@xen.org> References: <20200818103032.3050-1-paul@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @xen.org) Content-Type: text/plain; charset="utf-8" From: Paul Durrant The code is invoked when a SHARED_INFO record is processed but actually performs two functions: [1] Copy the 'vcpu_info' and 'arch' substructures from the record into the new domain's shared_info [2] Clear out any pending event channel state, mask all channels and also clear 'arch.pfn_to_mfn_frame_list_list' To facilitate deprecation of the SHARED_INFO record in version 4 of the migration stream, this patch splits the functionality, leaving [1] in handle_shared_info() and adding update_shared_info() (called from x86_pv_stream_complete()) to deal with [2]. Signed-off-by: Paul Durrant --- Cc: Ian Jackson Cc: Wei Liu v7: - New in v7 --- tools/libxc/xc_sr_restore_x86_pv.c | 31 +++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_sr_restore_x86_pv.c b/tools/libxc/xc_sr_restore= _x86_pv.c index d086271efb..1ed8cc66ca 100644 --- a/tools/libxc/xc_sr_restore_x86_pv.c +++ b/tools/libxc/xc_sr_restore_x86_pv.c @@ -880,7 +880,6 @@ static int handle_shared_info(struct xc_sr_context *ctx, struct xc_sr_record *rec) { xc_interface *xch =3D ctx->xch; - unsigned int i; int rc =3D -1; shared_info_any_t *guest_shinfo =3D NULL; const shared_info_any_t *old_shinfo =3D rec->data; @@ -911,6 +910,32 @@ static int handle_shared_info(struct xc_sr_context *ct= x, MEMCPY_FIELD(guest_shinfo, old_shinfo, vcpu_info, ctx->x86.pv.width); MEMCPY_FIELD(guest_shinfo, old_shinfo, arch, ctx->x86.pv.width); =20 + rc =3D 0; + + err: + if ( guest_shinfo ) + munmap(guest_shinfo, PAGE_SIZE); + + return rc; +} + +static int update_shared_info(struct xc_sr_context *ctx) +{ + xc_interface *xch =3D ctx->xch; + unsigned int i; + int rc =3D -1; + shared_info_any_t *guest_shinfo =3D NULL; + + guest_shinfo =3D xc_map_foreign_range( + xch, ctx->domid, PAGE_SIZE, PROT_READ | PROT_WRITE, + ctx->dominfo.shared_info_frame); + if ( !guest_shinfo ) + { + PERROR("Failed to map Shared Info at mfn %#lx", + ctx->dominfo.shared_info_frame); + goto err; + } + SET_FIELD(guest_shinfo, arch.pfn_to_mfn_frame_list_list, 0, ctx->x86.pv.width); =20 @@ -1122,6 +1147,10 @@ static int x86_pv_stream_complete(struct xc_sr_conte= xt *ctx) xc_interface *xch =3D ctx->xch; int rc; =20 + rc =3D update_shared_info(ctx); + if ( rc ) + return rc; + rc =3D update_vcpu_context(ctx); if ( rc ) return rc; --=20 2.20.1