From patchwork Mon Jul 18 09:19:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9234255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CCB54607FF for ; Mon, 18 Jul 2016 09:22:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE9CE26AE3 for ; Mon, 18 Jul 2016 09:22:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2E4926C2F; Mon, 18 Jul 2016 09:22:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B35A26AE3 for ; Mon, 18 Jul 2016 09:22:23 +0000 (UTC) Received: from localhost ([::1]:45341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4ko-00056F-C5 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Jul 2016 05:22:22 -0400 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 Received: from ozlabs.org ([103.22.144.67]:45696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4i3-0005Og-Pl; Mon, 18 Jul 2016 05:19:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3rtHgP72Sxz9s3v; Mon, 18 Jul 2016 19:19:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1468833569; bh=sN8n/oJxQuI2+6zQ3OIGCOewjpImGtzNe2ExNnLctt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YUKCK0ue9UB/bmQI+ZT7YfMKSnMsopTBo3YBMohqp+nkJ/3ZiIPol0E87kYwk94ST e1PaMOTCdc6MXhdkNmQwhtRkETBA2ly7d0QhlePTqhw/OVyeSwKVTzChpISvSZ5HWU II6YDmz68YQ45Dw5vyZR17l1uyN4IsPG6DONCfV0= From: David Gibson To: imammedo@redhat.com, pkrempa@redhat.com, bharata@linux.vnet.ibm.com Date: Mon, 18 Jul 2016 19:19:19 +1000 Message-Id: <1468833560-17397-2-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.7.4 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> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [RFC 1/2] spapr: Reverse order of hotpluggable cpus list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: groug@kaod.org, David Gibson , qemu-ppc@nongnu.org, abologna@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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);