Skip to contentSkip to conversation

libxl: introduce the concept of dom0 minimum memory

PATCH In review Stefano Stabellini 2 participants 2 messages Aug 27, 2010 – Aug 31, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: introduce the concept of dom0 minimum memory

libxl: introduce the concept of dom0 minimum memory

Introduce a minimum value for the memory assigned to dom0.

tools/libxl/libxl.c +12 -0
diff -r 1276830b845f tools/libxl/libxl.c
@@ -2841,6 +2841,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);
 
@@ -2948,6 +2954,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;
+    }
 
     videoram_s = libxl_xs_read(&gc, t, libxl_sprintf(&gc, "%s/memory/videoram", dompath));
     videoram = videoram_s ? atoi(videoram_s) : 0;
tools/libxl/libxl_internal.h +1 -0
diff -r 1276830b845f tools/libxl/libxl_internal.h
@@ -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]))
Acked-by on v1 1/1
#1 lore raw

Stefano Stabellini writes ("[Xen-devel] [PATCH 4 of 8] libxl: introduce the concept of dom0 minimum memory"):

Quoted 1 line

libxl: introduce the concept of dom0 minimum memory

I like this. We can introduce a global config file to adjust the setting, later.

Ian.