Skip to contentSkip to conversation

: PVH xen tools: tools changes to create PVH guest

PATCH In review Mukesh Rathor 3 participants 8 messages Sep 11, 2013 – Sep 13, 2013

lore
Share & tools
lore
#0 lore raw

v4 cover : PVH xen tools: tools changes to create PVH guest

Please find V4 tools changes for PVH. These were built on unstable c/s:
546ba2f17008387cf9821df46e6dac04f0883a9b. Comment logs fixed with '---'.

thanks
Mukesh

#1 lore raw

PATCH v4 1/2 PVH xen tools: libxc changes to build a PVH guest.

---
V2: Make pvh_features string const, and fail 32bit PVH guest creation.
Move PVH check to xc_dom_gnttab_init().
V3: let xc_dom_gnttab_hvm_seed be called for PVH.

---
 tools/libxc/xc_dom.h      |    1 +
 tools/libxc/xc_dom_core.c |    9 ++++
 tools/libxc/xc_dom_x86.c  |   90 +++++++++++++++++++++++++++++---------------
 3 files changed, 69 insertions(+), 31 deletions(-)
tools/libxc/xc_dom.h +1 -0
index 86e23ee..5168bcd 100644
@@ -130,6 +130,7 @@ struct xc_dom_image {
     domid_t console_domid;
     domid_t xenstore_domid;
     xen_pfn_t shared_info_mfn;
+    int pvh_enabled;
 
     xc_interface *xch;
     domid_t guest_domid;
tools/libxc/xc_dom_core.c +9 -0
index 0f367f6..faa7e0f 100644
@@ -766,6 +766,15 @@ int xc_dom_parse_image(struct xc_dom_image *dom)
         goto err;
     }
 
+    if ( dom->pvh_enabled )
+    {
+        const char *pvh_features = "writable_descriptor_tables|"
+                                   "auto_translated_physmap|"
+                                   "supervisor_mode_kernel|"
+                                   "hvm_callback_vector";
+        elf_xen_parse_features(pvh_features, dom->f_requested, NULL);
+    }
+
     /* check features */
     for ( i = 0; i < XENFEAT_NR_SUBMAPS; i++ )
     {
tools/libxc/xc_dom_x86.c +59 -31

144 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#3 lore raw

PATCH v4 2/2 PVH xen tools: libxl changes to create a PVH guest.

In reply to Mukesh Rathor

---
V2: set c_info->hap to default value of pvh, and use LOG(ERROR...).
Move PVH check to xc_dom_gnttab_init.
Move xl doc change here.

---
 docs/man/xl.cfg.pod.5        |    3 +++
 tools/libxl/libxl.h          |    6 ++++++
 tools/libxl/libxl_create.c   |   12 ++++++++++++
 tools/libxl/libxl_dom.c      |    2 ++
 tools/libxl/libxl_internal.h |    1 +
 tools/libxl/libxl_types.idl  |    1 +
 tools/libxl/libxl_x86.c      |    4 +++-
 tools/libxl/xl_cmdimpl.c     |    1 +
 8 files changed, 29 insertions(+), 1 deletions(-)
docs/man/xl.cfg.pod.5 +3 -0
index 08d6cc4..65d69f8 100644
@@ -634,6 +634,9 @@ if your particular guest kernel does not require this behaviour then
 it is safe to allow this to be enabled but you may wish to disable it
 anyway.
 
+=item B<pvh=BOOLEAN>
+Selects whether to run this PV guest in an HVM container. Default is 0.
+
 =back
 
 =head2 Fully-virtualised (HVM) Guest Specific Options
tools/libxl/libxl.h +6 -0
index be19bf5..f0b0701 100644
@@ -344,6 +344,12 @@
  */
 #define LIBXL_HAVE_DOMINFO_OUTSTANDING_MEMKB 1
 
+/*
+ * LIBXL_HAVE_CREATEINFO_PVH
+ * If this is defined, then libxl supports creation of a PVH guest.
+ */
+#define LIBXL_HAVE_CREATEINFO_PVH 1
+
 /* Functions annotated with LIBXL_EXTERNAL_CALLERS_ONLY may not be
  * called from within libxl itself. Callers outside libxl, who
  * do not #include libxl_internal.h, are fine. */
tools/libxl/libxl_create.c +12 -0
index 0c32d0b..6d2101e 100644
@@ -33,6 +33,9 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,
     if (c_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         libxl_defbool_setdefault(&c_info->hap, true);
         libxl_defbool_setdefault(&c_info->oos, true);
+    } else {
+        libxl_defbool_setdefault(&c_info->pvh, false);
+        libxl_defbool_setdefault(&c_info->hap, libxl_defbool_val(c_info->pvh));
     }
 
     libxl_defbool_setdefault(&c_info->run_hotplug_scripts, true);
@@ -346,6 +349,8 @@ int libxl__domain_build(libxl__gc *gc,
 
         break;
     case LIBXL_DOMAIN_TYPE_PV:
+        state->pvh_enabled = libxl_defbool_val(d_config->c_info.pvh);
+
         ret = libxl__build_pv(gc, domid, info, state);
         if (ret)
             goto out;
@@ -405,6 +410,13 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info,
         flags |= XEN_DOMCTL_CDF_hvm_guest;
         flags |= libxl_defbool_val(info->hap) ? XEN_DOMCTL_CDF_hap : 0;
         flags |= libxl_defbool_val(info->oos) ? 0 : XEN_DOMCTL_CDF_oos_off;
+    } else if ( libxl_defbool_val(info->pvh) ) {
+        if ( !libxl_defbool_val(info->hap) ) {
+            LOG(ERROR, "HAP must be on for PVH");
+            rc = ERROR_INVAL;
+            goto out;
+        }
+        flags |= XEN_DOMCTL_CDF_hap;
     }
     *domid = -1;
 
tools/libxl/libxl_dom.c +2 -0
index 6e2252a..89e919e 100644
@@ -338,6 +338,8 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
         return ERROR_FAIL;
     }
 
+    dom->pvh_enabled = state->pvh_enabled;
+
     LOG(DEBUG, "pv kernel mapped %d path %s\n", state->pv_kernel.mapped, state->pv_kernel.path);
     if (state->pv_kernel.mapped) {
         ret = xc_dom_kernel_mem(dom,
tools/libxl/libxl_internal.h +1 -0
index f051d91..441ec66 100644
@@ -886,6 +886,7 @@ typedef struct {
     libxl__file_reference pv_kernel;
     libxl__file_reference pv_ramdisk;
     const char * pv_cmdline;
+    bool pvh_enabled;
 } libxl__domain_build_state;
 
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
tools/libxl/libxl_types.idl +1 -0
index 10f95f4..d4d5bb7 100644
@@ -255,6 +255,7 @@ libxl_domain_create_info = Struct("domain_create_info",[
     ("platformdata", libxl_key_value_list),
     ("poolid",       uint32),
     ("run_hotplug_scripts",libxl_defbool),
+    ("pvh",          libxl_defbool),
     ], dir=DIR_IN)
 
 MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT")
tools/libxl/libxl_x86.c +3 -1
index a78c91d..87a8110 100644
@@ -290,7 +290,9 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
     if (rtc_timeoffset)
         xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset);
 
-    if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
+    if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM ||
+        libxl_defbool_val(d_config->c_info.pvh)) {
+
         unsigned long shadow;
         shadow = (d_config->b_info.shadow_memkb + 1023) / 1024;
         xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, NULL, 0, &shadow, 0, NULL);
tools/libxl/xl_cmdimpl.c +1 -0
index 884f050..2ee68a9 100644
@@ -610,6 +610,7 @@ static void parse_config_data(const char *config_source,
         !strncmp(buf, "hvm", strlen(buf)))
         c_info->type = LIBXL_DOMAIN_TYPE_HVM;
 
+    xlu_cfg_get_defbool(config, "pvh", &c_info->pvh, 0);
     xlu_cfg_get_defbool(config, "hap", &c_info->hap, 0);
 
     if (xlu_cfg_replace_string (config, "name", &c_info->name, 0)) {
Signature · 1 line
1.7.2.3
#4 lore raw
In reply to Mukesh Rathor
Quoted 2 lines · Mukesh Rathor

Please find V4 tools changes for PVH. These were built on unstable c/s:
546ba2f17008387cf9821df46e6dac04f0883a9b. Comment logs fixed with '---'.

These are both now acked but I don't think it makes much sense to actually apply them until the h/v side is ready (cc-ing some set of people who I think are involved in that).

Perhaps you could append this to the h/v series and whoever applies that can just hoover up the lot?

Or just ping me when the appropriate time comes.

Ian.

#5 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 2 lines · Mukesh Rathor

Please find V4 tools changes for PVH. These were built on unstable c/s:
546ba2f17008387cf9821df46e6dac04f0883a9b. Comment logs fixed with '---'.

These are both now acked but I don't think it makes much sense to actually apply them until the h/v side is ready (cc-ing some set of people who I think are involved in that).

Perhaps you could append this to the h/v series and whoever applies that can just hoover up the lot?

That would be fine with me. Still waiting for George's reworked series though.

Jan

#6 lore raw
In reply to Ian Campbell
Quoted 11 lines · On Thu, 12 Sep 2013 09:38:14 +0100 Ian Campbell <[email protected]> wrote:
Quoted 3 lines · Mukesh Rathor

Please find V4 tools changes for PVH. These were built on unstable c/s: 546ba2f17008387cf9821df46e6dac04f0883a9b. Comment logs fixed with '---'.

These are both now acked but I don't think it makes much sense to actually apply them until the h/v side is ready (cc-ing some set of people who I think are involved in that).

Perhaps you could append this to the h/v series and whoever applies that can just hoover up the lot?

FWIW, applying them would be harmless in the sense that guest creation will fail but will not crash xen or anything...

thanks
Mukesh

#7 lore raw
Quoted 12 lines · Mukesh Rathor
Quoted 9 lines · On Thu, 12 Sep 2013 09:38:14 +0100 Ian Campbell <[email protected]> wrote:
Quoted 3 lines · Mukesh Rathor

Please find V4 tools changes for PVH. These were built on unstable c/s: 546ba2f17008387cf9821df46e6dac04f0883a9b. Comment logs fixed with '---'.

These are both now acked but I don't think it makes much sense to actually apply them until the h/v side is ready (cc-ing some set of people who I think are involved in that).

Quoted 5 lines
Quoted 2 lines

Perhaps you could append this to the h/v series and whoever applies that can just hoover up the lot?

FWIW, applying them would be harmless in the sense that guest creation will fail but will not crash xen or anything...

It would expose and options (and the associated docs) for things which don't actually work.

Jan's fine with these being appended to the h/v series, so lets do that.

Ian.