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 --- xen/xsm/dummy.c | 1 - xen/xsm/flask/hooks.c | 7 ------- xen/xsm/flask/policy/access_vectors | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) (limited to 'xen/xsm') diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index 937761f095..31e4f739b3 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -67,7 +67,6 @@ void xsm_fixup_ops (struct xsm_operations *ops) set_to_dummy_if_null(ops, memory_stat_reservation); set_to_dummy_if_null(ops, memory_pin_page); set_to_dummy_if_null(ops, claim_pages); - set_to_dummy_if_null(ops, xenmem_get_outstanding_pages); set_to_dummy_if_null(ops, console_io); diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index bb10de3ae8..fa0589a2d7 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -422,12 +422,6 @@ static int flask_claim_pages(struct domain *d) return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__SETCLAIM); } -static int flask_xenmem_get_outstanding_pages(void) -{ - return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN, - XEN__HEAP, NULL); -} - static int flask_console_io(struct domain *d, int cmd) { u32 perm; @@ -1504,7 +1498,6 @@ static struct xsm_operations flask_ops = { .memory_stat_reservation = flask_memory_stat_reservation, .memory_pin_page = flask_memory_pin_page, .claim_pages = flask_claim_pages, - .xenmem_get_outstanding_pages = flask_xenmem_get_outstanding_pages, .console_io = flask_console_io, diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors index 544c3bae0f..5dfe13b016 100644 --- a/xen/xsm/flask/policy/access_vectors +++ b/xen/xsm/flask/policy/access_vectors @@ -54,7 +54,7 @@ class xen debug # XEN_SYSCTL_getcpuinfo, XENPF_get_cpu_version, XENPF_get_cpuinfo getcpuinfo -# XEN_SYSCTL_availheap, XENMEM_get_outstanding_pages +# XEN_SYSCTL_availheap heap # XEN_SYSCTL_get_pmstat, XEN_SYSCTL_pm_op, XENPF_set_processor_pminfo, # XENPF_core_parking -- cgit v1.2.3