Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1463235imk; Mon, 4 Jul 2022 03:41:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sOYcCV1aKu/f2XwVehkCG7wXlI8F5/oRsMnHnmJqyebfwoeqH90Lizln86s0w2QEvvHpUg X-Received: by 2002:a17:902:9044:b0:16b:d7e4:cf7a with SMTP id w4-20020a170902904400b0016bd7e4cf7amr10170127plz.74.1656931311813; Mon, 04 Jul 2022 03:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656931311; cv=none; d=google.com; s=arc-20160816; b=AzZgsy06g3xbiIYRHanpYfOauT56HVC/pRF69BN7OPLC9PFsJGnDRtScRb3Xc2aqrJ s9PGheKKrUfBU+whEGjl9mbE8l2me7Vx8wVPmtxMg5jTbtZMjtMuOLWhnF37xLTbj6wP uoQ8QGV/5Ma2bz6ufbG3qTEnCYsy29BR2pq66VaUfSpKt5eQsWSmFaWdMkdlrfoeIm9P JaoaMPNtxr/N3G6Ck9UGxoApjrwQLrTuH30mG8yPlGAamLy6hYGlJYsrjCRyPhqD0B/g gwliSELFq76A65+aeA1ijZcooAKgmJWwkl4xRJoqK8Lt7UsGK7m12OPK5tKtMOU3af1g 3umw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qnxLNzzflcUttXiVdpsebqVCNnIKWuJTu59lPfmdvkw=; b=qnlLcKuQchLLrXSlw2yRFjP65//cAjEImqdAEmMT0UaD7Qo8/lbV68n60umdW5viOZ pIVZ660GiyrhRejDsmHNq/UV5TAxrE5xH8UaazkG+pZu8PHWLIjPJDus7kqPWLy62SuU 9joKg6uzH1CuMszldCWGHMpAb9mrHZo8DhtBxPMyZ0CH7zVv5RZ4+I1sp/y/nlubx4Hp 7f+DT6I6a+HaubekAufGIOUxBdA9QMPu1VkgxxF3KL/pFg3M7gCtR2Jxg6JHrwLlabiS P+DVF83eSn4bMxYjVqCyD63eDR1J64Vl7SPMjAth7plPowZnL+NqeolMltpZhuGDc3RU jhFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p12-20020a170902e74c00b0016a0eb1e176si12593429plf.279.2022.07.04.03.41.39; Mon, 04 Jul 2022 03:41:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234435AbiGDKSC (ORCPT + 99 others); Mon, 4 Jul 2022 06:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233816AbiGDKQs (ORCPT ); Mon, 4 Jul 2022 06:16:48 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E5BC6D11D for ; Mon, 4 Jul 2022 03:16:46 -0700 (PDT) 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 0C683D6E; Mon, 4 Jul 2022 03:16:47 -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 CCB003F792; Mon, 4 Jul 2022 03:16:44 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Sudeep Holla , conor.dooley@microchip.com, valentina.fernandezalanis@microchip.com, Vincent Guittot , Dietmar Eggemann , Qing Wang , Rob Herring , "Rafael J . Wysocki" , Ionela Voinescu , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Gavin Shan Subject: [PATCH v6 15/21] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Date: Mon, 4 Jul 2022 11:15:59 +0100 Message-Id: <20220704101605.1318280-16-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704101605.1318280-1-sudeep.holla@arm.com> References: <20220704101605.1318280-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. Tested-by: Ionela Voinescu Reviewed-by: Gavin Shan 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 c0b0ee64a79d..8f6a964d2512 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -642,8 +642,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); -- 2.37.0