From patchwork Fri Jan 3 13:06:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11316905 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 586751580 for ; Fri, 3 Jan 2020 13:07:54 +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 352C420866 for ; Fri, 3 Jan 2020 13:07:54 +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="hBA5VhvH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 352C420866 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 1inMfA-00046k-2C; Fri, 03 Jan 2020 13:06:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1inMf8-00046C-D3 for xen-devel@lists.xenproject.org; Fri, 03 Jan 2020 13:06:46 +0000 X-Inumbo-ID: dfb1f22e-2e29-11ea-a914-bc764e2007e4 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id dfb1f22e-2e29-11ea-a914-bc764e2007e4; Fri, 03 Jan 2020 13:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578056798; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=bHE34mz55AI6eBPHMQXmopKla4bbLs51RrfmKWEJhFU=; b=hBA5VhvHJH6TX22e1jjCp4+BP9dGrwevg2C5X3uZNaFYwR6gRG8nPA3R EEomZmuX2xR1uZUtVj2+unCRWCgJUlEQRQPQfOTwuJ4V3kbogxv7YaQeD hHBsIGEx4hjwd2nDgVfbwCoPjIm9LKqIJhi6OFL2RSYeYqGt/lFelzLi1 U=; Authentication-Results: esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 6jVAkSzLzgfI9cGZEb6IVRTK0PPnlZfsW1uolWAsPwYe2ZVVFTDP44cKzSNtCR741fS1s8D1ge kuYh97dzOTJ9W5wcRU+NaGBSFjjM+Kdco2JPOz/2yqPif8PKvwBs7ShCVAiz8U/sW1m2141zra +uKDAeywhtGtZD9cQhHWp9EMo2QbYhQDgtMDeFk4ue1afPI19paV8s17E+xErbP73zpoWxl5aP iuPs6K3IAKJQc4MbB55KDYPU2VXMvc+4cYmHBhfmxmXiHqe4ETHIb/2ePgvhZK9lz6baTyxS6k 5yo= X-SBRS: 2.7 X-MesageID: 10406761 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,390,1571716800"; d="scan'208";a="10406761" From: Andrew Cooper To: Xen-devel Date: Fri, 3 Jan 2020 13:06:14 +0000 Message-ID: <20200103130616.13724-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200103130616.13724-1-andrew.cooper3@citrix.com> References: <20200103130616.13724-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 18/20] tools/libxl: Plumb domain_create_state down into libxl__build_pre() 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: Anthony PERARD , Andrew Cooper , Wei Liu , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" To fix CPUID handling, libxl__build_pre() is going to have to distinguish between a brand new VM vs one which is being migrated-in/resumed. No functional change. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD The data handling is completely chaotic, but I can't find a less bad way of doing this. It really doesn't help that DCS is the superset contining domain_{build,create}_config and domain_build_state, rather than being symetric with its similarly named counterparts. Suggestions welcome. --- tools/libxl/libxl_create.c | 16 ++++++++-------- tools/libxl/libxl_dm.c | 5 +++-- tools/libxl/libxl_dom.c | 4 +++- tools/libxl/libxl_internal.h | 11 ++++------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index fdc76917dc..a8fa4ca11b 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -431,17 +431,17 @@ static void init_console_info(libxl__gc *gc, Only 'channels' when mapped to consoles have a string name. */ } -int libxl__domain_build(libxl__gc *gc, - libxl_domain_config *d_config, - uint32_t domid, - libxl__domain_build_state *state) +int libxl__domain_build(libxl__gc *gc, uint32_t domid, + libxl__domain_create_state *dcs) { + libxl_domain_config *d_config = dcs->guest_config; libxl_domain_build_info *const info = &d_config->b_info; + libxl__domain_build_state *state = &dcs->build_state; char **vments = NULL, **localents = NULL; struct timeval start_time; int i, ret; - ret = libxl__build_pre(gc, domid, d_config, state); + ret = libxl__build_pre(gc, domid, dcs); if (ret) goto out; @@ -1218,7 +1218,7 @@ static void domcreate_bootloader_done(libxl__egc *egc, dcs->sdss.callback = domcreate_devmodel_started; if (restore_fd < 0 && dcs->domid_soft_reset == INVALID_DOMID) { - rc = libxl__domain_build(gc, d_config, domid, state); + rc = libxl__domain_build(gc, domid, dcs); domcreate_rebuild_done(egc, dcs, rc); return; } @@ -1245,7 +1245,7 @@ static void domcreate_bootloader_done(libxl__egc *egc, goto out; } - rc = libxl__build_pre(gc, domid, d_config, state); + rc = libxl__build_pre(gc, domid, dcs); if (rc) goto out; @@ -1567,7 +1567,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, dcs->sdss.dm.guest_domid = domid; if (libxl_defbool_val(d_config->b_info.device_model_stubdomain)) - libxl__spawn_stub_dm(egc, &dcs->sdss); + libxl__spawn_stub_dm(egc, dcs); else libxl__spawn_local_dm(egc, &dcs->sdss.dm); diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index dac1b8ddb8..b595dc03b3 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2094,8 +2094,9 @@ char *libxl__stub_dm_name(libxl__gc *gc, const char *guest_name) return GCSPRINTF("%s-dm", guest_name); } -void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) +void libxl__spawn_stub_dm(libxl__egc *egc, libxl__domain_create_state *dcs) { + libxl__stub_dm_spawn_state *sdss = &dcs->sdss; STATE_AO_GC(sdss->dm.spawn.ao); libxl_ctx *ctx = libxl__gc_owner(gc); int ret; @@ -2194,7 +2195,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) if (ret) goto out; uint32_t dm_domid = sdss->pvqemu.guest_domid; - ret = libxl__domain_build(gc, dm_config, dm_domid, stubdom_state); + ret = libxl__domain_build(gc, dm_domid, dcs); if (ret) goto out; diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 573c63692b..01aefa6ce4 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -244,9 +244,11 @@ static int numa_place_domain(libxl__gc *gc, uint32_t domid, } int libxl__build_pre(libxl__gc *gc, uint32_t domid, - libxl_domain_config *d_config, libxl__domain_build_state *state) + libxl__domain_create_state *dcs) { + libxl_domain_config *d_config = dcs->guest_config; libxl_domain_build_info *const info = &d_config->b_info; + libxl__domain_build_state *state = &dcs->build_state; libxl_ctx *ctx = libxl__gc_owner(gc); char *xs_domid, *con_domid; int rc; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index b5adbfe4b7..16dc02e8a3 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1389,8 +1389,7 @@ _hidden void libxl__domain_build_state_init(libxl__domain_build_state *s); _hidden void libxl__domain_build_state_dispose(libxl__domain_build_state *s); _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, - libxl_domain_config * const d_config, - libxl__domain_build_state *state); + libxl__domain_create_state *dcs); _hidden int libxl__build_post(libxl__gc *gc, uint32_t domid, libxl_domain_build_info *info, libxl__domain_build_state *state, char **vms_ents, char **local_ents); @@ -1960,10 +1959,8 @@ _hidden int libxl__domain_make(libxl__gc *gc, libxl__domain_build_state *state, uint32_t *domid); -_hidden int libxl__domain_build(libxl__gc *gc, - libxl_domain_config *d_config, - uint32_t domid, - libxl__domain_build_state *state); +_hidden int libxl__domain_build(libxl__gc *gc, uint32_t domid, + libxl__domain_create_state *dcs); /* for device model creation */ _hidden const char *libxl__domain_device_model(libxl__gc *gc, @@ -4114,7 +4111,7 @@ typedef struct { libxl__xswait_state xswait; } libxl__stub_dm_spawn_state; -_hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state*); +_hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__domain_create_state *dcs); _hidden char *libxl__stub_dm_name(libxl__gc *gc, const char * guest_name);