[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH v7 13/13] hmp: Add "info ppc-cpu-core
From: |
Eric Blake |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH v7 13/13] hmp: Add "info ppc-cpu-cores" command |
Date: |
Thu, 28 Jan 2016 14:56:41 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
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'.
>
> Signed-off-by: Bharata B Rao <address@hidden>
> ---
> hmp-commands-info.hx | 16 ++++++++++++++++
> hmp.c | 31 +++++++++++++++++++++++++++++++
> hmp.h | 1 +
> 3 files changed, 48 insertions(+)
>
> +++ b/hmp.c
> @@ -2375,3 +2375,34 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const
> QDict *qdict)
>
> qapi_free_RockerOfDpaGroupList(list);
> }
> +
> +void hmp_info_ppc_cpu_cores(Monitor *mon, const QDict *qdict)
> +{
> + Error *err = NULL;
> + PPCCPUCoreList *ppc_cpu_core_list = qmp_query_ppc_cpu_cores(&err);
> + PPCCPUCoreList *s = 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 = s->value->threads; thread; thread = thread->next) {
> + monitor_printf(mon, " CPU #%" PRId64 ":", thread->value->CPU);
> + monitor_printf(mon, " nip=0x%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?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-ppc] [PATCH v7 05/13] cpu: Reclaim vCPU objects, (continued)
- [Qemu-ppc] [PATCH v7 05/13] cpu: Reclaim vCPU objects, Bharata B Rao, 2016/01/28
- [Qemu-ppc] [PATCH v7 07/13] xics, xics_kvm: Handle CPU unplug correctly, Bharata B Rao, 2016/01/28
- [Qemu-ppc] [PATCH v7 08/13] target-ppc: Introduce PowerPC specific CPU core device, Bharata B Rao, 2016/01/28
- [Qemu-ppc] [PATCH v7 10/13] spapr: CPU hotplug support, Bharata B Rao, 2016/01/28
- [Qemu-ppc] [PATCH v7 09/13] spapr: Enable CPU hotplug for pseries-2.6 and add CPU DRC DT entries, Bharata B Rao, 2016/01/28
- [Qemu-ppc] [PATCH v7 11/13] spapr: CPU hot unplug support, Bharata B Rao, 2016/01/28
- [Qemu-ppc] [PATCH v7 12/13] qmp: Add query-ppc-cpu-cores command, Bharata B Rao, 2016/01/28
- [Qemu-ppc] [PATCH v7 13/13] hmp: Add "info ppc-cpu-cores" command, Bharata B Rao, 2016/01/28
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v7 13/13] hmp: Add "info ppc-cpu-cores" command,
Eric Blake <=