[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86: expose XENMEM_get_pod_target to subject domain
Not having got any satisfactory suggestions on the inquiry on how to determine the amount a PoD guest needs to balloon down by (see http://lists.xenproject.org/archives/html/xen-devel/2014-01/msg01524.html and the thread following it), expose XENMEM_get_pod_target such that the guest can use it for this purpose. Also leverage some cleanup potential resulting from this change. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4800,7 +4800,6 @@ long arch_memory_op(int op, XEN_GUEST_HA { xen_pod_target_t target; struct domain *d; - struct p2m_domain *p2m; if ( copy_from_guest(&target, arg, 1) ) return -EFAULT; @@ -4810,23 +4809,17 @@ long arch_memory_op(int op, XEN_GUEST_HA return -ESRCH; if ( op == XENMEM_set_pod_target ) - rc = xsm_set_pod_target(XSM_PRIV, d); - else - rc = xsm_get_pod_target(XSM_PRIV, d); - - if ( rc != 0 ) - goto pod_target_out_unlock; - - if ( op == XENMEM_set_pod_target ) { - if ( target.target_pages > d->max_pages ) - { + rc = xsm_set_pod_target(XSM_PRIV, d); + if ( rc ) + /* nothing */; + else if ( target.target_pages > d->max_pages ) rc = -EINVAL; - goto pod_target_out_unlock; - } - - rc = p2m_pod_set_mem_target(d, target.target_pages); + else + rc = p2m_pod_set_mem_target(d, target.target_pages); } + else + rc = xsm_get_pod_target(XSM_TARGET, d); if ( rc == -EAGAIN ) { @@ -4835,19 +4828,16 @@ long arch_memory_op(int op, XEN_GUEST_HA } else if ( rc >= 0 ) { - p2m = p2m_get_hostp2m(d); + const struct p2m_domain *p2m = p2m_get_hostp2m(d); + target.tot_pages = d->tot_pages; target.pod_cache_pages = p2m->pod.count; target.pod_entries = p2m->pod.entry_count; if ( __copy_to_guest(arg, &target, 1) ) - { rc= -EFAULT; - goto pod_target_out_unlock; - } } - pod_target_out_unlock: rcu_unlock_domain(d); return rc; } --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -307,7 +307,7 @@ static XSM_INLINE char *xsm_show_securit static XSM_INLINE int xsm_get_pod_target(XSM_DEFAULT_ARG struct domain *d) { - XSM_ASSERT_ACTION(XSM_PRIV); + XSM_ASSERT_ACTION(XSM_TARGET); return xsm_default_action(action, current->domain, d); } Attachment:
expose-get_pod_target.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |