From bec8f17e48439ee5b8370f4e431ccd9a9514bee7 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Mon, 13 May 2013 15:29:11 -0400 Subject: hypervisor/xen/tools: Remove the XENMEM_get_oustanding_pages and provide the data via xc_phys_info During the review of the patches it was noticed that there exists a race wherein the 'free_memory' value consists of information from two hypercalls. That is the XEN_SYSCTL_physinfo and XENMEM_get_outstanding_pages. The free memory the host has available for guest is the difference between the 'free_pages' (from XEN_SYSCTL_physinfo) and 'outstanding_pages'. As they are two hypercalls many things can happen in between the execution of them. This patch resolves this by eliminating the XENMEM_get_outstanding_pages hypercall and providing the free_pages and outstanding_pages information via the xc_phys_info structure. It also removes the XSM hooks and adds locking as needed. Signed-off-by: Konrad Rzeszutek Wilk Acked-by: Ian Campbell Acked-by: Daniel De Graaf Reviewed-by: Tim Deegan Acked-by: Keir Fraser --- tools/libxl/libxl.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'tools/libxl/libxl.c') diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index bc91fd5abf..ee1fa9cf8c 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -3942,6 +3942,7 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo) physinfo->total_pages = xcphysinfo.total_pages; physinfo->free_pages = xcphysinfo.free_pages; physinfo->scrub_pages = xcphysinfo.scrub_pages; + physinfo->outstanding_pages = xcphysinfo.outstanding_pages; l = xc_sharing_freed_pages(ctx->xch); if (l == -ENOSYS) { l = 0; @@ -4105,20 +4106,6 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr) return ret; } -uint64_t libxl_get_claiminfo(libxl_ctx *ctx) -{ - long l; - - l = xc_domain_get_outstanding_pages(ctx->xch); - if (l < 0) { - LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_WARNING, l, - "xc_domain_get_outstanding_pages failed."); - return ERROR_FAIL; - } - /* In pages */ - return l; -} - const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx) { union { -- cgit v1.2.3