[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 2/4] libxl: Move libxl__arch_domain_construct_memmap() earlier
From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Since hvm_start_info has now been expanded to include PVH guest's memory map (i.e. e820) we need to know size of this map by the time we create dom->start_info_seg in alloc_magic_pages_hvm(). To do so we have to call libxl__arch_domain_construct_memmap() earlier, before xc_dom_build_image(). Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> --- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_dom.c | 12 +++++++++--- tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_x86.c | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index c498135..5dce3df 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -488,7 +488,7 @@ int libxl__domain_build(libxl__gc *gc, break; case LIBXL_DOMAIN_TYPE_PV: - ret = libxl__build_pv(gc, domid, info, state); + ret = libxl__build_pv(gc, domid, d_config, info, state); if (ret) goto out; diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 2e29b52..917b45e 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -698,6 +698,7 @@ static int set_vnuma_info(libxl__gc *gc, uint32_t domid, } static int libxl__build_dom(libxl__gc *gc, uint32_t domid, + libxl_domain_config *d_config, libxl_domain_build_info *info, libxl__domain_build_state *state, struct xc_dom_image *dom) { @@ -737,6 +738,11 @@ static int libxl__build_dom(libxl__gc *gc, uint32_t domid, LOGE(ERROR, "libxl__arch_domain_finalise_hw_description failed"); goto out; } + ret = libxl__arch_domain_construct_memmap(gc, d_config, domid, dom); + if (ret != 0) { + LOG(ERROR, "setting domain memory map failed"); + goto out; + } if ( (ret = xc_dom_build_image(dom)) != 0 ) { LOGE(ERROR, "xc_dom_build_image failed"); goto out; @@ -758,7 +764,7 @@ out: return ret != 0 ? ERROR_FAIL : 0; } -int libxl__build_pv(libxl__gc *gc, uint32_t domid, +int libxl__build_pv(libxl__gc *gc, uint32_t domid, libxl_domain_config *d_config, libxl_domain_build_info *info, libxl__domain_build_state *state) { libxl_ctx *ctx = libxl__gc_owner(gc); @@ -847,7 +853,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, dom->vnode_to_pnode[i] = info->vnuma_nodes[i].pnode; } - ret = libxl__build_dom(gc, domid, info, state, dom); + ret = libxl__build_dom(gc, domid, d_config, info, state, dom); if (ret != 0) goto out; @@ -1293,7 +1299,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid, dom->vnode_to_pnode[i] = info->vnuma_nodes[i].pnode; } - rc = libxl__build_dom(gc, domid, info, state, dom); + rc = libxl__build_dom(gc, domid, d_config, info, state, dom); if (rc != 0) goto out; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 506687f..914df23 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1159,6 +1159,7 @@ _hidden int libxl__build_post(libxl__gc *gc, uint32_t domid, char **vms_ents, char **local_ents); _hidden int libxl__build_pv(libxl__gc *gc, uint32_t domid, + libxl_domain_config *const d_config, libxl_domain_build_info *info, libxl__domain_build_state *state); _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid, libxl_domain_config *d_config, diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index d82013f..3331cc5 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -525,6 +525,9 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc, uint32_t lowmem_start = dom->device_model ? GUEST_LOW_MEM_START_DEFAULT : 0; unsigned page_size = XC_DOM_PAGE_SIZE(dom); + if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_PV) + return 0; + /* Add all rdm entries. */ for (i = 0; i < d_config->num_rdms; i++) if (d_config->rdms[i].policy != LIBXL_RDM_RESERVE_POLICY_INVALID) -- 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |