All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Wei Liu <wl@xen.org>, Andrew Cooper <Andrew.Cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Paul Durrant <pdurrant@gmail.com>,
	Jan Beulich <jbeulich@suse.com>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [Xen-devel] [XEN PATCH for-4.13 v2 3/9] libxl: libxl__domain_config_setdefault: New function
Date: Thu, 10 Oct 2019 16:11:05 +0100	[thread overview]
Message-ID: <20191010151111.22125-4-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <20191010151111.22125-1-ian.jackson@eu.citrix.com>

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 <ian.jackson@eu.citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
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,
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-10-10 15:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 15:11 [Xen-devel] [XEN PATCH for-4.13 v2 0/9] libxl memkb & pt defaulting Ian Jackson
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 1/9] libxl: Offer API versions 0x040700 and 0x040800 Ian Jackson
2019-11-25 18:44   ` Jim Fehlig
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 2/9] xl: Pass libxl_domain_config to freemem(), instead of b_info Ian Jackson
2019-10-10 15:11 ` Ian Jackson [this message]
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 4/9] libxl: libxl_domain_need_memory: Make it take a domain_config Ian Jackson
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 5/9] libxl: Move shadow_memkb and iommu_memkb defaulting into libxl Ian Jackson
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 6/9] libxl: Remove/deprecate libxl_get_required_*_memory from the API Ian Jackson
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 7/9] libxl: create: setdefault: Make libxl_physinfo info[1] Ian Jackson
2019-10-11  9:26   ` Wei Liu
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 8/9] libxl: create: setdefault: Move physinfo into config_setdefault Ian Jackson
2019-10-11  9:26   ` Wei Liu
2019-10-10 15:11 ` [Xen-devel] [XEN PATCH for-4.13 v2 9/9] libxl/xl: Overhaul passthrough setting logic Ian Jackson
2019-10-11  9:26   ` Wei Liu
2019-10-11  9:47   ` Andrew Cooper
2019-10-11 10:10     ` Ian Jackson
2019-10-11 11:00     ` Julien Grall
2019-10-11 13:33       ` Ian Jackson
2019-10-11 12:23   ` George Dunlap
2019-10-11 13:31     ` Ian Jackson
2019-10-11 13:55       ` Jürgen Groß
2019-10-11 16:34         ` Ian Jackson
2019-10-14  7:59           ` Paul Durrant
2019-10-14 16:09             ` Ian Jackson
2019-10-14 16:44               ` Wei Liu
2019-10-14 16:48                 ` Ian Jackson
2019-10-14 16:51                   ` [Xen-devel] [XEN PATCH v4 for-4.13 10/10] libxl/xl: Overhaul passthrough setting logic " Ian Jackson
2019-10-14 17:06                     ` Anthony PERARD
2019-10-14 16:59               ` [Xen-devel] [XEN PATCH for-4.13 v2 9/9] libxl/xl: Overhaul " Anthony PERARD
2019-10-15 11:13                 ` Wei Liu
2019-10-10 15:18 ` [Xen-devel] [XEN PATCH for-4.13 v2 0/9] libxl memkb & pt defaulting Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010151111.22125-4-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=pdurrant@gmail.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.