From patchwork Wed Feb 3 04:01:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Druzhinin X-Patchwork-Id: 12063365 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=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 3DF67C433E0 for ; Wed, 3 Feb 2021 04:02:23 +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 DB49064DE1 for ; Wed, 3 Feb 2021 04:02:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB49064DE1 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com 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.80799.147976 (Exim 4.92) (envelope-from ) id 1l79MV-0006Rb-WF; Wed, 03 Feb 2021 04:01:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 80799.147976; Wed, 03 Feb 2021 04:01:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l79MV-0006RU-SZ; Wed, 03 Feb 2021 04:01:51 +0000 Received: by outflank-mailman (input) for mailman id 80799; Wed, 03 Feb 2021 04:01:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l79MU-0006RP-6f for xen-devel@lists.xenproject.org; Wed, 03 Feb 2021 04:01:50 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c8f78852-189c-454d-b59e-d2992d4cbd2d; Wed, 03 Feb 2021 04:01:48 +0000 (UTC) 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: c8f78852-189c-454d-b59e-d2992d4cbd2d DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1612324908; h=from:to:cc:subject:date:message-id:mime-version; bh=xn/6xO8m4ShHK03f/t/BD4tc59kJO62bHplznEoYNZo=; b=EF9x/yez1HG34Vg/KRPRtBxkiokx0brURgHqtRHeUKfLODoqgvW8Y06q UjArvSmZh0gMEn/8S83nNbjLR7gi43BR/o5oBt35LKdRHF2xWTkffumU/ mAKoaraPAZ8s7crzaBdA/Ejiu5cMBfHs3UlOC/7mV0ErkW6KCWzsd9iTh 8=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: qtrqTeT6IsDhu2KYKR6HMfg0X5okI/fJ93wJedDLVjcoqqLidFa/AkOHVMAG2RXNrWZgEGrDZy EFqxU1LveUtZHH7h1iTmkuHNl6epr9XCGC56wPq+Vw2DHvL6ZKbL8zJR0ike8ThLlK1zHgeG/G 9B0uUWCLZaEYS9Jb3UNXE/PxdRVe6mpjJtXgyI6z7dP9C8jyeord7n1iX8+SoH9Ge9oUv61uTr IU4xvZzhMCrSpFcStquBElrYQYmqZ6r7domu6/FOQ3Wuh/o8txjrg3JMMbrPkems7I+qfkgsup iiw= X-SBRS: 4.0 X-MesageID: 36808232 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.79,397,1602561600"; d="scan'208";a="36808232" From: Igor Druzhinin To: CC: , , , , Igor Druzhinin Subject: [PATCH] tools/libxl: only set viridian flags on new domains Date: Wed, 3 Feb 2021 04:01:29 +0000 Message-ID: <1612324889-20942-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Domains migrating or restoring should have viridian HVM param key in the migration stream already and setting that twice results in Xen returing -EEXIST on the second attempt later (during migration stream parsing) in case the values don't match. That causes migration/restore operation to fail at destination side. That issue is now resurfaced by the latest commits (983524671 and 7e5cffcd1e) extending default viridian feature set making the values from the previous migration streams and those set at domain construction different. Signed-off-by: Igor Druzhinin Acked-by: Andrew Cooper --- tools/libs/light/libxl_arch.h | 6 ++++-- tools/libs/light/libxl_arm.c | 4 +++- tools/libs/light/libxl_dom.c | 2 +- tools/libs/light/libxl_x86.c | 11 ++++++++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tools/libs/light/libxl_arch.h b/tools/libs/light/libxl_arch.h index 6a91775..c305d70 100644 --- a/tools/libs/light/libxl_arch.h +++ b/tools/libs/light/libxl_arch.h @@ -30,8 +30,10 @@ int libxl__arch_domain_save_config(libxl__gc *gc, /* arch specific internal domain creation function */ _hidden -int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, - uint32_t domid); +int libxl__arch_domain_create(libxl__gc *gc, + libxl_domain_config *d_config, + libxl__domain_build_state *state, + uint32_t domid); /* setup arch specific hardware description, i.e. DTB on ARM */ _hidden diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index 66e8a06..8c4eda3 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -126,7 +126,9 @@ int libxl__arch_domain_save_config(libxl__gc *gc, return 0; } -int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, +int libxl__arch_domain_create(libxl__gc *gc, + libxl_domain_config *d_config, + ibxl__domain_build_state *state, uint32_t domid) { return 0; diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c index 1916857..842a51c 100644 --- a/tools/libs/light/libxl_dom.c +++ b/tools/libs/light/libxl_dom.c @@ -378,7 +378,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid); state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid); - rc = libxl__arch_domain_create(gc, d_config, domid); + rc = libxl__arch_domain_create(gc, d_config, state, domid); /* Construct a CPUID policy, but only for brand new domains. Domains * being migrated-in/restored have CPUID handled during the diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c index 91a9fc7..58187ed 100644 --- a/tools/libs/light/libxl_x86.c +++ b/tools/libs/light/libxl_x86.c @@ -453,8 +453,10 @@ static int hvm_set_conf_params(libxl__gc *gc, uint32_t domid, return ret; } -int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, - uint32_t domid) +int libxl__arch_domain_create(libxl__gc *gc, + libxl_domain_config *d_config, + libxl__domain_build_state *state, + uint32_t domid) { const libxl_domain_build_info *info = &d_config->b_info; int ret = 0; @@ -466,7 +468,10 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, (ret = hvm_set_conf_params(gc, domid, info)) != 0) goto out; - if (info->type == LIBXL_DOMAIN_TYPE_HVM && + /* Viridian flags are already a part of the migration stream so set + * them here only for brand new domains. */ + if (!state->restore && + info->type == LIBXL_DOMAIN_TYPE_HVM && (ret = hvm_set_viridian_features(gc, domid, info)) != 0) goto out;