WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: fix dom0 minimum memory threshold

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: fix dom0 minimum memory threshold check
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 02 Nov 2010 04:50:22 -0700
Delivery-date: Tue, 02 Nov 2010 04:51:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
# Date 1288263742 -3600
# Node ID da9b1aa3c3669792e3055770e1839c3e96590318
# Parent  b2809cd74ca0ae727a95e5dd9225461d8d3079a4
libxl: fix dom0 minimum memory threshold check

libxl_set_memory_target tries to set the memory target for a given
domain to new_target_memkb. The function includes a check to make sure
that dom0's memory is not reduced below a minimal threshold ie.
LIBXL_MIN_DOM0_MEM. However, this check is performed before the
new_target_memkb variable is properly initialised - when the value is
always zero. This means that the check always fails. Fix this by moving
the test to happen after the proper initialisation of new_target_memkb.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff -r b2809cd74ca0 -r da9b1aa3c366 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Oct 28 11:47:26 2010 +0100
+++ b/tools/libxl/libxl.c       Thu Oct 28 12:02:22 2010 +0100
@@ -2927,12 +2927,6 @@ retry_transaction:
         abort = 1;
         goto out;
     }
-    if (!domid && new_target_memkb < LIBXL_MIN_DOM0_MEM) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                "new target for dom0 is below the minimum threshold\n");
-        abort = 1;
-        goto out;
-    }
 
     if (relative)
         new_target_memkb = current_target_memkb + target_memkb;
@@ -2946,6 +2940,13 @@ retry_transaction:
         goto out;
     }
 
+    if (!domid && new_target_memkb < LIBXL_MIN_DOM0_MEM) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                "new target %d for dom0 is below the minimum threshold\n",
+                 new_target_memkb);
+        abort = 1;
+        goto out;
+    }
     videoram_s = libxl__xs_read(&gc, t, libxl__sprintf(&gc,
                 "%s/memory/videoram", dompath));
     videoram = videoram_s ? atoi(videoram_s) : 0;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: fix dom0 minimum memory threshold check, Xen patchbot-unstable <=