From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 05 of 10 v2] libxc: allow for explicitly specifying node-affinity Date: Fri, 21 Dec 2012 17:27:04 +0100 Message-ID: <1356107224.15403.78.camel@Abyss> References: <61299b4cdc2abbdf9bfb.1355944041@Solace> <50D47E12.3040803@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2945805627579981142==" Return-path: In-Reply-To: <50D47E12.3040803@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Marcus Granado , Dan Magenheimer , Ian Campbell , Anil Madhavapeddy , Andrew Cooper , Juergen Gross , Ian Jackson , "xen-devel@lists.xen.org" , Jan Beulich , Daniel De Graaf , Matt Wilson List-Id: xen-devel@lists.xenproject.org --===============2945805627579981142== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-iziipxIqShOkNz8FzTAF" --=-iziipxIqShOkNz8FzTAF Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2012-12-21 at 15:19 +0000, George Dunlap wrote:=20 > On 19/12/12 19:07, Dario Faggioli wrote: > > By providing the proper get/set interface and wiring them > > to the new domctl-s from the previous commit. > > > > Signed-off-by: Dario Faggioli > > Acked-by: Juergen Gross >=20 > I haven't done a detailed review, but everything looks OK: >=20 > Acked-by: George Dunlap >=20 Ok. Also, let me use this e-mail to thank you properly for the thorough, useful and especially quick review! All you said was really useful, I'll do my best do address the points you raised in a proper and equally quick manner. See you in 2013 (I'm going on vacation today) with v3! :-D Thanks again and Regards, Dario > > > > diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c > > --- a/tools/libxc/xc_domain.c > > +++ b/tools/libxc/xc_domain.c > > @@ -110,6 +110,83 @@ int xc_domain_shutdown(xc_interface *xch > > } > > =20 > > =20 > > +int xc_domain_node_setaffinity(xc_interface *xch, > > + uint32_t domid, > > + xc_nodemap_t nodemap) > > +{ > > + DECLARE_DOMCTL; > > + DECLARE_HYPERCALL_BUFFER(uint8_t, local); > > + int ret =3D -1; > > + int nodesize; > > + > > + nodesize =3D xc_get_nodemap_size(xch); > > + if (!nodesize) > > + { > > + PERROR("Could not get number of nodes"); > > + goto out; > > + } > > + > > + local =3D xc_hypercall_buffer_alloc(xch, local, nodesize); > > + if ( local =3D=3D NULL ) > > + { > > + PERROR("Could not allocate memory for setnodeaffinity domctl h= ypercall"); > > + goto out; > > + } > > + > > + domctl.cmd =3D XEN_DOMCTL_setnodeaffinity; > > + domctl.domain =3D (domid_t)domid; > > + > > + memcpy(local, nodemap, nodesize); > > + set_xen_guest_handle(domctl.u.nodeaffinity.nodemap.bitmap, local); > > + domctl.u.nodeaffinity.nodemap.nr_elems =3D nodesize * 8; > > + > > + ret =3D do_domctl(xch, &domctl); > > + > > + xc_hypercall_buffer_free(xch, local); > > + > > + out: > > + return ret; > > +} > > + > > +int xc_domain_node_getaffinity(xc_interface *xch, > > + uint32_t domid, > > + xc_nodemap_t nodemap) > > +{ > > + DECLARE_DOMCTL; > > + DECLARE_HYPERCALL_BUFFER(uint8_t, local); > > + int ret =3D -1; > > + int nodesize; > > + > > + nodesize =3D xc_get_nodemap_size(xch); > > + if (!nodesize) > > + { > > + PERROR("Could not get number of nodes"); > > + goto out; > > + } > > + > > + local =3D xc_hypercall_buffer_alloc(xch, local, nodesize); > > + if ( local =3D=3D NULL ) > > + { > > + PERROR("Could not allocate memory for getnodeaffinity domctl h= ypercall"); > > + goto out; > > + } > > + > > + domctl.cmd =3D XEN_DOMCTL_getnodeaffinity; > > + domctl.domain =3D (domid_t)domid; > > + > > + set_xen_guest_handle(domctl.u.nodeaffinity.nodemap.bitmap, local); > > + domctl.u.nodeaffinity.nodemap.nr_elems =3D nodesize * 8; > > + > > + ret =3D do_domctl(xch, &domctl); > > + > > + memcpy(nodemap, local, nodesize); > > + > > + xc_hypercall_buffer_free(xch, local); > > + > > + out: > > + return ret; > > +} > > + > > int xc_vcpu_setaffinity(xc_interface *xch, > > uint32_t domid, > > int vcpu, > > diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h > > --- a/tools/libxc/xenctrl.h > > +++ b/tools/libxc/xenctrl.h > > @@ -521,6 +521,32 @@ int xc_watchdog(xc_interface *xch, > > uint32_t id, > > uint32_t timeout); > > =20 > > +/** > > + * This function explicitly sets the host NUMA nodes the domain will > > + * have affinity with. > > + * > > + * @parm xch a handle to an open hypervisor interface. > > + * @parm domid the domain id one wants to set the affinity of. > > + * @parm nodemap the map of the affine nodes. > > + * @return 0 on success, -1 on failure. > > + */ > > +int xc_domain_node_setaffinity(xc_interface *xch, > > + uint32_t domind, > > + xc_nodemap_t nodemap); > > + > > +/** > > + * This function retrieves the host NUMA nodes the domain has > > + * affinity with. > > + * > > + * @parm xch a handle to an open hypervisor interface. > > + * @parm domid the domain id one wants to get the node affinity of. > > + * @parm nodemap the map of the affine nodes. > > + * @return 0 on success, -1 on failure. > > + */ > > +int xc_domain_node_getaffinity(xc_interface *xch, > > + uint32_t domind, > > + xc_nodemap_t nodemap); > > + > > int xc_vcpu_setaffinity(xc_interface *xch, > > uint32_t domid, > > int vcpu, >=20 >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-iziipxIqShOkNz8FzTAF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEABECAAYFAlDUjdgACgkQk4XaBE3IOsRVXACfQu7y0peugPYfguuT+2kx1gOp xgIAn144+LZ0z7zNHe39TA1F0nDOlIAk =AIui -----END PGP SIGNATURE----- --=-iziipxIqShOkNz8FzTAF-- --===============2945805627579981142== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============2945805627579981142==--