From: stefano.stabellini@eu.citrix.com Subject: [PATCH 6 of 11] libxl: introduce the concept of dom0 minimum memory Date: Wed, 1 Sep 2010 14:41:05 +0100 Message-ID: <1283348470-15448-6-git-send-email-stefano.stabellini@eu.citrix.com> References: Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Introduce a minimum value for the memory assigned to dom0. Signed-off-by: Stefano Stabellini diff -r 101149a58c1d tools/libxl/libxl.c --- a/tools/libxl/libxl.c Wed Sep 01 13:04:21 2010 +0100 +++ b/tools/libxl/libxl.c Wed Sep 01 13:04:50 2010 +0100 @@ -2815,6 +2815,12 @@ int libxl_set_memory_target(libxl_ctx *c char *uuid; xs_transaction_t t; + if (!domid && target_memkb < LIBXL_MIN_DOM0_MEM) { + XL_LOG(ctx, XL_LOG_ERROR, + "new target for dom0 is below the minimum threshold\n"); + return ERROR_NOMEM; + } + retry_transaction: t = xs_transaction_start(ctx->xsh); @@ -2967,6 +2973,12 @@ retry_transaction: abort = 1; goto out; } + if (!domid && new_target_memkb < LIBXL_MIN_DOM0_MEM) { + XL_LOG(ctx, XL_LOG_ERROR, + "new target for dom0 is below the minimum threshold\n"); + abort = 1; + goto out; + } libxl_xs_write(&gc, t, libxl_sprintf(&gc, "%s/memory/target", dompath), "%"PRIu32, new_target_memkb); diff -r 101149a58c1d tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Wed Sep 01 13:04:21 2010 +0100 +++ b/tools/libxl/libxl_internal.h Wed Sep 01 13:04:50 2010 +0100 @@ -43,6 +43,7 @@ #define LIBXL_MAXMEM_CONSTANT 1024 #define LIBXL_PV_EXTRA_MEMORY 1024 #define LIBXL_HVM_EXTRA_MEMORY 2048 +#define LIBXL_MIN_DOM0_MEM (128*1024) #define QEMU_SIGNATURE "QemuDeviceModelRecord" #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))