qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 1/2] spapr: Reverse order of hotpluggable cpus list


From: David Gibson
Subject: [Qemu-devel] [RFC 1/2] spapr: Reverse order of hotpluggable cpus list
Date: Mon, 18 Jul 2016 19:19:19 +1000

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]