From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH] libxl: use xc_topologyinfo to figure out how many CPUs we actually have Date: Wed, 09 May 2012 14:45:24 +0200 Message-ID: <1336567524.2621.16.camel@Abyss> References: <420c8861a2d2a61a7e80.1336561430@Solace> <1336565074.25514.104.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2106433101483885304==" Return-path: In-Reply-To: <1336565074.25514.104.camel@zakaz.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: George Dunlap , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org --===============2106433101483885304== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-Zt+sEP/VIgQbIUIvPJLC" --=-Zt+sEP/VIgQbIUIvPJLC Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2012-05-09 at 13:04 +0100, Ian Campbell wrote:=20 > On Wed, 2012-05-09 at 12:03 +0100, Darrio Faggioli wrote: > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > > --- a/tools/libxl/libxl.c > > +++ b/tools/libxl/libxl.c > > @@ -2903,7 +2903,8 @@ libxl_cputopology *libxl_get_cpu_topolog > > } > > =20 > > for (i =3D 0; i < max_cpus; i++) { > > -#define V(map, i) (map[i] =3D=3D INVALID_TOPOLOGY_ID) ? \ > > +#define V(map, i) (i > tinfo.max_cpu_index || \ > > + map[i] =3D=3D INVALID_TOPOLOGY_ID) ? \ >=20 > This ensures that cpus entries above max_cpu_index are > INVALID_TOPOLOGY_ID=20 > Yep, thus giving consumers of this call the chance to figure out what the valid entries are. It looked the most natural way of doing this, given output_topology (for instance) already check for LIBXL_CPUTOPOLOGY_INVALID_ENTRY entries and skip them. Also, the get-cpu-topology command in xenpm, which always worked properly on my testbox, does exactly that. > but do you also want to size the return array using > tinfo.max_cpu_index too? And also return that in *nr instead of? >=20 > (I don't know the answer, either of max-possible- and max-online-cpus is > a reasonable size for this array) >=20 Well, I really don't know either. This is the minimum impact working version. For sure, I'd like very much to return that value via *nr, as it will give me something more sensible to work with... You know what, I'm sending a patch doing exactly that, as I think what you're suggesting is actually better. Thanks, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-Zt+sEP/VIgQbIUIvPJLC 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) iEYEABECAAYFAk+qZuQACgkQk4XaBE3IOsQsGwCfUVKyiupQ+mx/Q90zSwXfaQEi omgAnjc2eoVK8jUNPLiCgnAL18yUgeqb =fjnn -----END PGP SIGNATURE----- --=-Zt+sEP/VIgQbIUIvPJLC-- --===============2106433101483885304== 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 --===============2106433101483885304==--