From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGpqE-0006pj-1r for qemu-devel@nongnu.org; Thu, 29 Jan 2015 09:13:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGpqA-0007My-2H for qemu-devel@nongnu.org; Thu, 29 Jan 2015 09:13:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGpq9-0007Mu-Pe for qemu-devel@nongnu.org; Thu, 29 Jan 2015 09:13:01 -0500 Date: Thu, 29 Jan 2015 15:12:49 +0100 From: Igor Mammedov Message-ID: <20150129151249.77ccd27c@nial.brq.redhat.com> In-Reply-To: <9f7bba73a1af52e5263660dccb0b2f5c0f998fa0.1421214155.git.zhugh.fnst@cn.fujitsu.com> References: <9f7bba73a1af52e5263660dccb0b2f5c0f998fa0.1421214155.git.zhugh.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 4/7] monitor: use cc->get_arch_id as the cpu index List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua Cc: Peter Krempa , qemu-devel@nongnu.org, tangchen@cn.fujitsu.com, guz.fnst@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, anshul.makkar@profitbricks.com, afaerber@suse.de On Wed, 14 Jan 2015 15:27:27 +0800 Zhu Guihua wrote: > From: Gu Zheng > > Use cc->get_arch_id as the cpu index to avoid the cpu index duplicated > issue in the QMP/HMP command output. > > Signed-off-by: Gu Zheng > Signed-off-by: Zhu Guihua > --- > cpus.c | 4 +++- > monitor.c | 4 +++- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 2edb5cd..d5e35c0 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -1420,6 +1420,7 @@ CpuInfoList *qmp_query_cpus(Error **errp) > > CPU_FOREACH(cpu) { > CpuInfoList *info; > + CPUClass *cc; > #if defined(TARGET_I386) > X86CPU *x86_cpu = X86_CPU(cpu); > CPUX86State *env = &x86_cpu->env; > @@ -1437,11 +1438,12 @@ CpuInfoList *qmp_query_cpus(Error **errp) > CPUTriCoreState *env = &tricore_cpu->env; > #endif > > + cc = CPU_GET_CLASS(cpu); > cpu_synchronize_state(cpu); > > info = g_malloc0(sizeof(*info)); > info->value = g_malloc0(sizeof(*info->value)); > - info->value->CPU = cpu->cpu_index; > + info->value->CPU = cc->get_arch_id(cpu); I'm not sure what impact sparse ID numbering would be on libvirt CCing libvirt folks so they could check it. > info->value->current = (cpu == first_cpu); > info->value->halted = cpu->halted; > info->value->thread_id = cpu->thread_id; > diff --git a/monitor.c b/monitor.c > index 1808e41..2283461 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -1024,7 +1024,9 @@ static CPUArchState *mon_get_cpu(void) > int monitor_get_cpu_index(void) > { > CPUState *cpu = ENV_GET_CPU(mon_get_cpu()); > - return cpu->cpu_index; > + CPUClass *cc = CPU_GET_CLASS(cpu); > + > + return cc->get_arch_id(cpu); > } > > static void do_info_registers(Monitor *mon, const QDict *qdict)