[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH-for-4.10/4.11] libxl: don't set gnttab limits in soft reset case



In case of soft reset the gnttab limit setting will fail, so omit it.
Setting of max vcpu count is pointless in this case, too, so we can
drop that as well.

Without this patch soft reset will fail with:

libxl: error: libxl_dom.c:363:libxl__build_pre: Couldn't set grant table limits

Reported-by: Jim Fehlig <jfehlig@xxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Tested-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
4.12 is not affected due to Andrew's domain creation interface changes,
4.9 and earlier are not affected due to xc_domain_set_gnttab_limits()
only having been introduced in 4.10.
---
 tools/libxl/libxl_create.c   |  5 +++--
 tools/libxl/libxl_dom.c      | 21 ++++++++++++---------
 tools/libxl/libxl_internal.h |  2 +-
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 1fa1d3a621..a2b8f3298b 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -442,7 +442,7 @@ int libxl__domain_build(libxl__gc *gc,
     struct timeval start_time;
     int i, ret;
 
-    ret = libxl__build_pre(gc, domid, d_config, state);
+    ret = libxl__build_pre(gc, domid, d_config, state, false);
     if (ret)
         goto out;
 
@@ -1115,7 +1115,8 @@ 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, d_config, state,
+                          dcs->domid_soft_reset != INVALID_DOMID);
     if (rc)
         goto out;
 
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 29fd2f5d6a..71b5f57fcc 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -345,7 +345,8 @@ static void hvm_set_conf_params(xc_interface *handle, 
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_config *d_config, libxl__domain_build_state *state,
+              bool is_reset)
 {
     libxl_domain_build_info *const info = &d_config->b_info;
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -353,15 +354,17 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     int rc;
     uint64_t size;
 
-    if (xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus) != 0) {
-        LOG(ERROR, "Couldn't set max vcpu count");
-        return ERROR_FAIL;
-    }
+    if (!is_reset) {
+        if (xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus) != 0) {
+            LOG(ERROR, "Couldn't set max vcpu count");
+            return ERROR_FAIL;
+        }
 
-    if (xc_domain_set_gnttab_limits(ctx->xch, domid, info->max_grant_frames,
-                                    info->max_maptrack_frames) != 0) {
-        LOG(ERROR, "Couldn't set grant table limits");
-        return ERROR_FAIL;
+        if (xc_domain_set_gnttab_limits(ctx->xch, domid, 
info->max_grant_frames,
+                                        info->max_maptrack_frames) != 0) {
+            LOG(ERROR, "Couldn't set grant table limits");
+            return ERROR_FAIL;
+        }
     }
 
     /*
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 85ee7b0e15..4d86e5cd2b 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1153,7 +1153,7 @@ typedef struct {
 
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
               libxl_domain_config * const d_config,
-              libxl__domain_build_state *state);
+              libxl__domain_build_state *state, bool is_reset);
 _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);
-- 
2.16.4


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.