diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2021-02-22 12:54:55 +0000 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2021-03-18 09:22:55 +0000 |
commit | 8af54b9172ff3b9bbdbb3191ed84994d275a0d81 (patch) | |
tree | c664dd47c9b01338d7266c2a71e7219702e66eb6 /hw/core | |
parent | cbde7be900d2a2279cbc4becb91d1ddd6a014def (diff) |
machine: remove 'query-cpus' QMP command
The newer 'query-cpus-fast' command avoids side effects on the guest
execution. Note that some of the field names are different in the
'query-cpus-fast' command.
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'hw/core')
-rw-r--r-- | hw/core/machine-hmp-cmds.c | 8 | ||||
-rw-r--r-- | hw/core/machine-qmp-cmds.c | 79 |
2 files changed, 4 insertions, 83 deletions
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 6357be9c6b..58248cffa3 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -130,7 +130,7 @@ void hmp_info_numa(Monitor *mon, const QDict *qdict) { int i, nb_numa_nodes; NumaNodeMem *node_mem; - CpuInfoList *cpu_list, *cpu; + CpuInfoFastList *cpu_list, *cpu; MachineState *ms = MACHINE(qdev_get_machine()); nb_numa_nodes = ms->numa_state ? ms->numa_state->num_nodes : 0; @@ -139,7 +139,7 @@ void hmp_info_numa(Monitor *mon, const QDict *qdict) return; } - cpu_list = qmp_query_cpus(&error_abort); + cpu_list = qmp_query_cpus_fast(&error_abort); node_mem = g_new0(NumaNodeMem, nb_numa_nodes); query_numa_node_mem(node_mem, ms); @@ -148,7 +148,7 @@ void hmp_info_numa(Monitor *mon, const QDict *qdict) for (cpu = cpu_list; cpu; cpu = cpu->next) { if (cpu->value->has_props && cpu->value->props->has_node_id && cpu->value->props->node_id == i) { - monitor_printf(mon, " %" PRIi64, cpu->value->CPU); + monitor_printf(mon, " %" PRIi64, cpu->value->cpu_index); } } monitor_printf(mon, "\n"); @@ -157,6 +157,6 @@ void hmp_info_numa(Monitor *mon, const QDict *qdict) monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i, node_mem[i].node_plugged_mem >> 20); } - qapi_free_CpuInfoList(cpu_list); + qapi_free_CpuInfoFastList(cpu_list); g_free(node_mem); } diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 44e979e503..af60cd969d 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -24,85 +24,6 @@ #include "sysemu/runstate.h" #include "sysemu/sysemu.h" -CpuInfoList *qmp_query_cpus(Error **errp) -{ - MachineState *ms = MACHINE(qdev_get_machine()); - MachineClass *mc = MACHINE_GET_CLASS(ms); - CpuInfoList *head = NULL, **tail = &head; - CPUState *cpu; - - CPU_FOREACH(cpu) { - CpuInfo *value; -#if defined(TARGET_I386) - X86CPU *x86_cpu = X86_CPU(cpu); - CPUX86State *env = &x86_cpu->env; -#elif defined(TARGET_PPC) - PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu); - CPUPPCState *env = &ppc_cpu->env; -#elif defined(TARGET_SPARC) - SPARCCPU *sparc_cpu = SPARC_CPU(cpu); - CPUSPARCState *env = &sparc_cpu->env; -#elif defined(TARGET_RISCV) - RISCVCPU *riscv_cpu = RISCV_CPU(cpu); - CPURISCVState *env = &riscv_cpu->env; -#elif defined(TARGET_MIPS) - MIPSCPU *mips_cpu = MIPS_CPU(cpu); - CPUMIPSState *env = &mips_cpu->env; -#elif defined(TARGET_TRICORE) - TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu); - CPUTriCoreState *env = &tricore_cpu->env; -#elif defined(TARGET_S390X) - S390CPU *s390_cpu = S390_CPU(cpu); - CPUS390XState *env = &s390_cpu->env; -#endif - - cpu_synchronize_state(cpu); - - value = g_malloc0(sizeof(*value)); - value->CPU = cpu->cpu_index; - value->current = (cpu == first_cpu); - value->halted = cpu->halted; - value->qom_path = object_get_canonical_path(OBJECT(cpu)); - value->thread_id = cpu->thread_id; -#if defined(TARGET_I386) - value->arch = CPU_INFO_ARCH_X86; - value->u.x86.pc = env->eip + env->segs[R_CS].base; -#elif defined(TARGET_PPC) - value->arch = CPU_INFO_ARCH_PPC; - value->u.ppc.nip = env->nip; -#elif defined(TARGET_SPARC) - value->arch = CPU_INFO_ARCH_SPARC; - value->u.q_sparc.pc = env->pc; - value->u.q_sparc.npc = env->npc; -#elif defined(TARGET_MIPS) - value->arch = CPU_INFO_ARCH_MIPS; - value->u.q_mips.PC = env->active_tc.PC; -#elif defined(TARGET_TRICORE) - value->arch = CPU_INFO_ARCH_TRICORE; - value->u.tricore.PC = env->PC; -#elif defined(TARGET_S390X) - value->arch = CPU_INFO_ARCH_S390; - value->u.s390.cpu_state = env->cpu_state; -#elif defined(TARGET_RISCV) - value->arch = CPU_INFO_ARCH_RISCV; - value->u.riscv.pc = env->pc; -#else - value->arch = CPU_INFO_ARCH_OTHER; -#endif - value->has_props = !!mc->cpu_index_to_instance_props; - if (value->has_props) { - CpuInstanceProperties *props; - props = g_malloc0(sizeof(*props)); - *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index); - value->props = props; - } - - QAPI_LIST_APPEND(tail, value); - } - - return head; -} - static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target) { /* |