From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DAD46C19776 for ; Fri, 28 Feb 2025 11:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mDWeQaG9rJh2JrE6qV5LxMVIQNQDr5nSAyBbP6trtbM=; b=URHx6VLdplcgBNMLMXSlg1ZM9C g8+lacOZ8ygG6KK5dppORsQ+UY5tN73qG6aW/MBr4QTgpJpNjHgz8D2HkzO9c7L/fqjCyDApASwaq /h4IYcd37DwLingeEeWtPfFTODJMnW3EtQ0KPe5d90dTXzGsO+hV7LBE+eD/XgS2+GLulhvE//51q dyULxCYIni8zOhJcAsINhhPa3rHcKkiIKvhYgEqLk8dbPA50QVzO+rnt5ZQWW4PXuY5F37trL8UDP xfnQuODycnX+xDtbED1bGjRzn4jAUhhvGBH5U0OiXB8jiGXTKYd5j1UzKvM9D5f8zGf17qV+GLXTg U01MMfPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tnyxJ-0000000Aoy3-3PMT; Fri, 28 Feb 2025 11:55:01 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tnyG8-0000000Ahfi-3EP3 for linux-arm-kernel@lists.infradead.org; Fri, 28 Feb 2025 11:10:25 +0000 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 5E20E1063; Fri, 28 Feb 2025 03:10:37 -0800 (PST) Received: from [192.168.178.115] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9CC1F3F673; Fri, 28 Feb 2025 03:10:17 -0800 (PST) Message-ID: Date: Fri, 28 Feb 2025 12:10:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 1/4] cpu/SMT: Provide a default topology_is_primary_thread() To: Yicong Yang , catalin.marinas@arm.com, will@kernel.org, sudeep.holla@arm.com, tglx@linutronix.de, peterz@infradead.org, mpe@ellerman.id.au, linux-arm-kernel@lists.infradead.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, pierre.gondois@arm.com Cc: linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org, morten.rasmussen@arm.com, msuchanek@suse.de, gregkh@linuxfoundation.org, rafael@kernel.org, jonathan.cameron@huawei.com, prime.zeng@hisilicon.com, linuxarm@huawei.com, yangyicong@hisilicon.com, xuwei5@huawei.com, guohanjun@huawei.com, sshegde@linux.ibm.com References: <20250218141018.18082-1-yangyicong@huawei.com> <20250218141018.18082-2-yangyicong@huawei.com> From: Dietmar Eggemann Content-Language: en-US In-Reply-To: <20250218141018.18082-2-yangyicong@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250228_031024_857956_B90DA5A1 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 18/02/2025 15:10, Yicong Yang wrote: > From: Yicong Yang [...] > diff --git a/include/linux/topology.h b/include/linux/topology.h > index 52f5850730b3..b3aba443c4eb 100644 > --- a/include/linux/topology.h > +++ b/include/linux/topology.h > @@ -240,6 +240,28 @@ static inline const struct cpumask *cpu_smt_mask(int cpu) > } > #endif > > +#ifndef topology_is_primary_thread > + > +#define topology_is_primary_thread topology_is_primary_thread > + > +static inline bool topology_is_primary_thread(unsigned int cpu) > +{ > + /* > + * On SMT hotplug the primary thread of the SMT won't be disabled. > + * Architectures do have a special primary thread (e.g. x86) need > + * to override this function. Otherwise just make the first thread > + * in the SMT as the primary thread. > + * > + * The sibling cpumask of an offline CPU contains always the CPU > + * itself for architectures using CONFIG_GENERIC_ARCH_TOPOLOGY. > + * Other architectures should use this depend on their own > + * situation. This sentence is hard to get. Do you want to say that other architectures (CONFIG_GENERIC_ARCH_TOPOLOGY or !CONFIG_GENERIC_ARCH_TOPOLOGY) have to check whether they can use this default implementation or have to override it? [...]