From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v3 10/14] libxc: get and set soft and hard affinity Date: Tue, 19 Nov 2013 19:01:54 +0100 Message-ID: <1384884114.19880.177.camel@Abyss> References: <20131118175544.31002.79574.stgit@Solace> <20131118181805.31002.28692.stgit@Solace> <1384880938.16252.37.camel@hastur.hellion.org.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7741318838101384448==" Return-path: In-Reply-To: <1384880938.16252.37.camel@hastur.hellion.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Marcus Granado , Keir Fraser , Matt Wilson , Li Yechen , George Dunlap , Andrew Cooper , Juergen Gross , Ian Jackson , xen-devel@lists.xen.org, Jan Beulich , Justin Weaver , Elena Ufimtseva List-Id: xen-devel@lists.xenproject.org --===============7741318838101384448== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-yCB0KgHDIHtljfadIrmp" --=-yCB0KgHDIHtljfadIrmp Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On mar, 2013-11-19 at 17:08 +0000, Ian Campbell wrote: > On Mon, 2013-11-18 at 19:18 +0100, Dario Faggioli wrote: >=20 > > Signed-off-by: Dario Faggioli >=20 > Acked-by: Ian Campbell >=20 Cool. > There are a few preexisting issues with the setaffinity function, but > this just duplicates them into the new cpumap, so I don't see any point > in holding up the series for them. Perhaps you could put them on your > todo list? >=20 I certainly can. > > diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c > > index f9ae4bf..bddf4e0 100644 > > --- a/tools/libxc/xc_domain.c > > +++ b/tools/libxc/xc_domain.c > > @@ -192,44 +192,52 @@ int xc_domain_node_getaffinity(xc_interface *xch, > > int xc_vcpu_setaffinity(xc_interface *xch, > > uint32_t domid, > > int vcpu, > > - xc_cpumap_t cpumap) > > + xc_cpumap_t cpumap, > > + uint32_t flags, > > + xc_cpumap_t ecpumap_out) > > { > > DECLARE_DOMCTL; > > - DECLARE_HYPERCALL_BUFFER(uint8_t, local); > > + DECLARE_HYPERCALL_BUFFER(uint8_t, cpumap_local); > > + DECLARE_HYPERCALL_BUFFER(uint8_t, ecpumap_local); > > int ret =3D -1; > > int cpusize; > > =20 > > cpusize =3D xc_get_cpumap_size(xch); > > - if (!cpusize) > > + if ( !cpusize ) > > { > > PERROR("Could not get number of cpus"); > > - goto out; > > + return -1;; >=20 > Double ";;"? >=20 Ouch... I'll have to respin this series (and will do that shortly), so I'll have a chance to fix this. > > } > > =20 > > - local =3D xc_hypercall_buffer_alloc(xch, local, cpusize); > > - if ( local =3D=3D NULL ) > > + cpumap_local =3D xc_hypercall_buffer_alloc(xch, cpumap_local, cpus= ize); > > + ecpumap_local =3D xc_hypercall_buffer_alloc(xch, ecpumap_local, cp= usize); > > + if ( cpumap_local =3D=3D NULL || cpumap_local =3D=3D NULL) > > { > > - PERROR("Could not allocate memory for setvcpuaffinity domctl h= ypercall"); > > + PERROR("Could not allocate hcall buffers for DOMCTL_setvcpuaff= inity"); > > goto out; > > } > > =20 > > domctl.cmd =3D XEN_DOMCTL_setvcpuaffinity; > > domctl.domain =3D (domid_t)domid; > > domctl.u.vcpuaffinity.vcpu =3D vcpu; > > - /* Soft affinity is there, but not used anywhere for now, so... */ > > - domctl.u.vcpuaffinity.flags =3D XEN_VCPUAFFINITY_HARD; > > - > > - memcpy(local, cpumap, cpusize); > > - > > - set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local); > > + domctl.u.vcpuaffinity.flags =3D flags; > > =20 > > + memcpy(cpumap_local, cpumap, cpusize); >=20 > This risks running of the end of the supplies cpumap, if it is smaller > than cpusize. >=20 I see. Added to my todo list. :-) > But more importantly why is this not using the hypercall buffer bounce > mechanism? >=20 I happen to have investigated that (with the aim of doing the switch). So, AFAICT, declaring a bounce buffer requires the size of it to be known at declaration time, is that correct? OTOH, looks like plain hypercall buffer is not interested in that until you get to xc_buffer_alloc() it. In this case, I don't have the size of the buffer until I get to call xc_get_cpumap_size(), and that's why I gave up turning this (and the new one I'm introducing) into bouncing buffers. If I'm missing/misunderstanding something, and it's actually possible to do so (how?), I'd be glad to. Thanks and Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-yCB0KgHDIHtljfadIrmp 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.15 (GNU/Linux) iEYEABECAAYFAlKLp5IACgkQk4XaBE3IOsQTeQCdHH9mKif+gti3mpbqfDv7yBU+ prQAn39QnF32phhjJrWJIRDClJscLpuk =7AFJ -----END PGP SIGNATURE----- --=-yCB0KgHDIHtljfadIrmp-- --===============7741318838101384448== 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 --===============7741318838101384448==--