Received: from eggs.gnu.org ([2001:4830:134:3::10]:35004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4i8-0003bI-UK for qemu-devel@nongnu.org; Mon, 18 Jul 2016 05:19:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP4i4-0005Ow-4s for qemu-devel@nongnu.org; Mon, 18 Jul 2016 05:19:36 -0400 From: David Gibson Date: Mon, 18 Jul 2016 19:19:19 +1000 Message-Id: <1468833560-17397-2-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1468833560-17397-1-git-send-email-david@gibson.dropbear.id.au> References: <1468833560-17397-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [RFC 1/2] spapr: Reverse order of hotpluggable cpus list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: imammedo@redhat.com, pkrempa@redhat.com, bharata@linux.vnet.ibm.com Cc: abologna@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, groug@kaod.org, David Gibson The spapr implementation of query-hotpluggable-cpus builds the list of hotpluggable cores from the end (most removed from the list head) because that's the easiest way with a singly linked list. Because it also traverses the possible CPU cores starting from low indexes the resulting list has the cpu cores listed in reverse order by core-id. That's not generally harmful, but it means the output from "info hotpluggable-cpus" is a little harder to read than it could be. Therefore, traverse the cpus in reverse order so that the final list ends up in increasing-core-id order. Signed-off-by: David Gibson --- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7f33a1b..6426b45 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2371,7 +2371,7 @@ static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine) int spapr_max_cores = max_cpus / smp_threads; int smt = kvmppc_smt_threads(); - for (i = 0; i < spapr_max_cores; i++) { + for (i = spapr_max_cores - 1; i >= 0; i--) { HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1); HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1); CpuInstanceProperties *cpu_props = g_new0(typeof(*cpu_props), 1); -- 2.7.4