From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 03 of 11] libxc, libxl: introduce xc_nodemap_t and libxl_nodemap Date: Thu, 31 May 2012 18:09:39 +0200 Message-ID: <1338480579.15014.76.camel@Solace> References: <7d16724e5eced0986454.1338466268@Solace> <4FC79133.6030703@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6540978780560861202==" Return-path: In-Reply-To: <4FC79133.6030703@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: Andre Przywara , Ian Campbell , Stefano Stabellini , Juergen Gross , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org --===============6540978780560861202== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-lKaBspg3ye2NxSR3dpJ+" --=-lKaBspg3ye2NxSR3dpJ+ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2012-05-31 at 16:41 +0100, George Dunlap wrote: > > +int xc_get_max_nodes(xc_interface *xch) > > +{ > > + static int max_nodes =3D 0; > > + xc_physinfo_t physinfo; > > + > > + if ( max_nodes ) > > + return max_nodes; > > + > > + if ( !xc_physinfo(xch,&physinfo) ) > > + max_nodes =3D physinfo.max_node_id + 1; > > + > > + return max_nodes; > What does xc_physinfo() return? Should this return the error message=20 > rather than 0 if it fails? >=20 int xc_get_max_cpus(xc_interface *xch) { static int max_cpus =3D 0; xc_physinfo_t physinfo; if ( max_cpus ) return max_cpus; if ( !xc_physinfo(xch, &physinfo) ) max_cpus =3D physinfo.max_cpu_id + 1; return max_cpus; } And I guess the reason for this is this is used (both in libxc and libxl) in a few places to determine the size of the array that will host the cpu map. Thus, getting a 0 ensures we do not allocate a random amount of memory. Of course it should be more than possible to change it, but going though all the callers is needed. If you want me to do that, just say it, and I will perhaps deal with both this "original" and my "variant", right? Thanks and Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-lKaBspg3ye2NxSR3dpJ+ 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/Hl8MACgkQk4XaBE3IOsQEYQCeJ/WBTgtbKsZs7ibkbHgTOilh v90Anit/zrs5SaR8sdSsIDQMAxsxVjzb =nmh6 -----END PGP SIGNATURE----- --=-lKaBspg3ye2NxSR3dpJ+-- --===============6540978780560861202== 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 --===============6540978780560861202==--