[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1/3] xen/tools: Remove the XENMEM_get_oustanding_pages and provide the data via xc_phys_info
On 05/08/2013 02:35 PM, Konrad Rzeszutek Wilk wrote: 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. CC: dgdera@xxxxxxxxxxxxx My email address here is missing a "g" (dgdegra). Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- tools/libxc/xc_domain.c | 9 --------- tools/libxc/xenctrl.h | 2 -- tools/libxl/libxl.c | 15 +-------------- tools/libxl/libxl.h | 1 - tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 16 +++------------- xen/common/memory.c | 8 -------- xen/common/page_alloc.c | 8 ++++++-- xen/common/sysctl.c | 3 ++- xen/include/public/memory.h | 7 ------- xen/include/public/sysctl.h | 3 ++- xen/include/xen/mm.h | 2 +- xen/include/xsm/dummy.h | 6 ------ xen/include/xsm/xsm.h | 1 - xen/xsm/dummy.c | 1 - xen/xsm/flask/hooks.c | 6 ------ 16 files changed, 16 insertions(+), 73 deletions(-) [...] diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index a872056..cc0a5a8 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -259,12 +259,6 @@ static XSM_INLINE int xsm_claim_pages(XSM_DEFAULT_ARG struct domain *d) return xsm_default_action(action, current->domain, d); } -static XSM_INLINE int xsm_xenmem_get_outstanding_pages(XSM_DEFAULT_VOID) -{ - XSM_ASSERT_ACTION(XSM_PRIV); - return xsm_default_action(action, current->domain, NULL); -} - static XSM_INLINE int xsm_evtchn_unbound(XSM_DEFAULT_ARG struct domain *d, struct evtchn *chn, domid_t id2) { diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 58a4fbb..65150a3 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -93,7 +93,6 @@ struct xsm_operations { int (*add_to_physmap) (struct domain *d1, struct domain *d2); int (*remove_from_physmap) (struct domain *d1, struct domain *d2); int (*claim_pages) (struct domain *d); - int (*xenmem_get_outstanding_pages) (void); int (*console_io) (struct domain *d, int cmd); You also need to remove the XSM-enabled function from xsm/xsm.h: static inline int xsm_xenmem_get_outstanding_pages(xsm_default_t def) { return xsm_ops->xenmem_get_outstanding_pages(); } diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index 937761f..31e4f73 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 bb10de3..8e93cdb 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; And the entry in xsm_operations from flask/hooks.c: .xenmem_get_outstanding_pages = flask_xenmem_get_outstanding_pages, With those two changes: Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> -- Daniel De Graaf National Security Agency _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |