Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5920589rdb; Thu, 14 Dec 2023 03:41:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNSsrFmypIH0wUPTBhvUqpaBWq7yZKyUrY6xWvb4/19p5QgAK/TVlLW+Z9kiREX1cvyM/m X-Received: by 2002:a05:6a21:a5a0:b0:190:230:8ea1 with SMTP id gd32-20020a056a21a5a000b0019002308ea1mr12379720pzc.108.1702554100577; Thu, 14 Dec 2023 03:41:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702554100; cv=none; d=google.com; s=arc-20160816; b=nV+ABSOpiulYMTy/u5OvRP9j9SdKTDcPLKYw+mTGpmDJsLR7mN0pyt2aOo8vZIxKUP ExIsOvp7Dq84uu3GTBZ2mBuZ5L/h9OUC9PsdrfRMSHRo4EnyxDPVUBAnsAnZilYcjjjv O6QpAmAw9IfmPVOfrOcbksAtuqNIVkF6m1OZQoN7dWlnDrdMa6QRO63dNTJpA8LaC3xH b4YP3wrYk+4GtqJYWSzKlAVL0QLxGHWKGOU0vI13KKSM+IbNdpUizQ0BmT//DhdD3/bB z3uYUo93LpIpd8rfK/4W9bfmnbmZ3lDJp/c3KgzEUR0Cqeny/2JhjBEIoAYVEaAH0rzb OUUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject :cc; bh=qF0Xgk804w0lZKTSha1DDiobkM9qoyt94SCdsUYMXOI=; fh=VN7vDooFyt0ud98seWiUAykEBYVXXwEacktwQKKRwMY=; b=vxD+rmJKLvN5R7yK78lClBF6SZ/Kjv2GeIsYXFl3J5qVzHQXfCjPhzNcQDxz+to8JL BLqsO5AUVi0DN/BbSriv89iXNf/9RynUqAS/72jBoTFx3DA3FDqCcjW1ObW0/XpebmqN LFr45eul9qG4VVPFZRKgoKezhlLvMZ102Y0e/W2aK0kn/LXDREPCk8vbshJjVmHfd9J1 8dlpGzUO139PeV5NeBuI8XC8TNVZKSHcVgkhwPQcj+uvujDELBChLWI/u4d4+fCgdM2z jOIFp6KEVqwRmARcN7JzzmfxmhZbYVFBt1XfFQ+16krvS0exdpQcd8qFe4BO5srY1tDg P3lw== 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:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l7-20020a17090a850700b00286e9a6f92fsi869719pjn.63.2023.12.14.03.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:41:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id ABAF980AFB94; Thu, 14 Dec 2023 03:41:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444033AbjLNLkz (ORCPT + 99 others); Thu, 14 Dec 2023 06:40:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444157AbjLNLk2 (ORCPT ); Thu, 14 Dec 2023 06:40:28 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FB13118 for ; Thu, 14 Dec 2023 03:39:53 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SrVk000M6zvS8x; Thu, 14 Dec 2023 19:39:03 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 028181800BB; Thu, 14 Dec 2023 19:39:52 +0800 (CST) Received: from [10.67.121.177] (10.67.121.177) 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.35; Thu, 14 Dec 2023 19:39:51 +0800 CC: Thomas Gleixner , Peter Zijlstra , , , , , , , , , , , Subject: Re: [PATCH v4 0/4] Support SMT control on arm64 To: Will Deacon References: <20231121092602.47792-1-yangyicong@huawei.com> <20231211131612.GB25681@willie-the-truck> From: Yicong Yang Message-ID: Date: Thu, 14 Dec 2023 19:39:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20231211131612.GB25681@willie-the-truck> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.177] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-Spam-Status: No, score=-2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:41:18 -0800 (PST) Hi Will, On 2023/12/11 21:16, Will Deacon wrote: > On Tue, Nov 21, 2023 at 05:25:58PM +0800, Yicong Yang wrote: >> From: Yicong Yang >> >> The core CPU control framework supports runtime SMT control which >> is not yet supported on arm64. Besides the general vulnerabilities >> concerns we want this runtime control on our arm64 server for: >> >> - better single CPU performance in some cases >> - saving overall power consumption >> >> This patchset implements it in the following aspects: >> >> - implements the basic support in arch_topology driver >> - support retrieve SMT thread number on OF based system >> - support retrieve SMT thread number on ACPI based system >> - select HOTPLUG_SMT for arm64 >> >> Tests has been done on our real ACPI based arm64 server and on >> ACPI/OF based QEMU VMs. >> >> The patchset is based on v6.7-rc1. >> >> Change since v3: >> - Fix some build and kconfig error reported by kernel test robot >> Link: https://lore.kernel.org/linux-arm-kernel/20231114040110.54590-1-yangyicong@huawei.com/ >> >> Change since v2: >> - Detect SMT thread number at topology build from ACPI/DT, avoid looping CPUs >> - Split patches into ACPI/OF/arch_topology path and enable the kconfig for arm64 >> Link: https://lore.kernel.org/linux-arm-kernel/20231010115335.13862-1-yangyicong@huawei.com/ >> >> Yicong Yang (4): >> arch_topology: Support basic SMT control for the driver >> arch_topology: Support SMT control for OF based system > > Looking at the first two patches you have here, they are incredibly trivial > and feel like they'd be better off implemented as the default behaviour in > the core code so that architectures with additional constraints (e.g. x86) > can override that. > Loop Thomas and Peter in and expect some hint on the SMT HOTPLUG implementation. Thanks for the comments. I'm a bit uncertain of some points. Currently the framework requires the architeture provide 2 things to enable HOTPLUG_SMT: 1. In the init stage of the arch code, use cpu_smt_set_num_threads() to tell the framework SMT is supported or not and how many threads are within a core. 2. topology_is_primary_thread() to indicate one CPU can be offline or not, when disable SMT. For the 2nd point, it's possible to provide a weak function in the framework if no special requirement for the "primary" SMT thread, just make the 1st CPU in a physical core as the primary thread like what implemented in this patchset for amr64. And let architectures like x86/powerpc to provides override function for special purpose. For the 1st point I'm not sure it could/should be done in the framework since we can got this SMT information only in the init stage after we parsing the topology which is rather architecture specific. On arm64 we may gain this after parsing the devicetree or ACPI and on x86 they gain this by CPUID. It's hard to provide a default way for detecting this. So in this patchset the SMT information is detected separately in the ACPI/OF topology parsing. Thanks.