From patchwork Wed May 18 09:33:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 12853436 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D139C433F5 for ; Wed, 18 May 2022 09:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UbU84MJ+N9rH92iov65PAqegpYKy5m4SmZxye5Jgg3g=; b=w7tLRmMnLebAZI qhAASVNwnfkT3kbi7wWA3oaOwFg1Q1xWkc9drBWUoRh4u0+FleEoTIoOf25Em4J8EIdPsy6TH5iB4 6zwV/+H6YGbz/yn5Is2H5Men+yFkU4yRCn3PSWI0ua0DeNGroL5HJJhECE5US2HixF9jbzlS2opll E4h9CpCIxNn+TRMQTUulEXhnZ6WGcPsqQNgxFyJtZKp8gAHMSsfR/PiYFpsUaltpfhqRVew+CzHiK EYkRMd70WyQqKUPjXOYyrG5CwA3vIMxytiQv5pk9eTRFIOfGIR+ccj9fXcLvEgNaRpSNtxbJ5liCL ex0FCWbIx1/AbjoXM02Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrG6C-0014Bb-Fz; Wed, 18 May 2022 09:36:08 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrG4D-0012bv-7I; Wed, 18 May 2022 09:34:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E7EB1042; Wed, 18 May 2022 02:34:04 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC5F33F66F; Wed, 18 May 2022 02:34:02 -0700 (PDT) From: Sudeep Holla To: Atish Patra , linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Rob Herring Subject: [PATCH v2 6/8] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Date: Wed, 18 May 2022 10:33:23 +0100 Message-Id: <20220518093325.2070336-7-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220518093325.2070336-1-sudeep.holla@arm.com> References: <20220518093325.2070336-1-sudeep.holla@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220518_023405_350765_57D8992B X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org There is no point in looping through all the CPU's physical package identifier to check if it is valid or not once a CPU which is outside the topology(i.e. outlier CPU) is found. Let us just break out of the loop early in such case. Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index be99a78f5b31..6d3346efe74b 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -662,8 +662,10 @@ static int __init parse_dt_topology(void) * only mark cores described in the DT as possible. */ for_each_possible_cpu(cpu) - if (cpu_topology[cpu].package_id < 0) + if (cpu_topology[cpu].package_id < 0) { ret = -EINVAL; + break; + } out_map: of_node_put(map);