[xen stable-4.10] 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.10] libxl: don't set gnttab limits in soft reset case

patchbot
commit 0a9cc379968b7fd50b955c9ddd3d7da1de908b84
Author:     Juergen Gross <[hidden email]>
AuthorDate: Thu Jan 17 16:40:59 2019 +0000
Commit:     Ian Jackson <[hidden email]>
CommitDate: Tue Feb 5 11:43:09 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]>
    (cherry picked from commit dd492b8f64d9ad9d413289565bd074f025f8edde)
---
 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);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

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