Skip to contentSkip to conversation

libxl stubdom API cleanup

PATCH In review Vincent Hanquez 6 participants 21 messages Jul 7, 2010 – Jul 12, 2010

lore
Share & tools
lore
#0 lore raw

cover libxl stubdom API cleanup

This patch serie cleans the stubdom API, and remove some of the policy embedded in libxl. libxl users are expected to start explicitely a stubdomain instead of relying on a magic value in devicemodel_create.

Vincent Hanquez (3):
move stubdom make into a proper function
let the user of libxenlight choose explicitely if it want to start a
stubdom or not.
stubdom_create returns stubdomain domid so that unpause is done by
the user of libxenlight.

 tools/libxl/libxl.c      |   99 ++++++++++++++++++++++++++--------------------
 tools/libxl/libxl.h      |   25 +++++++++++-
 tools/libxl/xl_cmdimpl.c |   14 ++++++-
 3 files changed, 92 insertions(+), 46 deletions(-)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

PATCH 1/3 move stubdom make into a proper function

---
 tools/libxl/libxl.c |   72 ++++++++++++++++++++++++++++++++------------------
 tools/libxl/libxl.h |   10 +++++++
 2 files changed, 56 insertions(+), 26 deletions(-)
tools/libxl/libxl.c +46 -26
index 293aaa7..bf2c7e8 100644
@@ -80,7 +80,7 @@ int libxl_ctx_free(struct libxl_ctx *ctx)
 /******************************************************************************/
 
 int libxl_domain_make(struct libxl_ctx *ctx, libxl_domain_create_info *info,
-                       uint32_t *domid)
+                      uint32_t *domid)
 {
     int flags, ret, i, rc;
     char *uuid_string;
@@ -1020,6 +1020,41 @@ retry_transaction:
     return 0;
 }
 
+int libxl_stubdom_make(struct libxl_ctx *ctx, libxl_stubdom_create_info *info,
+                       libxl_domain_build_state *state, uint32_t *domid)
+{
+    int ret, i;
+    libxl_domain_create_info c_info;
+    libxl_domain_build_info b_info;
+
+    memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
+    c_info.hvm = 0;
+    c_info.name = libxl_sprintf(ctx, "%s-dm", libxl_domid_to_name(ctx, info->target_domid));
+    for (i = 0; i < 16; i++)
+        c_info.uuid[i] = info->uuid[i];
+
+    memset(&b_info, 0x00, sizeof(libxl_domain_build_info));
+    b_info.max_vcpus = 1;
+    b_info.max_memkb = info->max_memkb;
+    b_info.target_memkb = b_info.max_memkb;
+    b_info.kernel = libxl_abs_path(ctx, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
+    b_info.u.pv.cmdline = libxl_sprintf(ctx, " -d %d", info->target_domid);
+    b_info.u.pv.ramdisk = "";
+    b_info.u.pv.features = "";
+    b_info.hvm = 0;
+
+    ret = libxl_domain_make(ctx, &c_info, domid);
+    if (ret)
+        return ret;
+    ret = libxl_domain_build(ctx, &b_info, *domid, state);
+    if (ret)
+        return ret;
+
+    xc_domain_set_target(ctx->xch, *domid, info->target_domid);
+    xs_set_target(ctx->xsh, *domid, info->target_domid);
+    return 0;
+}
+
 static int libxl_create_stubdom(struct libxl_ctx *ctx,
                                 libxl_device_model_info *info,
                                 libxl_device_disk *disks, int num_disks,
@@ -1030,40 +1065,27 @@ static int libxl_create_stubdom(struct libxl_ctx *ctx,
 {
     int i, num_console = 1, ret;
     libxl_device_console *console;
-    libxl_domain_create_info c_info;
-    libxl_domain_build_info b_info;
     libxl_domain_build_state state;
     uint32_t domid;
     char **args;
     struct xs_permissions perm[2];
     xs_transaction_t t;
     libxl_device_model_starting *dm_starting = 0;
+    libxl_stubdom_create_info stubinfo;
+
+    /* initialize stubinfo create structure */
+    stubinfo.target_domid = info->domid;
+    stubinfo.max_memkb = 32 * 1024;
+    for (i = 0; i < 16; i++)
+        stubinfo.uuid[i] = info->uuid[i];
+    ret = libxl_stubdom_make(ctx, &stubinfo, &state, &domid);
+    if (ret)
+        return ret;
 
     args = libxl_build_device_model_args(ctx, info, vifs, num_vifs);
     if (!args)
         return ERROR_FAIL;
 
-    memset(&c_info, 0x00, sizeof(libxl_domain_create_info));
-    c_info.hvm = 0;
-    c_info.name = libxl_sprintf(ctx, "%s-dm", libxl_domid_to_name(ctx, info->domid));
-    for (i = 0; i < 16; i++)
-        c_info.uuid[i] = info->uuid[i];
-
-    memset(&b_info, 0x00, sizeof(libxl_domain_build_info));
-    b_info.max_vcpus = 1;
-    b_info.max_memkb = 32 * 1024;
-    b_info.target_memkb = b_info.max_memkb;
-    b_info.kernel = libxl_abs_path(ctx, "ioemu-stubdom.gz", libxl_xenfirmwaredir_path());
-    b_info.u.pv.cmdline = libxl_sprintf(ctx, " -d %d", info->domid);
-    b_info.u.pv.ramdisk = "";
-    b_info.u.pv.features = "";
-    b_info.hvm = 0;
-
-    ret = libxl_domain_make(ctx, &c_info, &domid);
-    if (ret) return ret;
-    ret = libxl_domain_build(ctx, &b_info, domid, &state);
-    if (ret) return ret;
-
     libxl_write_dmargs(ctx, domid, info->domid, args);
     libxl_xs_write(ctx, XBT_NULL,
                    libxl_sprintf(ctx, "%s/image/device-model-domid", libxl_xs_get_dompath(ctx, info->domid)),
@@ -1071,8 +1093,6 @@ static int libxl_create_stubdom(struct libxl_ctx *ctx,
     libxl_xs_write(ctx, XBT_NULL,
                    libxl_sprintf(ctx, "%s/target", libxl_xs_get_dompath(ctx, domid)),
                    "%d", info->domid);
-    xc_domain_set_target(ctx->xch, domid, info->domid);
-    xs_set_target(ctx->xsh, domid, info->domid);
 
     perm[0].id = domid;
     perm[0].perms = XS_PERM_NONE;
tools/libxl/libxl.h +10 -0
index 85f8196..a0a3a1a 100644
@@ -121,6 +121,13 @@ typedef struct {
 } libxl_domain_build_info;
 
 typedef struct {
+    uint8_t uuid[16];
+    char *name;
+    uint32_t max_memkb;
+    uint32_t target_domid;
+} libxl_stubdom_create_info;
+
+typedef struct {
     uint32_t store_port;
     unsigned long store_mfn;
     uint32_t console_port;
@@ -364,6 +371,9 @@ struct libxl_dominfo * libxl_list_domain(struct libxl_ctx*, int *nb_domain);
 struct libxl_poolinfo * libxl_list_pool(struct libxl_ctx*, int *nb_pool);
 struct libxl_vminfo * libxl_list_vm(struct libxl_ctx *ctx, int *nb_vm);
 
+int libxl_stubdom_make(struct libxl_ctx *ctx, libxl_stubdom_create_info *info,
+                       libxl_domain_build_state *state, uint32_t *domid);
+
 typedef struct libxl_device_model_starting libxl_device_model_starting;
 int libxl_create_device_model(struct libxl_ctx *ctx,
                               libxl_device_model_info *info,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

PATCH 2/3 let the user of libxenlight choose explicitely if it want to start a stubdom or not.

In reply to Vincent Hanquez

the same mechanism of choosing stubdomain or not, depending on the qemu-dm filename that was embedded in the libxenlight is moved to xl so that nothing change. also expose more functions that the caller is expected to used now.

---
 tools/libxl/libxl.c      |   30 +++++++++++-------------------
 tools/libxl/libxl.h      |   15 ++++++++++++++-
 tools/libxl/xl_cmdimpl.c |   12 ++++++++++--
 3 files changed, 35 insertions(+), 22 deletions(-)
tools/libxl/libxl.c +11 -19
index bf2c7e8..811678f 100644
@@ -949,10 +949,10 @@ void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild)
     xs_daemon_close(xsh);
 }
 
-static int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx,
-                                                    libxl_device_model_info *info,
-                                                    libxl_device_vfb *vfb,
-                                                    libxl_device_vkb *vkb)
+int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx,
+                                             libxl_device_model_info *info,
+                                             libxl_device_vfb *vfb,
+                                             libxl_device_vkb *vkb)
 {
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
@@ -1055,13 +1055,13 @@ int libxl_stubdom_make(struct libxl_ctx *ctx, libxl_stubdom_create_info *info,
     return 0;
 }
 
-static int libxl_create_stubdom(struct libxl_ctx *ctx,
-                                libxl_device_model_info *info,
-                                libxl_device_disk *disks, int num_disks,
-                                libxl_device_nic *vifs, int num_vifs,
-                                libxl_device_vfb *vfb,
-                                libxl_device_vkb *vkb,
-                                libxl_device_model_starting **starting_r)
+int libxl_stubdom_create(struct libxl_ctx *ctx,
+                         libxl_device_model_info *info,
+                         libxl_device_disk *disks, int num_disks,
+                         libxl_device_nic *vifs, int num_vifs,
+                         libxl_device_vfb *vfb,
+                         libxl_device_vkb *vkb,
+                         libxl_device_model_starting **starting_r)
 {
     int i, num_console = 1, ret;
     libxl_device_console *console;
@@ -1178,14 +1178,6 @@ int libxl_create_device_model(struct libxl_ctx *ctx,
     char *vm_path;
     char **pass_stuff;
 
-    if (strstr(info->device_model, "stubdom-dm")) {
-        libxl_device_vfb vfb;
-        libxl_device_vkb vkb;
-
-        libxl_vfb_and_vkb_from_device_model_info(ctx, info, &vfb, &vkb);
-        return libxl_create_stubdom(ctx, info, disks, num_disks, vifs, num_vifs, &vfb, &vkb, starting_r);
-    }
-
     args = libxl_build_device_model_args(ctx, info, vifs, num_vifs);
     if (!args)
         return ERROR_FAIL;
tools/libxl/libxl.h +14 -1
index a0a3a1a..76f9b5c 100644
@@ -336,6 +336,7 @@ typedef struct {
     char *token;
 } libxl_waiter;
 
+typedef struct libxl_device_model_starting libxl_device_model_starting;
 
 int libxl_get_wait_fd(struct libxl_ctx *ctx, int *fd);
 /* waiter is allocated by the caller */
@@ -374,7 +375,19 @@ struct libxl_vminfo * libxl_list_vm(struct libxl_ctx *ctx, int *nb_vm);
 int libxl_stubdom_make(struct libxl_ctx *ctx, libxl_stubdom_create_info *info,
                        libxl_domain_build_state *state, uint32_t *domid);
 
-typedef struct libxl_device_model_starting libxl_device_model_starting;
+int libxl_stubdom_create(struct libxl_ctx *ctx,
+                         libxl_device_model_info *info,
+                         libxl_device_disk *disks, int num_disks,
+                         libxl_device_nic *vifs, int num_vifs,
+                         libxl_device_vfb *vfb,
+                         libxl_device_vkb *vkb,
+                         libxl_device_model_starting **starting_r);
+
+int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx,
+                                             libxl_device_model_info *info,
+                                             libxl_device_vfb *vfb,
+                                             libxl_device_vkb *vkb);
+
 int libxl_create_device_model(struct libxl_ctx *ctx,
                               libxl_device_model_info *info,
                               libxl_device_disk *disk, int num_disks,
tools/libxl/xl_cmdimpl.c +10 -2
index 208ecd6..a20e77a 100644
@@ -1151,8 +1151,16 @@ start:
     }
     if (info1.hvm) {
         dm_info.domid = domid;
-        MUST( libxl_create_device_model(&ctx, &dm_info, disks, num_disks,
-                                        vifs, num_vifs, &dm_starting) );
+        if (strstr(dm_info.device_model, "stubdom-dm")) {
+            libxl_device_vfb vfb;
+            libxl_device_vkb vkb;
+
+            libxl_vfb_and_vkb_from_device_model_info(&ctx, &dm_info, &vfb, &vkb);
+            MUST( libxl_stubdom_create(&ctx, &dm_info, disks, num_disks, vifs, num_vifs, &vfb, &vkb, &dm_starting) );
+        } else {
+            MUST( libxl_create_device_model(&ctx, &dm_info, disks, num_disks,
+                                            vifs, num_vifs, &dm_starting) );
+        }
     } else {
         for (i = 0; i < num_vfbs; i++) {
             vfbs[i].domid = domid;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

PATCH 3/3 stubdom_create returns stubdomain domid so that unpause is done by the user of libxenlight.

In reply to Vincent Hanquez
---
 tools/libxl/libxl.c      |    7 ++++---
 tools/libxl/libxl.h      |    2 +-
 tools/libxl/xl_cmdimpl.c |    4 +++-
 3 files changed, 8 insertions(+), 5 deletions(-)
tools/libxl/libxl.c +4 -3
index 811678f..29fb10f 100644
@@ -1060,7 +1060,7 @@ int libxl_stubdom_create(struct libxl_ctx *ctx,
                          libxl_device_disk *disks, int num_disks,
                          libxl_device_nic *vifs, int num_vifs,
                          libxl_device_vfb *vfb,
-                         libxl_device_vkb *vkb,
+                         libxl_device_vkb *vkb, uint32_t *stubdomid,
                          libxl_device_model_starting **starting_r)
 {
     int i, num_console = 1, ret;
@@ -1141,6 +1141,9 @@ retry_transaction:
         ret = libxl_device_console_add(ctx, domid, &console[i]);
         if (ret) return ret;
     }
+
+    *stubdomid = domid;
+
     if (libxl_create_xenpv_qemu(ctx, vfb, num_console, console, &dm_starting) < 0) {
         free(args);
         return -1;
@@ -1150,8 +1153,6 @@ retry_transaction:
         return -1;
     }
 
-    libxl_domain_unpause(ctx, domid);
-
     if (starting_r) {
         *starting_r = libxl_calloc(ctx, sizeof(libxl_device_model_starting), 1);
         (*starting_r)->domid = info->domid;
tools/libxl/libxl.h +1 -1
index 76f9b5c..597d91b 100644
@@ -381,7 +381,7 @@ int libxl_stubdom_create(struct libxl_ctx *ctx,
                          libxl_device_nic *vifs, int num_vifs,
                          libxl_device_vfb *vfb,
                          libxl_device_vkb *vkb,
-                         libxl_device_model_starting **starting_r);
+                         uint32_t *stubdomid, libxl_device_model_starting **starting_r);
 
 int libxl_vfb_and_vkb_from_device_model_info(struct libxl_ctx *ctx,
                                              libxl_device_model_info *info,
tools/libxl/xl_cmdimpl.c +3 -1
index a20e77a..6ed8e26 100644
@@ -1154,9 +1154,11 @@ start:
         if (strstr(dm_info.device_model, "stubdom-dm")) {
             libxl_device_vfb vfb;
             libxl_device_vkb vkb;
+            uint32_t stubdomid;
 
             libxl_vfb_and_vkb_from_device_model_info(&ctx, &dm_info, &vfb, &vkb);
-            MUST( libxl_stubdom_create(&ctx, &dm_info, disks, num_disks, vifs, num_vifs, &vfb, &vkb, &dm_starting) );
+            MUST( libxl_stubdom_create(&ctx, &dm_info, disks, num_disks, vifs, num_vifs, &vfb, &vkb, &stubdomid, &dm_starting) );
+            libxl_domain_unpause(&ctx, stubdomid);
         } else {
             MUST( libxl_create_device_model(&ctx, &dm_info, disks, num_disks,
                                             vifs, num_vifs, &dm_starting) );

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Vincent Hanquez
Quoted 11 lines · Vincent Hanquez

This patch serie cleans the stubdom API, and remove some of the policy embedded in libxl. libxl users are expected to start explicitely a stubdomain instead of relying on a magic value in devicemodel_create.

Vincent Hanquez (3):
move stubdom make into a proper function
let the user of libxenlight choose explicitely if it want to start a
stubdom or not.
stubdom_create returns stubdomain domid so that unpause is done by
the user of libxenlight.

I though we wanted to make stubdoms transparent to libxenlight users, why do you want to expose them now?

#5 lore raw
Quoted 3 lines · Stefano Stabellini

I though we wanted to make stubdoms transparent to libxenlight users, why do you want to expose them now?

From the users yes, from the libxenlight users (aka developers) no. It's also a good way to get the policy out of libxenlight. For example the 32mb value which might or might not change in future.

Signature · 1 line
Vincent
#6 lore raw
Quoted 7 lines · Vincent Hanquez
Quoted 3 lines · Stefano Stabellini

I though we wanted to make stubdoms transparent to libxenlight users, why do you want to expose them now?

From the users yes, from the libxenlight users (aka developers) no.
It's also a good way to get the policy out of libxenlight. For example the 32mb value which might or might not change in future.

Fair enough.
I ack the whole series then.

#7 lore raw
Quoted 11 lines · Stefano Stabellini
Quoted 7 lines · Vincent Hanquez
Quoted 3 lines · Stefano Stabellini

I though we wanted to make stubdoms transparent to libxenlight users, why do you want to expose them now?

From the users yes, from the libxenlight users (aka developers) no.
It's also a good way to get the policy out of libxenlight. For example the 32mb value which might or might not change in future.

Fair enough.
I ack the whole series then.

Is it necessary to pull the mechanism out along with the policy though?

Could the libxl user not specify one of nostubdom, stubdom or libxlchooses (the default?) and let the internals of libxl take care of actually starting it etc?

Ian.

#8 lore raw

Ian Campbell writes ("Re: [Xen-devel] [PATCH 0/3] libxl stubdom API cleanup"):

Quoted 3 lines

Could the libxl user not specify one of nostubdom, stubdom or libxlchooses (the default?) and let the internals of libxl take care of actually starting it etc?

Quite so.

Ian.

#9 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Vincent Hanquez
Quoted 3 lines · Stefano Stabellini

I though we wanted to make stubdoms transparent to libxenlight users, why do you want to expose them now?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

From the users yes, from the libxenlight users (aka developers) no.
It's also a good way to get the policy out of libxenlight. For example the 32mb value which might or might not change in future.

Fair enough.
I ack the whole series then.

Is it necessary to pull the mechanism out along with the policy though?

Necessary is quite a strong word.

Quoted 3 lines

Could the libxl user not specify one of nostubdom, stubdom or libxlchooses (the default?) and let the internals of libxl take care of actually starting it etc?

Starting a stubdom or not, imply 2 very different side effects (e.g. memory wise). Separating the API give better error reporting, more room for action (e.g. creating a domain without stubdom if you don't have those N mb to spare), and it also simplify the ocaml bindings not having to encode complex semantics on the ocaml side.

Signature · 1 line
Vincent
#10 lore raw
Quoted 22 lines · Vincent Hanquez
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Vincent Hanquez
Quoted 3 lines · Stefano Stabellini

I though we wanted to make stubdoms transparent to libxenlight users, why do you want to expose them now?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

From the users yes, from the libxenlight users (aka developers) no.
It's also a good way to get the policy out of libxenlight. For example the 32mb value which might or might not change in future.

Fair enough.
I ack the whole series then.

Is it necessary to pull the mechanism out along with the policy though?

Necessary is quite a strong word.

Quoted 3 lines

Could the libxl user not specify one of nostubdom, stubdom or libxlchooses (the default?) and let the internals of libxl take care of actually starting it etc?

Quoted 5 lines

Starting a stubdom or not, imply 2 very different side effects (e.g. memory wise). Separating the API give better error reporting, more room for action (e.g. creating a domain without stubdom if you don't have those N mb to spare), and it also simplify the ocaml bindings not having to encode complex semantics on the ocaml side.

Fair enough.

#11 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Vincent Hanquez
Quoted 3 lines · Stefano Stabellini

I though we wanted to make stubdoms transparent to libxenlight users, why do you want to expose them now?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

From the users yes, from the libxenlight users (aka developers) no.
It's also a good way to get the policy out of libxenlight. For example the 32mb value which might or might not change in future.

Fair enough.
I ack the whole series then.

Is it necessary to pull the mechanism out along with the policy though?

Or, if we're taking some mechanism out, couldn't we take _all_ the mechanism out? The idea of a stub domain doesn't seem like one that libxl necessarily needs to know about.

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#12 lore raw
Quoted 4 lines · Tim Deegan
Quoted 2 lines

Is it necessary to pull the mechanism out along with the policy though?

Or, if we're taking some mechanism out, couldn't we take _all_ the mechanism out?

Which one do you have in minds ?

Quoted 3 lines

The idea of a stub domain doesn't seem like one that libxl necessarily needs to know about.

yes, indeed. the stubdom create could move as a xl helper.
On the ocaml side reimplementing stubdom create is a trivial composition of smaller libxl function (create/build/add devs) which are already bound.

Signature · 1 line
Vincent
#13 lore raw
Quoted 7 lines · Vincent Hanquez
Quoted 4 lines · Tim Deegan
Quoted 2 lines

Is it necessary to pull the mechanism out along with the policy though?

Or, if we're taking some mechanism out, couldn't we take _all_ the mechanism out?

Which one do you have in minds ?

It looks like your patch leaves some "create a stubdom" functions in the libxl API. I'd have thought libxl should either handle stubdoms entirely or not at all. (Unless stubdom creation needs some low-level grunge that will uglify the libxl API if it's exposed that far up - I can't think of any except PRIV_FOR though).

Quoted 6 lines
Quoted 3 lines

The idea of a stub domain doesn't seem like one that libxl necessarily needs to know about.

yes, indeed. the stubdom create could move as a xl helper.
On the ocaml side reimplementing stubdom create is a trivial composition of smaller libxl function (create/build/add devs) which are already bound.

That sounds cleaner to me.

Cheers,

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#14 lore raw
Quoted 15 lines · Tim Deegan
Quoted 7 lines · Vincent Hanquez
Quoted 4 lines · Tim Deegan
Quoted 2 lines

Is it necessary to pull the mechanism out along with the policy though?

Or, if we're taking some mechanism out, couldn't we take _all_ the mechanism out?

Which one do you have in minds ?

It looks like your patch leaves some "create a stubdom" functions in the libxl API. I'd have thought libxl should either handle stubdoms entirely or not at all. (Unless stubdom creation needs some low-level grunge that will uglify the libxl API if it's exposed that far up - I can't think of any except PRIV_FOR though).

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

The idea of a stub domain doesn't seem like one that libxl necessarily needs to know about.

yes, indeed. the stubdom create could move as a xl helper.
On the ocaml side reimplementing stubdom create is a trivial composition of smaller libxl function (create/build/add devs) which are already bound.

That sounds cleaner to me.

I am not so sure about this: a stubdom is not just a normal PV guest, it also needs some special plumbings in xenstore.
By design libxl clients are not required to know about xenstore, therefore we cannot have stubdoms entirely built by libxl clients. I think that working around this would be worse than Vincent's current patch series.

#15 lore raw
Quoted 6 lines · Stefano Stabellini

I am not so sure about this: a stubdom is not just a normal PV guest, it also needs some special plumbings in xenstore.
By design libxl clients are not required to know about xenstore, therefore we cannot have stubdoms entirely built by libxl clients. I think that working around this would be worse than Vincent's current patch series.

Fair enough.

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#16 lore raw
In reply to Tim Deegan
Quoted 10 lines · Tim Deegan
Quoted 8 lines · Vincent Hanquez
Quoted 6 lines · Tim Deegan
Quoted 3 lines

Is it necessary to pull the mechanism out along with the policy though?

Or, if we're taking some mechanism out, couldn't we take _all_ the mechanism out?

Quoted 8 lines
Quoted 2 lines

Which one do you have in minds ?

It looks like your patch leaves some "create a stubdom" functions in the libxl API. I'd have thought libxl should either handle stubdoms entirely or not at all. (Unless stubdom creation needs some low-level grunge that will uglify the libxl API if it's exposed that far up - I can't think of any except PRIV_FOR though).

I think that either is fine from my point of view; as long as I don't have to capture two very different semantics (starting a program | starting a domain) in one call.

Signature · 1 line
Vincent
#17 lore raw

Vincent Hanquez writes ("Re: [Xen-devel] [PATCH 0/3] libxl stubdom API cleanup"):

Quoted 3 lines

I think that either is fine from my point of view; as long as I don't have to capture two very different semantics (starting a program | starting a domain) in one call.

I still disagree. I think it would be better to hide this distinction as much as possible.

Your key motive seems to be some problem with the ocaml bindings. Perhaps you could explain that in more detail ?

Ian.

#18 lore raw
Quoted 10 lines · Ian Jackson

Vincent Hanquez writes ("Re: [Xen-devel] [PATCH 0/3] libxl stubdom API cleanup"):

Quoted 3 lines

I think that either is fine from my point of view; as long as I don't have to capture two very different semantics (starting a program | starting a domain) in one call.

I still disagree. I think it would be better to hide this distinction as much as possible.

Your key motive seems to be some problem with the ocaml bindings. Perhaps you could explain that in more detail ?

I think Vincent wanted a different API to make memory accounting easier.

What about extending the current create_device_model API with a more explicit stubdom flag, and a way to return the stubdom domid to the caller?

Also the caller should be able to know in advance the amount of memory used for the stubdom: another libxl function could be added for that purpose.

Would that interface be flexible enough for you?

#19 lore raw

--text follows this line--
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH 0/3] libxl stubdom API cleanup"):

Quoted 1 line

I think Vincent wanted a different API to make memory accounting easier.

Right.

Quoted 9 lines

What about extending the current create_device_model API with a more explicit stubdom flag, and a way to return the stubdom domid to the caller?

Also the caller should be able to know in advance the amount of memory used for the stubdom: another libxl function could be added for that purpose.

Would that interface be flexible enough for you?

That would address my concerns.

Ian.

#20 lore raw
In reply to Ian Jackson
Quoted 10 lines · Ian Jackson

Vincent Hanquez writes ("Re: [Xen-devel] [PATCH 0/3] libxl stubdom API cleanup"):

Quoted 3 lines

I think that either is fine from my point of view; as long as I don't have to capture two very different semantics (starting a program | starting a domain) in one call.

I still disagree. I think it would be better to hide this distinction as much as possible.

Your key motive seems to be some problem with the ocaml bindings. Perhaps you could explain that in more detail ?

This has nothing to do with the ocaml bindings, but this has to do with who is using those bindings (i.e. a fully featured toolstack).

Signature · 1 line
Vincent