From patchwork Tue Nov 14 04:01:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 164716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1635251vqg; Mon, 13 Nov 2023 20:04:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IH48hVUeh7urIgAXKQmT03PRpGKwe/VVgShvxJ+L7jXvLg/SJzWfExQXaHtc0g2x4J4AjuO X-Received: by 2002:a17:902:ce86:b0:1b5:561a:5ca9 with SMTP id f6-20020a170902ce8600b001b5561a5ca9mr1373486plg.50.1699934694713; Mon, 13 Nov 2023 20:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699934694; cv=none; d=google.com; s=arc-20160816; b=L00wYUBxLZaYZeDcaQeOqsKU5XQjgSJprZkGPQp9vk1wGIGBSp/qWJsmC3xQXagkmq zbjXkC7RhumqYxRaWDkbIjfSjMn4q1enIVUr0AJY4WPFgz+nAfX+Kh5nv++xF/H4+zFr YDF39JMImu3PHi5+dQ9tMZRakjj2Lrksnx4l0iekk7eErbG7gfxCo4lxl0RA2aspBEcS vY9+UqdTQroJ1fsTsMReMCZVRHEEt/DTenC5jbqjPVPJ2VH09+NPE2ZbfTyvnQmzXxeW JTUX4VrDBGV5QR8jxAKvJXzLMpOKpXo1mAjaYB2R8GZ2PSjvvkmZE930jacQvhrHEyeT QIfA== 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=WjBoSnpqWtcUTQYzGtIORvr3hpAK9wwFtnX7rP/srwg=; fh=3iB9MPM7gOV8iaw6nlpksJFY47xoJvfTkJIkOXUlBK4=; b=0MrJNkAWvCpEmKJXTRoP2J2CFaI1epXEqRqxFz0rhtI7BCexsY8mFNhdIDBqvySARt xyquxEooy9eiyxoRH7bwtJ/T5iMhMUvu42P9oIYURr4QIBRQOwEuX6/7ofe+wDOlVpb9 U5ui5oBU+ioY23fvtmv3TTRzvGNRX6IjewTvOIZOMnw3w22lhqLBbC29DJd8ng6UMAZJ NAfxJLBlZpoaz+1fePWIma7jNjhje3G1JB3bG3YcWMr68Nn+YyL5anuRlmSwY6YlZIni 0Z1gg9XHxhGwaZD4+xPyASvjLC5+8mUVphIeftkpIft32brfZCWicgfSlNV+qONrXHZ3 lpTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id d17-20020a170902ced100b001c8944c933dsi7378750plg.380.2023.11.13.20.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 20:04:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DBD3F80530D7; Mon, 13 Nov 2023 20:04:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbjKNEEc (ORCPT + 30 others); Mon, 13 Nov 2023 23:04:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbjKNEEa (ORCPT ); Mon, 13 Nov 2023 23:04:30 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BECCD43 for ; Mon, 13 Nov 2023 20:04:26 -0800 (PST) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STszQ0Bd9z1P8JP; Tue, 14 Nov 2023 12:01:06 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 12:04:23 +0800 From: Yicong Yang To: , , , CC: , , , , , , , Subject: [PATCH v3 2/4] arch_topology: Support SMT control for OF based system Date: Tue, 14 Nov 2023 12:01:08 +0800 Message-ID: <20231114040110.54590-3-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20231114040110.54590-1-yangyicong@huawei.com> References: <20231114040110.54590-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 13 Nov 2023 20:04:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782510722572566644 X-GMAIL-MSGID: 1782510722572566644 From: Yicong Yang On building the topology from the devicetree, we've already gotten the SMT thread number of each core. Update the largest SMT thread number to enable the SMT control. Signed-off-by: Yicong Yang --- drivers/base/arch_topology.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 7fb91f41d66d..02dc0266cbac 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -529,6 +529,13 @@ static int __init parse_core(struct device_node *core, int package_id, i++; } while (t); + /* + * We've already gotten threads number in this core, update the SMT + * threads number when necessary. + */ + if (i > topology_smt_num_threads) + topology_smt_set_num_threads(i); + cpu = get_cpu_for_node(core); if (cpu >= 0) { if (!leaf) {