From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMRu5-0002nh-92 for qemu-devel@nongnu.org; Sun, 10 Jul 2016 23:29:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMRtz-0003th-8F for qemu-devel@nongnu.org; Sun, 10 Jul 2016 23:29:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMRty-0003td-Vo for qemu-devel@nongnu.org; Sun, 10 Jul 2016 23:28:59 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02FFA37E71 for ; Mon, 11 Jul 2016 03:28:58 +0000 (UTC) Date: Mon, 11 Jul 2016 13:30:38 +1000 From: David Gibson Message-ID: <20160711133038.4f255844@voom.fritz.box> In-Reply-To: <20160708134038.36d18a6c@nial.brq.redhat.com> References: <59c8f2c8e80d705fb4981bddd9fe703c1205346c.1467904342.git.pkrempa@redhat.com> <20160708121855.36e0702d@voom.fritz.box> <20160708134038.36d18a6c@nial.brq.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/YKTpeEVwnBY77_x9zKhCdFd"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [RFC PATCH 1/2] qapi: Add vcpu id to query-hotpluggable-cpus output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Peter Krempa , qemu-devel@nongnu.org --Sig_/YKTpeEVwnBY77_x9zKhCdFd Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 8 Jul 2016 13:40:38 +0200 Igor Mammedov wrote: > On Fri, 8 Jul 2016 12:18:55 +1000 > David Gibson wrote: >=20 > > On Thu, 7 Jul 2016 17:17:13 +0200 > > Peter Krempa wrote: > > =20 > > > Add 'vcpu index' to the output of query hotpluggable cpus. This output > > > is identical to the linear cpu index taken by the 'cpus' attribute > > > passed to -numa. =20 > >=20 > >=20 > > The problem is, the vcpu index of what? Each entry in the hotpluggable > > cpus table could represent more than one vcpu. =20 > agreed, > -numa cpus should take socket/core/thread-ids instead so that mgmt > could do layout at start-up time >=20 > for example if mgmt specifies > -smp cpus=3D1,sockets=3D2,cores=3D2,maxcpus=3D4 > it knows socket/core layout and can assign them as desired > -numa nodeid=3D0,cpu=3D[socket-id=3D0,core-id=3D0] \ > -numa nodeid=3D1,cpu=3D[socket-id=3D0,core-id=3D1] \ > -numa nodeid=3D2,cpu=3D[socket-id=3D1] >=20 > that of cause assuming that QEMU would guarantee IDs are are ranges [0..s= ockets), ... > it's so for x86, can we guarantee it for spapr? Urgh.. we could for spapr, but I think it's bad idea to do that in general. For powernv (or others) we might want to use socket ids with a physical meaning (e.g. actual values of chip select lines) and those might not be contiguous. >=20 > > =20 > > > This will allow to reliably map the cpu number to a given topology > > > element without making mgmt apps to reimplement the mapping. > > >=20 > > > Signed-off-by: Peter Krempa > > > --- > > > hmp.c | 1 + > > > hw/i386/pc.c | 1 + > > > hw/ppc/spapr.c | 1 + > > > qapi-schema.json | 2 ++ > > > 4 files changed, 5 insertions(+) > > >=20 > > > diff --git a/hmp.c b/hmp.c > > > index 0cf5baa..613601e 100644 > > > --- a/hmp.c > > > +++ b/hmp.c > > > @@ -2450,6 +2450,7 @@ void hmp_hotpluggable_cpus(Monitor *mon, const = QDict *qdict) > > > monitor_printf(mon, " type: \"%s\"\n", l->value->type); > > > monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n", > > > l->value->vcpus_count); > > > + monitor_printf(mon, " vcpu_id: \"%" PRIu64 "\"\n", l->value= ->vcpu_id); > > > if (l->value->has_qom_path) { > > > monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qo= m_path); > > > } > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > > index f293a0c..4ba02c4 100644 > > > --- a/hw/i386/pc.c > > > +++ b/hw/i386/pc.c > > > @@ -2131,6 +2131,7 @@ static HotpluggableCPUList *pc_query_hotpluggab= le_cpus(MachineState *machine) > > >=20 > > > cpu_item->type =3D g_strdup(cpu_type); > > > cpu_item->vcpus_count =3D 1; > > > + cpu_item->vcpu_id =3D i; > > > cpu_props->has_socket_id =3D true; > > > cpu_props->socket_id =3D topo.pkg_id; > > > cpu_props->has_core_id =3D true; > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > > index 7f33a1b..d1f5195 100644 > > > --- a/hw/ppc/spapr.c > > > +++ b/hw/ppc/spapr.c > > > @@ -2378,6 +2378,7 @@ static HotpluggableCPUList *spapr_query_hotplug= gable_cpus(MachineState *machine) > > >=20 > > > cpu_item->type =3D spapr_get_cpu_core_type(machine->cpu_mode= l); > > > cpu_item->vcpus_count =3D smp_threads; > > > + cpu_item->vcpu_id =3D i; =20 > >=20 > > This is wrong. This is the index of the core. The individual vcpus > > within the core will have ids starting at core_id and working up. > > =20 > > > cpu_props->has_core_id =3D true; > > > cpu_props->core_id =3D i * smt; > > > /* TODO: add 'has_node/node' here to describe > > > diff --git a/qapi-schema.json b/qapi-schema.json > > > index ba3bf14..6db9294 100644 > > > --- a/qapi-schema.json > > > +++ b/qapi-schema.json > > > @@ -4292,6 +4292,7 @@ > > > # @type: CPU object type for usage with device_add command > > > # @props: list of properties to be used for hotplugging CPU > > > # @vcpus-count: number of logical VCPU threads @HotpluggableCPU prov= ides > > > +# @vcpu-id: linear index of the vcpu > > > # @qom-path: #optional link to existing CPU object if CPU is present= or > > > # omitted if CPU is not present. > > > # > > > @@ -4300,6 +4301,7 @@ > > > { 'struct': 'HotpluggableCPU', > > > 'data': { 'type': 'str', > > > 'vcpus-count': 'int', > > > + 'vcpu-id': 'int', > > > 'props': 'CpuInstanceProperties', > > > '*qom-path': 'str' > > > } > > > --=20 > > > 2.9.0 > > > =20 > >=20 > > =20 >=20 --=20 David Gibson Senior Software Engineer, Virtualization, Red Hat --Sig_/YKTpeEVwnBY77_x9zKhCdFd Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXgxLeAAoJEGw4ysog2bOSNH4P/RAas9QRf3tdeSKtFv5nLA1q MwbB/KXBMeFdOfwJnOIxsYsFoLbCcucwBWB33WfaGXacBd2PzAKrk7T+Tqzb4juG Qc5QME3dTidcKNAsTZlMf7S71+uWHlXmQD/ZWQT6VastTc+xg/OK31hWmULFdzmQ FTD40HYaujwSrZZw2hg+aktJKgrbvrPtoH8RrSQxJBWLwlHoCGajdKJ5EEuzk9Tx ntIRsWgrRIHGsBqt40jfSx5tyaUddBQPxcydokywt7zF71uo5bsF1GPqJ2zZv3TQ Zeywu8ks0PeShspfpCjg0czsliAT1oKY94O7rjYnJRTMLRiyIKwsKKqgAezRwo20 hIZFXRFxTTvqyo4M/LmERI/KK0v9Cmr8HTFp3rJgiR3T/BMh21k1MuLbNXlLUbP4 zGvDJSR+MlHsNHoeJyjAErIbWJuBf1Ok6S0W2//EGcxN8ZvKNefwZzt7BWd2A5sB o3iWZNNU7JfUkr2LF/anWsrAf9GZ5cVJDTflEOmGAeUuck8z4wfI/Zx7SjwiJYkU j66JMtWuQLd0Wg0FSuwU9n0aYTRfRQbLWF/siQMEy7SAMcYIhGxevHKxTft5Blvl TTwTWKdkv+UWa5bPa73L88Qbb5Jh7Zp8cKa9E1Z86XOgAcfiyhoyE/QJvBXwdmoy IV/VuhuKZnU8DKISMe9X =B2MN -----END PGP SIGNATURE----- --Sig_/YKTpeEVwnBY77_x9zKhCdFd--