xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl: Set default shadow memory based on final values for vcpus and memory
@ 2010-05-18 20:14 George Dunlap
  0 siblings, 0 replies; only message in thread
From: George Dunlap @ 2010-05-18 20:14 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

Set default shadow memory based on final versions of memory and vcpus, not on minimum
default versions.

Failure mode was failed p2m allocaitons, e.g., with hvm-linux PV drivers mapping
the shared-info page.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r c6db509d7e46 -r 3f1028347177 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue May 18 15:18:26 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue May 18 15:13:46 2010 -0500
@@ -180,7 +180,7 @@
     b_info->max_memkb = 32 * 1024;
     b_info->target_memkb = b_info->max_memkb;
     if (c_info->hvm) {
-        b_info->shadow_memkb = libxl_get_required_shadow_memory(b_info->max_memkb, b_info->max_vcpus);
+        b_info->shadow_memkb = 0; /* Set later */
         b_info->video_memkb = 8 * 1024;
         b_info->kernel = "hvmloader";
         b_info->hvm = 1;
@@ -478,12 +478,17 @@
         b_info->target_memkb = b_info->max_memkb;
     }
 
+    /* libxl_get_required_shadow_memory() must be called after final values
+     * (default or specified) for vcpus and memory are set, because the
+     * calculation depends on those values. */
+    if (!xlu_cfg_get_long (config, "shadow_memory", &l))
+        b_info->shadow_memkb = l * 1024;
+    else
+        b_info->shadow_memkb = libxl_get_required_shadow_memory(b_info->max_memkb, b_info->max_vcpus);
+
     if (!xlu_cfg_get_long(config, "tsc_mode", &l))
         b_info->tsc_mode = l;
 
-    if (!xlu_cfg_get_long (config, "shadow_memory", &l))
-        b_info->shadow_memkb = l * 1024;
-
     if (!xlu_cfg_get_long (config, "videoram", &l))
         b_info->video_memkb = l * 1024;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-18 20:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-18 20:14 [PATCH] libxl: Set default shadow memory based on final values for vcpus and memory George Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).