From patchwork Thu Jul 1 09:56:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olaf Hering X-Patchwork-Id: 12353861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DE35C11F64 for ; Thu, 1 Jul 2021 09:57:29 +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 2A49E611C2 for ; Thu, 1 Jul 2021 09:57:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A49E611C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aepfle.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.148361.274298 (Exim 4.92) (envelope-from ) id 1lytRj-0002Oa-8u; Thu, 01 Jul 2021 09:57:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 148361.274298; Thu, 01 Jul 2021 09:57:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lytRj-0002Nz-0W; Thu, 01 Jul 2021 09:57:23 +0000 Received: by outflank-mailman (input) for mailman id 148361; Thu, 01 Jul 2021 09:57:21 +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 1lytRg-0004XT-SM for xen-devel@lists.xenproject.org; Thu, 01 Jul 2021 09:57:20 +0000 Received: from mo4-p02-ob.smtp.rzone.de (unknown [85.215.255.80]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8a889ee9-8a7f-45e2-9550-29b8986b84eb; Thu, 01 Jul 2021 09:56:50 +0000 (UTC) Received: from sender by smtp.strato.de (RZmta 47.28.1 AUTH) with ESMTPSA id 30791cx619ui5Mt (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 1 Jul 2021 11:56:44 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8a889ee9-8a7f-45e2-9550-29b8986b84eb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1625133405; s=strato-dkim-0002; d=aepfle.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=ZxRdsP8qr4H2zPhSJi5htgzgprczUQRiHOrKeRY262U=; b=pySoDWwLANK1H+EV2djdxCEct7RE0o92/5MBJbj9uBZ20QaDBrkor4fsJbbwF94Qn9 oF1R0s3ZGgNTnRhVBs2zFr9xUaFrc05L/dLZ9Nzt/Dm8OED46IxiswjcVursv+j1XV33 AoGb2AbwrJHSbv3JRr2z5oLqykleezJJsMFrzc2GynrNFEQuCPjitiAdlsMojAPB7yCD Vm75lhMVX30wiJ8nX34ukRMOo4OMFU9JS0L4jqN62m9qq9MbSqo9C+whOKhmgYkc1nb+ K8s6BcDCbkJD5IEq2RrYG7wuVdlm9mtUdqVg3VuHlqDnCWXxPdwBIkdYWk2BL3NfKV9e 7m2A== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpIG0mv9coXAg5lqlz7EsstGyDcxK3Mbajr+SQKopp1Cb0CyyaZQQ==" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: xen-devel@lists.xenproject.org Cc: Olaf Hering , Ian Jackson , Wei Liu , Juergen Gross Subject: [PATCH v20210701 12/40] tools: unify type checking for data pfns in migration stream Date: Thu, 1 Jul 2021 11:56:07 +0200 Message-Id: <20210701095635.15648-13-olaf@aepfle.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210701095635.15648-1-olaf@aepfle.de> References: <20210701095635.15648-1-olaf@aepfle.de> MIME-Version: 1.0 Introduce a helper which decides if a given pfn in the migration stream is backed by memory. This specifically deals with type XEN_DOMCTL_PFINFO_XALLOC, which was a synthetic toolstack-only type used in Xen 4.2 to 4.5. It indicated a dirty page on the sending side for which no data will be send in the initial iteration. No change in behavior intended. Signed-off-by: Olaf Hering --- tools/libs/saverestore/common.h | 17 +++++++++++++++++ tools/libs/saverestore/restore.c | 5 ++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/libs/saverestore/common.h b/tools/libs/saverestore/common.h index 07c506360c..fa242e808d 100644 --- a/tools/libs/saverestore/common.h +++ b/tools/libs/saverestore/common.h @@ -500,6 +500,23 @@ static inline bool sr_is_known_page_type(xen_pfn_t type) return ret; } +static inline bool page_type_to_populate(uint32_t type) +{ + bool ret; + + switch (type) + { + case XEN_DOMCTL_PFINFO_XTAB: + case XEN_DOMCTL_PFINFO_BROKEN: + ret = false; + break; + case XEN_DOMCTL_PFINFO_XALLOC: + default: + ret = true; + break; + } + return ret; +} #endif /* * Local variables: diff --git a/tools/libs/saverestore/restore.c b/tools/libs/saverestore/restore.c index 324b9050e2..477b7527a1 100644 --- a/tools/libs/saverestore/restore.c +++ b/tools/libs/saverestore/restore.c @@ -152,9 +152,8 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned int count, for ( i = 0; i < count; ++i ) { - if ( (!types || (types && - (types[i] != XEN_DOMCTL_PFINFO_XTAB && - types[i] != XEN_DOMCTL_PFINFO_BROKEN))) && + if ( (!types || + (types && page_type_to_populate(types[i]) == true)) && !pfn_is_populated(ctx, original_pfns[i]) ) { rc = pfn_set_populated(ctx, original_pfns[i]);