[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 2/7] libxc: Plumb Xen with vNUMA topology for domain.
Per-domain vNUMA topology initialization. domctl hypercall is used to set vNUMA topology per domU during domain build time. Signed-off-by: Elena Ufimtseva <ufimtseva@xxxxxxxxx> --- tools/libxc/xc_dom.h | 9 +++++++ tools/libxc/xc_domain.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 9 +++++++ 3 files changed, 79 insertions(+) diff --git a/tools/libxc/xc_dom.h b/tools/libxc/xc_dom.h index 86e23ee..42a16c9 100644 --- a/tools/libxc/xc_dom.h +++ b/tools/libxc/xc_dom.h @@ -114,6 +114,15 @@ struct xc_dom_image { struct xc_dom_phys *phys_pages; int realmodearea_log; + /* + * vNUMA topology and memory allocation structure. + * Defines the way to allocate memory on per NUMA + * physical nodes that is defined by vnode_numamap. + */ + uint32_t nr_vnodes; + uint64_t *vnuma_memszs; + unsigned int *vnode_numamap; + /* malloc memory pool */ struct xc_dom_mem *memblocks; diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 1ccafc5..afa8667 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -1776,6 +1776,67 @@ int xc_domain_set_max_evtchn(xc_interface *xch, uint32_t domid, return do_domctl(xch, &domctl); } +/* Plumbs Xen with vNUMA topology */ +int xc_domain_setvnodes(xc_interface *xch, + uint32_t domid, + uint16_t nr_vnodes, + uint16_t nr_vcpus, + vmemrange_t *vmemrange, + unsigned int *vdistance, + unsigned int *vcpu_to_vnode, + unsigned int *vnode_numamap) +{ + int rc; + DECLARE_DOMCTL; + DECLARE_HYPERCALL_BOUNCE(vmemrange, sizeof(*vmemrange) * nr_vnodes, + XC_HYPERCALL_BUFFER_BOUNCE_BOTH); + DECLARE_HYPERCALL_BOUNCE(vdistance, sizeof(*vdistance) * + nr_vnodes * nr_vnodes, + XC_HYPERCALL_BUFFER_BOUNCE_BOTH); + DECLARE_HYPERCALL_BOUNCE(vcpu_to_vnode, sizeof(*vcpu_to_vnode) * nr_vcpus, + XC_HYPERCALL_BUFFER_BOUNCE_BOTH); + DECLARE_HYPERCALL_BOUNCE(vnode_numamap, sizeof(*vnode_numamap) * + nr_vnodes, + XC_HYPERCALL_BUFFER_BOUNCE_BOTH); + if ( nr_vnodes == 0 ) + return -EINVAL; + + if ( vdistance == NULL || vcpu_to_vnode == NULL || + vmemrange == NULL || vnode_numamap == NULL ) { + PERROR("Incorrect parameters for XEN_DOMCTL_setvnumainfo.\n"); + return -EINVAL; + } + + rc = -EFAULT; + + if ( xc_hypercall_bounce_pre(xch, vmemrange) || + xc_hypercall_bounce_pre(xch, vdistance) || + xc_hypercall_bounce_pre(xch, vcpu_to_vnode) || + xc_hypercall_bounce_pre(xch, vnode_numamap) ) { + PERROR("Could not bounce buffer for xc_domain_setvnodes.\n"); + return rc; + } + + set_xen_guest_handle(domctl.u.vnuma.vmemrange, vmemrange); + set_xen_guest_handle(domctl.u.vnuma.vdistance, vdistance); + set_xen_guest_handle(domctl.u.vnuma.vcpu_to_vnode, vcpu_to_vnode); + set_xen_guest_handle(domctl.u.vnuma.vnode_numamap, vnode_numamap); + + domctl.cmd = XEN_DOMCTL_setvnumainfo; + domctl.domain = (domid_t)domid; + domctl.u.vnuma.nr_vnodes = nr_vnodes; + domctl.u.vnuma.__pad = 0; + + rc = do_domctl(xch, &domctl); + + xc_hypercall_bounce_post(xch, vmemrange); + xc_hypercall_bounce_post(xch, vdistance); + xc_hypercall_bounce_post(xch, vcpu_to_vnode); + xc_hypercall_bounce_post(xch, vnode_numamap); + + return rc; +} + /* * Local variables: * mode: C diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 8cf3f3b..451660e 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1108,6 +1108,15 @@ int xc_domain_set_memmap_limit(xc_interface *xch, uint32_t domid, unsigned long map_limitkb); +int xc_domain_setvnodes(xc_interface *xch, + uint32_t domid, + uint16_t nr_vnodes, + uint16_t nr_vcpus, + vmemrange_t *vmemrange, + unsigned int *vdistance, + unsigned int *vcpu_to_vnode, + unsigned int *vnode_numamap); + #if defined(__i386__) || defined(__x86_64__) /* * PC BIOS standard E820 types and structure. -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |