[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v3 4/7] numa: make hmp 'info numa' fetch numa nodes fr
From: |
Igor Mammedov |
Subject: |
[Qemu-ppc] [PATCH v3 4/7] numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus() result |
Date: |
Tue, 30 May 2017 18:23:59 +0200 |
HMP command 'info numa' is the last external user that access
CPUState::numa_node field directly. In order to move it to CPU
classes that actually use it, eliminate direct access and use
an alternative approach by using result of qmp_query_cpus(),
which provides topology properties CPU threads are associated
with (including node-id).
Signed-off-by: Igor Mammedov <address@hidden>
---
monitor.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/monitor.c b/monitor.c
index baa73c9..9d91631 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1696,23 +1696,26 @@ static void hmp_info_mtree(Monitor *mon, const QDict
*qdict)
static void hmp_info_numa(Monitor *mon, const QDict *qdict)
{
int i;
- CPUState *cpu;
uint64_t *node_mem;
+ CpuInfoList *cpu_list, *cpu;
+ cpu_list = qmp_query_cpus(&error_abort);
node_mem = g_new0(uint64_t, nb_numa_nodes);
query_numa_node_mem(node_mem);
monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
for (i = 0; i < nb_numa_nodes; i++) {
monitor_printf(mon, "node %d cpus:", i);
- CPU_FOREACH(cpu) {
- if (cpu->numa_node == i) {
- monitor_printf(mon, " %d", cpu->cpu_index);
+ 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, "\n");
monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
node_mem[i] >> 20);
}
+ qapi_free_CpuInfoList(cpu_list);
g_free(node_mem);
}
--
2.7.4
- [Qemu-ppc] [PATCH v3 0/7] numa: code consolidation and fixes, Igor Mammedov, 2017/05/30
- [Qemu-ppc] [PATCH v3 1/7] numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr, Igor Mammedov, 2017/05/30
- [Qemu-ppc] [PATCH v3 2/7] numa: move default mapping init to machine, Igor Mammedov, 2017/05/30
- [Qemu-ppc] [PATCH v3 3/7] numa: make sure that all cpus have has_node_id set if numa is enabled, Igor Mammedov, 2017/05/30
- [Qemu-ppc] [PATCH v3 4/7] numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus() result,
Igor Mammedov <=
- [Qemu-ppc] [PATCH v3 5/7] numa: move numa_node from CPUState into target specific classes, Igor Mammedov, 2017/05/30
- [Qemu-ppc] [PATCH v3 6/7] spapr: cleanup spapr_fixup_cpu_numa_dt() usage, Igor Mammedov, 2017/05/30
- [Qemu-ppc] [PATCH v3 7/7] numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed, Igor Mammedov, 2017/05/30