[xen stable-4.11] libxl: don't set gnttab limits in soft reset case

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.11] libxl: don't set gnttab limits in soft reset case

patchbot
commit dd492b8f64d9ad9d413289565bd074f025f8edde
Author:     Juergen Gross <[hidden email]>
AuthorDate: Thu Jan 17 16:40:59 2019 +0000
Commit:     Ian Jackson <[hidden email]>
CommitDate: Tue Feb 5 11:42:34 2019 +0000

    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 <[hidden email]>
    Signed-off-by: Juergen Gross <[hidden email]>
    Tested-by: Jim Fehlig <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
---
 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 b5e27a7766..5c9dd4cd21 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;
 
@@ -1117,7 +1117,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 f0fd5fd3a3..13054a32cc 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 c582894589..ad536b7e89 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1154,7 +1154,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);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog