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

[Xen-changelog] [xen master] libxl: fix "xl mem-set" regression from 0c029c4da2



commit f5b43e95facdc17f925cb56a8963cd4531074034
Author:     Jan Beulich <JBeulich@xxxxxxxx>
AuthorDate: Wed Apr 22 13:02:16 2015 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu May 21 15:16:11 2015 +0100

    libxl: fix "xl mem-set" regression from 0c029c4da2
    
    Said commit ("libxl_set_memory_target: retain the same maxmem offset on
    top of the current target") caused a regression for "xl mem-set"
    against Dom0: While prior to creation of the first domain this works,
    the first domain creation involving ballooning breaks. Due to "enforce"
    not being set in the domain creation case, and due to Dom0's initial
    ->max_pages (in the hypervisor) being UINT_MAX, the calculation of
    "memorykb" in the first "xl mem-set" adusting the target upwards
    subsequent to domain creation and termination may cause an overflow,
    resulting in Dom0's maximum getting to a very small value. This small
    maximum will the make the subsequent setting of the PoD target fail.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxc/include/xenctrl.h |    2 +-
 tools/libxc/xc_domain.c       |    2 +-
 tools/libxl/libxl.c           |    5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 09a7450..100b89c 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1285,7 +1285,7 @@ int xc_getcpuinfo(xc_interface *xch, int max_cpus,
 
 int xc_domain_setmaxmem(xc_interface *xch,
                         uint32_t domid,
-                        unsigned int max_memkb);
+                        uint64_t max_memkb);
 
 int xc_domain_set_memmap_limit(xc_interface *xch,
                                uint32_t domid,
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index a7079a1..38d065f 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -635,7 +635,7 @@ int xc_shadow_control(xc_interface *xch,
 
 int xc_domain_setmaxmem(xc_interface *xch,
                         uint32_t domid,
-                        unsigned int max_memkb)
+                        uint64_t max_memkb)
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_max_mem;
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index a6eb2df..9cc45b4 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4726,7 +4726,8 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t 
domid,
 {
     GC_INIT(ctx);
     int rc = 1, abort_transaction = 0;
-    uint32_t memorykb = 0, videoram = 0;
+    uint64_t memorykb;
+    uint32_t videoram = 0;
     uint32_t current_target_memkb = 0, new_target_memkb = 0;
     uint32_t current_max_memkb = 0;
     char *memmax, *endptr, *videoram_s = NULL, *target = NULL;
@@ -4820,7 +4821,7 @@ retry_transaction:
         rc = xc_domain_setmaxmem(ctx->xch, domid, memorykb);
         if (rc != 0) {
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
-                    "xc_domain_setmaxmem domid=%d memkb=%d failed "
+                    "xc_domain_setmaxmem domid=%u memkb=%"PRIu64" failed "
                     "rc=%d\n", domid, memorykb, rc);
             abort_transaction = 1;
             goto out;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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