From patchwork Fri Oct 18 15:06:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 11198625 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 0EFAB14E5 for ; Fri, 18 Oct 2019 15:09:39 +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 D1642222C6 for ; Fri, 18 Oct 2019 15:09:38 +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="gS4a1VAk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1642222C6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=eu.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 1iLTqV-00054g-Uf; Fri, 18 Oct 2019 15:07:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqU-00054D-Hs for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:14 +0000 X-Inumbo-ID: ef3f4032-f1b8-11e9-beca-bc764e2007e4 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ef3f4032-f1b8-11e9-beca-bc764e2007e4; Fri, 18 Oct 2019 15:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411220; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=1jKUJSikxB9yiqNmqcnpVueJx6HmmRvphhPyUj0dFVU=; b=gS4a1VAk6P3WaQsTCBd04wvj4aw3D13iCqFuqni7a9y04bARJVIwR0On lI7ZndHmRyZnZoFZaIFWstUBlr/OgZEcxGkVGZQHjwrL+1iSx0UUsbUWo 8vZiqmUnqFKG3LPVNUuudzd+SaAt+nEnykmHcSEaocCaz85t4PhaA7CsL I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@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 (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: +WhMRasiYSJn4GUg5s3ARFnsrReYPOnnJS+Mh5D7JXTC++r/4iWnx3nZ5jXpih7WxyjlRm9g37 4mEPAMELT53ahHohWNIPwKZ0WUIUuzo6e+1q6QmbWb5/BUbBdVC29KxNvjF1Un2Td2GST+fD9p QhvKaCRbsCHeDWecwaum6bFiPHfuCPGGHGad2/Fvp2JiK2GPypK0uxNYeqJ8zbEtX61eBDT0KK 6MRhT3fPKQh8OO2kHAsKHGrRGyKIjr9WP8widub4+oXCkYvSoBmFEKSfuvg1PRHWCR+2zd0dAd SJE= X-SBRS: 2.7 X-MesageID: 7434355 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7434355" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:46 +0100 Message-ID: <20191018150653.24862-4-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 03/10] libxl: libxl__domain_config_setdefault: New function 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Break out this into a new function. We are going to want to call it from a new call site. Unfortunately not all of the defaults can be moved into the new function without changing the order in which things are done. That does not seem wise at this stage of the release. The effect is that additional calls to libxl__domain_config_setdefault (which are going to be introduced) do not quite set everything. But they will do what is needed. After Xen 4.13 is done, we should move those settings into the right order. No functional change. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- v2: Add missing error check --- tools/libxl/libxl_create.c | 41 +++++++++++++++++++++++++++++------------ tools/libxl/libxl_internal.h | 3 +++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 099761a2d7..fd8bb22be9 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -862,22 +862,14 @@ static void domcreate_destruction_cb(libxl__egc *egc, libxl__domain_destroy_state *dds, int rc); -static void initiate_domain_create(libxl__egc *egc, - libxl__domain_create_state *dcs) +int libxl__domain_config_setdefault(libxl__gc *gc, + libxl_domain_config *d_config, + uint32_t domid) { - STATE_AO_GC(dcs->ao); libxl_ctx *ctx = libxl__gc_owner(gc); - uint32_t domid; - int i, ret; + int ret; bool pod_enabled = false; - /* convenience aliases */ - libxl_domain_config *const d_config = dcs->guest_config; - const int restore_fd = dcs->restore_fd; - - domid = dcs->domid_soft_reset; - libxl__domain_build_state_init(&dcs->build_state); - if (d_config->c_info.ssid_label) { char *s = d_config->c_info.ssid_label; ret = libxl_flask_context_to_sid(ctx, s, strlen(s), @@ -1008,6 +1000,28 @@ static void initiate_domain_create(libxl__egc *egc, goto error_out; } + ret = 0; + error_out: + return ret; +} + +static void initiate_domain_create(libxl__egc *egc, + libxl__domain_create_state *dcs) +{ + STATE_AO_GC(dcs->ao); + uint32_t domid; + int i, ret; + + /* convenience aliases */ + libxl_domain_config *const d_config = dcs->guest_config; + const int restore_fd = dcs->restore_fd; + + domid = dcs->domid_soft_reset; + libxl__domain_build_state_init(&dcs->build_state); + + ret = libxl__domain_config_setdefault(gc,d_config,domid); + if (ret) goto error_out; + ret = libxl__domain_make(gc, d_config, &dcs->build_state, &domid); if (ret) { LOGD(ERROR, domid, "cannot make domain: %d", ret); @@ -1019,6 +1033,9 @@ static void initiate_domain_create(libxl__egc *egc, dcs->guest_domid = domid; dcs->sdss.dm.guest_domid = 0; /* means we haven't spawned */ + /* post-4.13 todo: move these next bits of defaulting to + * libxl__domain_config_setdefault */ + /* * Set the dm version quite early so that libxl doesn't have to pass the * build info around just to know if the domain has a device model or not. diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index d2d5af746b..50ac7b64ed 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1440,6 +1440,9 @@ _hidden int libxl__resolve_domid(libxl__gc *gc, const char *name, * All libxl API functions are expected to have arranged for this * to be called before using any values within these structures. */ +_hidden int libxl__domain_config_setdefault(libxl__gc *gc, + libxl_domain_config *d_config, + uint32_t domid /* logging only */); _hidden int libxl__domain_create_info_setdefault(libxl__gc *gc, libxl_domain_create_info *c_info); _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc,