From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOuYb-0003qP-Mi for qemu-devel@nongnu.org; Thu, 28 Jan 2016 16:56:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOuYW-0005pf-NA for qemu-devel@nongnu.org; Thu, 28 Jan 2016 16:56:49 -0500 References: <1453960195-15181-1-git-send-email-bharata@linux.vnet.ibm.com> <1453960195-15181-14-git-send-email-bharata@linux.vnet.ibm.com> From: Eric Blake Message-ID: <56AA8E99.8020006@redhat.com> Date: Thu, 28 Jan 2016 14:56:41 -0700 MIME-Version: 1.0 In-Reply-To: <1453960195-15181-14-git-send-email-bharata@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jAMGBK0PnEF9JCWhquFwqiJgVMd5bSkWV" Subject: Re: [Qemu-devel] [PATCH v7 13/13] hmp: Add "info ppc-cpu-cores" command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao , qemu-devel@nongnu.org Cc: mjrosato@linux.vnet.ibm.com, ehabkost@redhat.com, imammedo@redhat.com, aik@ozlabs.ru, agraf@suse.de, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, pbonzini@redhat.com, afaerber@suse.de, david@gibson.dropbear.id.au This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --jAMGBK0PnEF9JCWhquFwqiJgVMd5bSkWV Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/27/2016 10:49 PM, Bharata B Rao wrote: > This is the hmp equivalent of "query ppc-cpu-cores" The QMP command is spelled "query-ppc-cpu-cores". Most HMP commands prefer '_' over '-'; so this should be 'info ppc_cpu_cores'. >=20 > Signed-off-by: Bharata B Rao > --- > hmp-commands-info.hx | 16 ++++++++++++++++ > hmp.c | 31 +++++++++++++++++++++++++++++++ > hmp.h | 1 + > 3 files changed, 48 insertions(+) >=20 > +++ b/hmp.c > @@ -2375,3 +2375,34 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, cons= t QDict *qdict) > =20 > qapi_free_RockerOfDpaGroupList(list); > } > + > +void hmp_info_ppc_cpu_cores(Monitor *mon, const QDict *qdict) > +{ > + Error *err =3D NULL; > + PPCCPUCoreList *ppc_cpu_core_list =3D qmp_query_ppc_cpu_cores(&err= ); > + PPCCPUCoreList *s =3D ppc_cpu_core_list; > + CpuInfoList *thread; > + > + while (s) { > + monitor_printf(mon, "PowerPC CPU device: \"%s\"\n", > + s->value->id ? s->value->id : ""); This should probably be checking s->value->has_id rather than assuming that s->value->id will be NULL when not present (well, I'd like to clean up qapi to avoid the need for has_FOO when FOO is a pointer, but we're not there yet). > + monitor_printf(mon, " hotplugged: %s\n", > + s->value->hotplugged ? "true" : "false"); > + monitor_printf(mon, " hotpluggable: %s\n", > + s->value->hotpluggable ? "true" : "false");= > + monitor_printf(mon, " Threads:\n"); > + for (thread =3D s->value->threads; thread; thread =3D thread->= next) { > + monitor_printf(mon, " CPU #%" PRId64 ":", thread->value= ->CPU); > + monitor_printf(mon, " nip=3D0x%016" PRIx64, > + thread->value->u.ppc->nip); This uses value->u.ppc without first checking that the discriminator value->arch is set to CPU_INFO_ARCH_PPC; could that be a problem down the road? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --jAMGBK0PnEF9JCWhquFwqiJgVMd5bSkWV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWqo6ZAAoJEKeha0olJ0Nqh6wIALCL0YI3MDl8NyssGttCU/mA mmu9viH5/8yM/RrIXG8gKwjMsH6nTy1UIe+HQGfyJShKHAR+wh8mtK+hyJE8eeLV +1rqZ/pyvQP5POuYfK0pfDFN42gTgLM2DBgb3UJ24JQ8Nfnq2KmVCfQ9gTilN7ly gphUgdfVmQktHjOj1a12FNX500DeiagoYPUy052SXJExYkQIyvYgSUHYYP1Jm2CT pJxpV6BJbZBy23okmWFlT5z+sb1NfdNlFXyaCOXicdPy6WqZn/nkTaqkyV1ShLer 7Tb0huYdFaUahr0yEQaoQx+vPuBSKq3enzSD4s9YAjYbMzkc/qJXBZ2TsqHb4SU= =oZll -----END PGP SIGNATURE----- --jAMGBK0PnEF9JCWhquFwqiJgVMd5bSkWV--