From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH RESEND 09/12] libxc: numa-sched: enable getting/specifying per-vcpu node-affinity Date: Tue, 12 Nov 2013 11:01:44 -0500 Message-ID: <20131112160144.GB11354@phenom.dumpdata.com> References: <20131105142844.30446.78671.stgit@Solace> <20131105143542.30446.5398.stgit@Solace> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20131105143542.30446.5398.stgit@Solace> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dario Faggioli Cc: Marcus Granado , Keir Fraser , Ian Campbell , Li Yechen , George Dunlap , Andrew Cooper , Juergen Gross , Ian Jackson , xen-devel@lists.xen.org, Jan Beulich , Justin Weaver , Daniel De Graaf , Matt Wilson , Elena Ufimtseva List-Id: xen-devel@lists.xenproject.org On Tue, Nov 05, 2013 at 03:35:42PM +0100, Dario Faggioli wrote: > by providing the proper get/set interfaces and wiring them > to the new domctl-s from the previous commit. s/previous commit// > > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> > --- > tools/libxc/xc_domain.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++ > tools/libxc/xenctrl.h | 19 +++++++++++ > 2 files changed, 101 insertions(+) > > diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c > index f8825a3..e44ad2e 100644 > --- a/tools/libxc/xc_domain.c > +++ b/tools/libxc/xc_domain.c > @@ -272,6 +272,88 @@ out: > return ret; > } > > +int xc_vcpu_setnodeaffinity(xc_interface *xch, > + uint32_t domid, > + int vcpu, > + xc_nodemap_t nodemap) > +{ > + DECLARE_DOMCTL; > + DECLARE_HYPERCALL_BUFFER(uint8_t, local); > + int ret = -1; Ewww.. Could we just use regular -Exx for new xc_* calls? > + int nodesize; > + > + nodesize = xc_get_cpumap_size(xch); > + if (!nodesize) > + { > + PERROR("Could not get number of nodes"); Extra space. > + goto out; > + } > + > + local = xc_hypercall_buffer_alloc(xch, local, nodesize); > + if ( local == NULL ) > + { > + PERROR("Could not allocate memory for setvcpunodeaffinity domctl hypercall"); > + goto out; > + } > + > + domctl.cmd = XEN_DOMCTL_setvcpunodeaffinity; > + domctl.domain = (domid_t)domid; > + domctl.u.vcpuaffinity.vcpu = vcpu; > + > + memcpy(local, nodemap, nodesize); > + > + set_xen_guest_handle(domctl.u.vcpuaffinity.map.bitmap, local); > + > + domctl.u.vcpuaffinity.map.nr_bits = nodesize * 8; > + > + ret = do_domctl(xch, &domctl); > + > + xc_hypercall_buffer_free(xch, local); > + > + out: > + return ret; > +} > + > +int xc_vcpu_getnodeaffinity(xc_interface *xch, > + uint32_t domid, > + int vcpu, > + xc_nodemap_t nodemap) > +{ > + DECLARE_DOMCTL; > + DECLARE_HYPERCALL_BUFFER(uint8_t, local); > + int ret = -1; > + int nodesize; > + > + nodesize = xc_get_nodemap_size(xch); > + if (!nodesize) > + { > + PERROR("Could not get number of nodes"); > + goto out; > + } > + > + local = xc_hypercall_buffer_alloc(xch, local, nodesize); > + if (local == NULL) > + { > + PERROR("Could not allocate memory for getvcpunodeaffinity domctl hypercall"); > + goto out; > + } > + > + domctl.cmd = XEN_DOMCTL_getvcpunodeaffinity; > + domctl.domain = (domid_t)domid; > + domctl.u.vcpuaffinity.vcpu = vcpu; > + > + set_xen_guest_handle(domctl.u.vcpuaffinity.map.bitmap, local); > + domctl.u.vcpuaffinity.map.nr_bits = nodesize * 8; Could the 8 be replaced by a sizeof? > + > + ret = do_domctl(xch, &domctl); > + > + memcpy(nodemap, local, nodesize); > + > + xc_hypercall_buffer_free(xch, local); > +out: > + return ret; > +} > + > int xc_domain_get_guest_width(xc_interface *xch, uint32_t domid, > unsigned int *guest_width) > { > diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h > index 8cf3f3b..208fa2c 100644 > --- a/tools/libxc/xenctrl.h > +++ b/tools/libxc/xenctrl.h > @@ -551,6 +551,25 @@ int xc_domain_node_getaffinity(xc_interface *xch, > uint32_t domind, > xc_nodemap_t nodemap); > > +/** > + * These functions set and retrieves the NUMA node-affinity > + * of a specific vcpu. > + * > + * @parm xch a handle to an open hypervisor interface. > + * @parm domid the domain id one is interested in. > + * @parm vcpu the vcpu one wants to set/get the affinity of. > + * @parm nodemap the map of the affine nodes. > + * @return 0 on success, -1 on failure. and something in errno? > + */ > +int xc_vcpu_setnodeaffinity(xc_interface *xch, > + uint32_t domid, > + int vcpu, > + xc_nodemap_t nodemap); > +int xc_vcpu_getnodeaffinity(xc_interface *xch, > + uint32_t domid, > + int vcpu, > + xc_nodemap_t nodemap); > + > int xc_vcpu_setaffinity(xc_interface *xch, > uint32_t domid, > int vcpu, > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel