Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4139368iog; Tue, 21 Jun 2022 12:55:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vraSw4wEgqbCU+4cFNjqu/faLNeFOiHDHPjW5uWfIUeW4z0Q06cUR7abOcE5UEGTYKhLuE X-Received: by 2002:a17:90b:1a8f:b0:1e8:7dfe:c4f with SMTP id ng15-20020a17090b1a8f00b001e87dfe0c4fmr34221218pjb.17.1655841306076; Tue, 21 Jun 2022 12:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655841306; cv=none; d=google.com; s=arc-20160816; b=DX78EGSKuEYurclhA/RCu4XA0I3RSRIKkmvcCmAJWEevDlN3zTPE/IfaAKKcYUAav8 Tpq3T/B1Wio4xmvCQrj037rN678P0oc7E9oPGYYVnGanfjHfLbavulkp5mwvfG82OYT7 Qm8x9vHGHLWc5FifDypmcHWSMDSlVDwWfq0H9umtXy5tFDxVjpI6ixXqLMS3GsurnzMD w+ERdMsFiSusyKCFSE3vOM2F9nfqlafopKTCnARgZzPYdClqXTnNPtgMEpyS3lykD8IF CQVIxLMHVkdDzBbVXI3S2XHmKUwBP9IS+UKYJA0ThA34W5k9iYa5iK9PayevMKXB/imX 5Qfw== 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=E4W+A1dlpdlIoE3kyXtHwZVfvb//0zxVR1PCwpY1eN8=; b=oIEc33MX6lJ22PXHG45OE0RPNyXyRWkRDYD+C5DgKcmT05bbiz4ZZwz9yWhqplf/uO Fcy8am3ii4R8xlFe0ulDPPmLU0pgLXfVY5Tjs+Xlq3Eesh2JI62spvMtQ5FLRfcKgqc4 sg2JXAzOw+oeCzBqgYzx+vRWX3ZwSCZ5/XsuFSl6q0o4i+L474Lo3ItUOs61V74yQff1 VdZLYbj0zYnb3TsRGrvvkoz1FUwNiAvDY+LTCNgFkDsqcGVS05K9zkCFpWiA9oNYo+d1 c78BkUr8T+RlN45tkafE8yJwvQ3UB9N5iQ8J+HG0BHG2F1TWkXaOhU3k5p9HE0qfgAe0 B0cg== 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 z127-20020a636585000000b0040c9c626e78si219870pgb.813.2022.06.21.12.54.53; Tue, 21 Jun 2022 12:55:06 -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 S232802AbiFUTV4 (ORCPT + 99 others); Tue, 21 Jun 2022 15:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352447AbiFUTVQ (ORCPT ); Tue, 21 Jun 2022 15:21:16 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D8673254 for ; Tue, 21 Jun 2022 12:21:15 -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 CDA681688; Tue, 21 Jun 2022 12:21:15 -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 B58563F792; Tue, 21 Jun 2022 12:21:13 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg KH Cc: Sudeep Holla , Atish Patra , Atish Patra , 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 v4 14/20] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Date: Tue, 21 Jun 2022 20:20:28 +0100 Message-Id: <20220621192034.3332546-15-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621192034.3332546-1-sudeep.holla@arm.com> References: <20220621192034.3332546-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. 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 ef90d9c00d9e..7a569aefe313 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.36.1