From: Dario Faggioli Subject: Re: [PATCH v2 4/4] libxl: Add interface for querying hypervisor about PCI topology Date: Wed, 7 Jan 2015 10:04:05 +0100 Message-ID: <1420621445.17031.18.camel@Abyss.station> References: <1420510737-22813-1-git-send-email-boris.ostrovsky@oracle.com> <1420510737-22813-5-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5763478900535994196==" Return-path: In-Reply-To: <1420510737-22813-5-git-send-email-boris.ostrovsky@oracle.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: Boris Ostrovsky Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, jbeulich@suse.com, keir@xen.org, ufimtseva@gmail.com List-Id: xen-devel@lists.xenproject.org --===============5763478900535994196== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-GkuW9hhZa2BN4J9E1fZh" --=-GkuW9hhZa2BN4J9E1fZh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2015-01-05 at 21:18 -0500, Boris Ostrovsky wrote: > .. and use this new interface to display it along with CPU topology > and NUMA information when 'xl info -n' command is issued >=20 Also, can we see how an `xl info -n' looks, on an IONUMA system? > @@ -195,6 +195,24 @@ int xc_cputopoinfo(xc_interface *xch, > return 0; > } > =20 > +int xc_pcitopoinfo(xc_interface *xch, > + xc_pcitopoinfo_t *put_info) > +{ > + int ret; > + DECLARE_SYSCTL; > + > + sysctl.cmd =3D XEN_SYSCTL_pcitopoinfo; > + > + memcpy(&sysctl.u.pcitopoinfo, put_info, sizeof(*put_info)); > + > + if ( (ret =3D do_sysctl(xch, &sysctl)) !=3D 0 ) > + return ret; > + > + memcpy(put_info, &sysctl.u.pcitopoinfo, sizeof(*put_info)); > + > + return 0; > +} > @@ -5121,6 +5121,64 @@ libxl_cputopology *libxl_get_cpu_topology(libxl_ct= x *ctx, int *nb_cpu_out) > return ret; > } > =20 > +libxl_pcitopology *libxl_get_pci_topology(libxl_ctx *ctx, int *num_devs) > +{ > + GC_INIT(ctx); > + xc_pcitopoinfo_t tinfo; > + DECLARE_HYPERCALL_BUFFER(xen_sysctl_pcitopo_t, pcitopo); > + libxl_pcitopology *ret =3D NULL; > + int i, rc; > + I see from where this comes from. However, at least from new functions, I think we should avoid using things like DECLARE_HYPERCALL_BUFFER etc., in libxl. They belong in libxc, IMO. This is basically what Andrew was doing here (although that was on xc_{topology,numa}info: http://xenbits.xen.org/gitweb/?p=3Dpeople/andrewcoop/xen.git;a=3Dshortlog;h= =3Drefs/heads/hwloc-support-experimental http://xenbits.xen.org/gitweb/?p=3Dpeople/andrewcoop/xen.git;a=3Dblobdiff;f= =3Dtools/libxc/xc_misc.c;h=3D4f672cead5a4d2b1fc23bcddb6fb49e4d6ec72b5;hp=3D= 330345459176961cacc7fda506e843831fe7156a;hb=3D3585994405b6a73c137309dd4be91= f48c71e4903;hpb=3D9a80d5056766535ac624774b96495f8b97b1d28b Basically, what I'm suggesting is to have xc_pcitopoinfo() to do most of the work, with libxl_get_pci_topology being just a wrapper to it. In fact, if you grep/cscope for things like DECLARE_HYPERCALL_BUFFER in tools/libxl, the *only* results are these: libxl.c libxl_get_cpu_topology 5076 DECLARE_HY= PERCALL_BUFFER(xc_cpu_to_core_t, coremap); libxl.c libxl_get_cpu_topology 5077 DECLARE_HY= PERCALL_BUFFER(xc_cpu_to_socket_t, socketmap); libxl.c libxl_get_cpu_topology 5078 DECLARE_HY= PERCALL_BUFFER(xc_cpu_to_node_t, nodemap); libxl.c libxl_get_numainfo 5142 DECLARE_HY= PERCALL_BUFFER(xc_node_to_memsize_t, memsize); libxl.c libxl_get_numainfo 5143 DECLARE_HY= PERCALL_BUFFER(xc_node_to_memfree_t, memfree); libxl.c libxl_get_numainfo 5144 DECLARE_HY= PERCALL_BUFFER(uint32_t, node_dists); And I think we should work toward removing these too, rather than adding new ones! :-) Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-GkuW9hhZa2BN4J9E1fZh 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 v2 iEYEABECAAYFAlSs9oUACgkQk4XaBE3IOsQ/1QCeJj4mluGw4IRGN7wZkkxusdZs 6Q4Anjnej2SSVa9l9zJOzncKfSyDt5z9 =Lhtt -----END PGP SIGNATURE----- --=-GkuW9hhZa2BN4J9E1fZh-- --===============5763478900535994196== 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 --===============5763478900535994196==--