From a819425d0eb5135ea434625cdf7b41f0f05fd805 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Wed, 31 May 2017 19:27:23 +0200 Subject: [PATCH 06/13] monitor: Use numa_get_node_for_cpu() on "info numa" RH-Author: Eduardo Habkost Message-id: <20170531192723.19512-1-ehabkost@redhat.com> Patchwork-id: 75448 O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH] monitor: Use numa_get_node_for_cpu() on "info numa" Bugzilla: 1274567 RH-Acked-by: David Gibson RH-Acked-by: Igor Mammedov RH-Acked-by: Andrew Jones Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1274567 Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=13317591 Equivalent upstream commits: * 0b8497f08c spapr: add node-id property to sPAPR core * bd4c1bfe3e virt-arm: add node-id property to CPU * 93b2a8cb0b pc: add node-id property to CPU This is a downstream-only fix for the "info numa" bug that was accidentally fixed by the above upstream commits. I believe this one-line fix is safer than backporting those commits, and it can be easily reverted if we decide to backport them one day. Signed-off-by: Eduardo Habkost Signed-off-by: Miroslav Rezanina --- monitor.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index d4fbc07..d23f2eb 100644 --- a/monitor.c +++ b/monitor.c @@ -1704,7 +1704,15 @@ static void hmp_info_numa(Monitor *mon, const QDict *qdict) for (i = 0; i < nb_numa_nodes; i++) { monitor_printf(mon, "node %d cpus:", i); CPU_FOREACH(cpu) { - if (cpu->numa_node == i) { + /* + * Here, numa_get_node_for_cpu(cpu->cpu_index) + * can be replaced by cpu->numa_node, if we backport + * the following upstream commits: + * - 0b8497f08c spapr: add node-id property to sPAPR core + * - bd4c1bfe3e virt-arm: add node-id property to CPU + * - 93b2a8cb0b pc: add node-id property to CPU + */ + if (numa_get_node_for_cpu(cpu->cpu_index) == i) { monitor_printf(mon, " %d", cpu->cpu_index); } } -- 1.8.3.1