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/libxc/xc_domain.c | 9 --------- tools/libxc/xenctrl.h | 2 -- 2 files changed, 11 deletions(-) (limited to 'tools/libxc') diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index bb71ccaecf..3257e2af94 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -873,15 +873,6 @@ int xc_domain_claim_pages(xc_interface *xch, err = errno = 0; return err; } -unsigned long xc_domain_get_outstanding_pages(xc_interface *xch) -{ - long ret = do_memory_op(xch, XENMEM_get_outstanding_pages, NULL, 0); - - /* Ignore it if the hypervisor does not support the call. */ - if (ret == -1 && errno == ENOSYS) - ret = errno = 0; - return ret; -} int xc_domain_populate_physmap(xc_interface *xch, uint32_t domid, diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index c024af439b..40ee8fce2a 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1182,8 +1182,6 @@ int xc_domain_claim_pages(xc_interface *xch, uint32_t domid, unsigned long nr_pages); -unsigned long xc_domain_get_outstanding_pages(xc_interface *xch); - int xc_domain_memory_exchange_pages(xc_interface *xch, int domid, unsigned long nr_in_extents, -- cgit v1.2.3