aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-05-19 08:15:05 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-05-19 08:15:05 +0100
commit034b34e084704260e44f160d1ee734b8f05782b0 (patch)
treed103147b0554ec3555c0b8084b20ba38c1e07791 /tools
parentf82f9019ad41ca333150187d51ca6bc28a360436 (diff)
downloadxen-034b34e084704260e44f160d1ee734b8f05782b0.tar.gz
xen-034b34e084704260e44f160d1ee734b8f05782b0.tar.bz2
xen-034b34e084704260e44f160d1ee734b8f05782b0.zip
libxl: Set default shadow memory based on final values for vcpus and memory
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxl/xl_cmdimpl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index b5d2eba022..9c37d43e84 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -180,7 +180,7 @@ static void init_build_info(libxl_domain_build_info *b_info, libxl_domain_create
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 @@ static void parse_config_data(const char *configfile_filename_report,
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. */
+ b_info->shadow_memkb = !xlu_cfg_get_long(config, "shadow_memory", &l)
+ ? l * 1024
+ : 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;