Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3167700iog; Mon, 27 Jun 2022 10:31:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uWQyBUqktqyQ7YhDYE2JU9DaIIzlo3XVFc1SN/yQq4d9Ims2k3PQPGd0RM6CTI0mRrTquU X-Received: by 2002:a17:906:99c1:b0:6fe:b01d:134 with SMTP id s1-20020a17090699c100b006feb01d0134mr13900604ejn.598.1656351065576; Mon, 27 Jun 2022 10:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656351065; cv=none; d=google.com; s=arc-20160816; b=RnPj2uvwRkiDXrqsVGCZHJuYakzPvSsGMCJu105/gpqIhz7a6J+aibPDLJDpbUblx/ /rblGCwEv7o4pUN9epIXaI2QBKWaHIyEUjOLh7EFo7NHj9A2NBLZZPnFS9I847A6r04h lqf0P3srzHvv5xAusBvlZR0bPFYTnHBkUCoug4xH89aKEAmvnFY4Sx0UiVGYlCI1Trzc zAGh0j/TWgbKvWIf5QMW1PQd19hg13sh6LPnuXFXUk+Z0DRqzsjbn1LU61YB+IOLGgxg Mm3GWDDxEzAvTiZ2NjmF8ywCCXbpZYITb9PLt/hvOuJSC2Lmd1VidfI4Vtf5Edr0RNXE xtYQ== 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=HSQjvRTKx0xcshHPzfm0efEjikXvSUnPPpMmtiHw+wo=; b=iSLJDx4kobaVwauR/3bTs0VK4xGN6+yDsF9L4eh+5O03ERUW9rEA4cmzkY9i2LSUqS 3QPPPvFFloe7yLUrR3uzE9dvBAUL3fxVgXQVB79qY7iid3nryI1FfH3wEJ+TZL6z2k58 63gUsTfO6p30WDc2Y84fVA5lt3Xk29+zxJU4/SjxkchdcY+Hoomg4qKDCdxoWo9O3fv2 5WrW1uKxCBy5Uq8H6Pll1IpZPc+5SVrDYve22RFU+syUJUNXUKL3fdQeB8rxQdlPqxbR JeQs+9Oi4GZtP8R8ld+l9wQWDjt32BLL0b4v9Ni2MnfpHr9vp7wtsGzyJ6gvN/LMALjZ pAeg== 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 rp11-20020a170906d96b00b006f39ef3b072si11492091ejb.658.2022.06.27.10.30.40; Mon, 27 Jun 2022 10:31:05 -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 S239646AbiF0Qv7 (ORCPT + 99 others); Mon, 27 Jun 2022 12:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239545AbiF0Qv0 (ORCPT ); Mon, 27 Jun 2022 12:51:26 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C2D5210FF5 for ; Mon, 27 Jun 2022 09:51:25 -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 C7B0F175A; Mon, 27 Jun 2022 09:51:25 -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 C30043F792; Mon, 27 Jun 2022 09:51:23 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , 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 v5 14/19] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Date: Mon, 27 Jun 2022 17:50:42 +0100 Message-Id: <20220627165047.336669-15-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627165047.336669-1-sudeep.holla@arm.com> References: <20220627165047.336669-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. Link: https://lore.kernel.org/r/20220621192034.3332546-15-sudeep.holla@arm.com 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 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