From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v4 12/15] libxl: get and set soft affinity Date: Mon, 2 Dec 2013 19:17:28 +0100 Message-ID: <1386008248.5338.219.camel@Solace> References: <20131122183332.11200.20231.stgit@Solace> <20131122185815.11200.98514.stgit@Solace> <1385563534.30237.19.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7989789985906234426==" Return-path: In-Reply-To: <1385563534.30237.19.camel@kazak.uk.xensource.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: Ian Campbell Cc: Marcus Granado , Keir Fraser , Jan Beulich , Li Yechen , George Dunlap , Andrew Cooper , Juergen Gross , Ian Jackson , xen-devel@lists.xen.org, Matt Wilson , Justin Weaver , Elena Ufimtseva List-Id: xen-devel@lists.xenproject.org --===============7989789985906234426== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-vRctqpi9c67hq3jJ2ArW" --=-vRctqpi9c67hq3jJ2ArW Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On mer, 2013-11-27 at 14:45 +0000, Ian Campbell wrote: > On Fri, 2013-11-22 at 19:58 +0100, Dario Faggioli wrote: > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > > index 961d55e..4b871d7 100644 > > --- a/tools/libxl/libxl.c > > +++ b/tools/libxl/libxl.c > > @@ -4538,6 +4538,8 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, u= int32_t domid, > > for (*nb_vcpu =3D 0; *nb_vcpu <=3D domaininfo.max_vcpu_id; ++*nb_v= cpu, ++ptr) { > > if (libxl_cpu_bitmap_alloc(ctx, &ptr->cpumap, 0)) > > return NULL; > > + if (libxl_cpu_bitmap_alloc(ctx, &ptr->cpumap_soft, 0)) > > + return NULL; >=20 > Leaks ptr and ptr->cpumap... >=20 Addressed in a separate patch (still part of the new version, v5, of the series). > > + */ > > +#define LIBXL_HAVE_SOFT_AFFINITY 1 > > + > > +/* > > * LIBXL_HAVE_BUILDINFO_HVM_VENDOR_DEVICE indicates that the > > * libxl_vendor_device field is present in the hvm sections of > > * libxl_domain_build_info. This field tells libxl which > > @@ -994,9 +1002,35 @@ int libxl_userdata_retrieve(libxl_ctx *ctx, uint3= 2_t domid, > > =20 > > int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo); > > int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vc= puid, > > - libxl_bitmap *cpumap); > > + const libxl_bitmap *cpumap_hard, > > + const libxl_bitmap *cpumap_soft); > > int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid, > > - unsigned int max_vcpus, libxl_bitmap *c= pumap); > > + unsigned int max_vcpus, > > + const libxl_bitmap *cpumap_hard, > > + const libxl_bitmap *cpumap_soft); > > + > > +#if defined (LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x040400 > > + > > +static inline > > +int libxl_set_vcpuaffinity_0x040200(libxl_ctx *ctx, uint32_t domid, > > + uint32_t vcpuid, libxl_bitmap *cpu= map) > > +{ > > + return libxl_set_vcpuaffinity(ctx, domid, vcpuid, cpumap, NULL); > > +} > > + > > +static inline > > +int libxl_set_vcpuaffinity_all_0x040200(libxl_ctx *ctx, uint32_t domid= , > > + unsigned int max_vcpus, > > + libxl_bitmap *cpumap) > > +{ > > + return libxl_set_vcpuaffinity_all(ctx, domid, max_vcpus, cpumap, N= ULL); > > +} > > + > > +#define libxl_set_vcpuaffinity libxl_set_vcpuaffinity_0x040200 > > +#define libxl_set_vcpuaffinity_all libxl_set_vcpuaffinity_all_0x040200 >=20 > This looks correct, thanks. It could also have jsut been #defined since > the inline is only used in the libxl_domain_create_restore_0x040200 case > because there is a local variable. > Yes, I saw that. You mean something like this: #define libxl_set_vcpuaffinity(_ctx, _domid, _vcpuid, _map) \ libxl_set_vcpuaffinity((_ctx), (_domid), (_vcpuid), (_map), NULL) ? Well, I guess I can, but don't I more protection for the arguments / risk to clash with the app namespace, if I do? That's the main reason why I used the inline variant, and that is true for v5 as well. If you prefer to go with the `#define' only, I can respin (either the series or the patch). 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) --=-vRctqpi9c67hq3jJ2ArW 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) iEYEABECAAYFAlKczrgACgkQk4XaBE3IOsSqmACfUE6YV9ON/SiGJxvOsN/I7i1f QTAAoKBtd7uuHm3Mry33tNsMptnjVilK =31/g -----END PGP SIGNATURE----- --=-vRctqpi9c67hq3jJ2ArW-- --===============7989789985906234426== 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 --===============7989789985906234426==--