Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp30057rdb; Sun, 28 Jan 2024 12:01:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmZ0iWlji47GbbnggSEwjnTBmXn18IR8YuCyjc6kLq4RjooH/8ahBtwbJohY0UvnCGM4x4 X-Received: by 2002:a05:620a:55b3:b0:783:da62:9b09 with SMTP id vr19-20020a05620a55b300b00783da629b09mr3795258qkn.73.1706472082939; Sun, 28 Jan 2024 12:01:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706472082; cv=pass; d=google.com; s=arc-20160816; b=EiABrcVOPKgsbAe2LZGITbvlc7Z6p5FoK/vDbE2XLPS5OpdVRcXfLTtHDORrKRed5x U71BiKP/z7ct599cWefygF19ojxlieu2b8TJ3e7GsRUnXxDWiz6EaeVIXxpUOk/Mi5EU K5AuEqMusqLfKP47VJE605cWKtcYMMe7RHYE7BtJMI+JEj4037xiBKawn0n1ML2w8B2X pd8wQDn3TeCvmJwApt9fCGZOrDwjSBMeEdD+5v24itZRPoDwhm8AXZG3aTbhU/S4UjFR CwoWi4i4UJB1101jncvz7YSAIuDALJ/DrZi0nHwSsQb8G3bsMnVG8WDxsgHvPmaIFVxb NATg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=pBFOM1duE9X1qxdew30R+F7Tj4HBvCIoYlZl2qWmXAc=; fh=Sc6SFYxYDa6KLKXi2grzPpZcKFPJDmt9DRwhcwil7Oo=; b=cICTmyHpRKR9rn6umcoQakVtU36pwZMeZfZH0iK/8doR59r5L2nKEFxZ1+L3Rqlzo7 pSyUlZ7uAIvLgT8YiDbl+wofDEAar3FeadZkyBc+3UkXNALZp5g4eafbWBKnKxGTYnzZ Nwt/s+Ov8Xp6Onj9vx7J8fsD5ikIWfWsDpEuH1Dmz/v5H8AbwKvXF2jxFJfICcrDhFxX nCDqxeLHRot/R8LQUh2ZunwzM8aHd5fcCcAmfudzb3alQXxdAtVf4D+ZxDFUVBesQsTK WC7aOu+r+uhLva9elSMKYSTTcJO1VsbjArEbEvoqEPTys+XZZ8Duu/rf5W7h/rTEszww /8Lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u3mpEZfn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x10-20020ae9e64a000000b00783d0a1e081si5747802qkl.629.2024.01.28.12.01.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 12:01:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u3mpEZfn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9B3451C20BE9 for ; Sun, 28 Jan 2024 20:01:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 706DF36AE1; Sun, 28 Jan 2024 20:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u3mpEZfn" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 597072AD0E for ; Sun, 28 Jan 2024 20:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706472075; cv=none; b=f9ChdM8N9pZ36GJw2HPUd5wbgBxgqffWuBR3yE8vuc5NaDSgGefUiijmPt2uL3BRSCunXde1rG7icF1uzx3X371TCZvJv7YPYzAG8kh8Gq86zIbebn4Nma0CB64Yn9h1emGewhJb8cu3sQl+xk1TWYNLlss6p5NxnAKwH/paK84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706472075; c=relaxed/simple; bh=/YUY7lcIFxAF2x8ffEtZ0SwOrVeUnlqbB08lR83ef5w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CBkUIKP876rFVWc5K52tjEjA0mXdcRwFJ3pFg8ZO+6Qk6I5lYZsC+ttnynIis1cHABe97w58ob6diqSdZW/CtlXsOKbPT28Xs7IstrjkyCQx36DKfyokiX2k+OMmRKrLX7KctTUejWurR5XihyZUaAdaj9VpM1O+Sbno/8amSBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u3mpEZfn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5EDCC433F1; Sun, 28 Jan 2024 20:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706472074; bh=/YUY7lcIFxAF2x8ffEtZ0SwOrVeUnlqbB08lR83ef5w=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=u3mpEZfnXlywMMeUZm2PnMXMql8GwZNM1tzi0tQ1eSb/PWyn/OQRHk0/ei04pirAw s4cwYrVpmxazgD96u7YNC1NezwHP8H/hvR/mcG/jbML3JUanVaBmXnh4qtWxuWcJGD LpU944W1FV7bvod6QG+GqsZiBaoI5rg/XAAJhpgVqH2uC0DsNjefnmmx7Pz+A//OU2 LhibRizo1jSVvCCudStxDAlEjQwl133bjosWfVgpFA/PVNDxpTxECjQ9WAjbomGOVb t+3QfoGBa6Z4lQNHZk9nMEzCkgDUQUP5haUlfK7axtCpGZbLiAF56u087kJFdlK/S6 80bdQz1YRPgEA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 4EC00CE1380; Sun, 28 Jan 2024 12:01:14 -0800 (PST) Date: Sun, 28 Jan 2024 12:01:14 -0800 From: "Paul E. McKenney" To: Thomas Gleixner Cc: "Zhang, Rui" , "linux-kernel@vger.kernel.org" , "Raj, Ashok" , "mhklinux@outlook.com" , "arjan@linux.intel.com" , "ray.huang@amd.com" , "thomas.lendacky@amd.com" , "andrew.cooper3@citrix.com" , "Sivanich, Dimitri" , "Tang, Feng" , "kan.liang@linux.intel.com" , "Mehta, Sohil" , "peterz@infradead.org" , "kprateek.nayak@amd.com" , "jgross@suse.com" , "andy@infradead.org" , "x86@kernel.org" Subject: Re: [patch v2 21/30] x86/cpu/topology: Use topology bitmaps for sizing Message-ID: Reply-To: paulmck@kernel.org References: <20240118123127.055361964@linutronix.de> <20240118123649.739960607@linutronix.de> <7c8874d971c69fb4c22c1b771983f8d5109a9387.camel@intel.com> <87fryjhmjs.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87fryjhmjs.ffs@tglx> On Fri, Jan 26, 2024 at 09:22:47PM +0100, Thomas Gleixner wrote: > On Fri, Jan 26 2024 at 07:07, Zhang, Rui wrote: > >> > ? > >> > +???????cnta = domain_weight(TOPO_PKG_DOMAIN); > >> > +???????cntb = domain_weight(TOPO_DIE_DOMAIN); > >> > +???????__max_logical_packages = cnta; > >> > +???????__max_dies_per_package = 1U << (get_count_order(cntb) - > > >> > get_count_order(cnta)); > >> > + > >> > +???????pr_info("Max. logical packages: %3u\n", cnta); > >> > +???????pr_info("Max. logical dies:???? %3u\n", cntb); > >> > +???????pr_info("Max. dies per package: %3u\n", > > >> > __max_dies_per_package); > >> > + > >> > +???????cnta = domain_weight(TOPO_CORE_DOMAIN); > >> > +???????cntb = domain_weight(TOPO_SMT_DOMAIN); > >> > +???????smp_num_siblings = 1U << (get_count_order(cntb) - > > >> > get_count_order(cnta)); > >> > +???????pr_info("Max. threads per core: %3u\n", smp_num_siblings); > >> > + > > > > I missed this but Ashok catches it. > > > > Say, on my Adlerlake platform, which has 4 Pcores with HT + 8 Ecores, > > cnta is 12, cntb is 16, and smp_num_siblings is set to 1 erroneously. > > > > I think we should use > > smp_num_siblings = DIV_ROUND_UP(cntb, cnta); > > here. > > Indeed. That's more than obvious. > > > Or even check each core to get the maximum value (in case there are > > more than 2 siblings in a core some day). > > We want to get rid of HT not make it worse. Hear, hear!!! ;-) Thanx, Paul