[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63dca468-c94d-844a-5b19-09c03cf84911@intel.com>
Date: Fri, 21 Oct 2022 09:21:02 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Zhang Rui <rui.zhang@...el.com>, Feng Tang <feng.tang@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Cc: tim.c.chen@...el.com, Xiongfeng Wang <wangxiongfeng2@...wei.com>,
liaoyu15@...wei.com
Subject: Re: [PATCH v1 1/2] x86/tsc: use logical_package as a better
estimation of socket numbers
On 10/21/22 08:00, Zhang Rui wrote:
> I checked the history of '__max_logical_packages', and realized that
>
> 1. for topology_max_packages()/'__max_logical_packages', the divisor
> 'ncpus' uses cpu_data(0).booted_cores, which is based on the
> *online* CPUs. So when using kernel cmdlines like maxcpus=/nr_cpus=,
> '__max_logical_packages' can get over-estimated.
>
> 2. for 'logical_packages', it equals the number of different physical
> Package IDs for all *online* CPUs. So with kernel cmdlines like
> nr_cpus=/maxcpus=, it can gets under-estimated.
>
> BTW, I also checked CPUID.B/1F, which can tell a fixed number of CPUs
> within a package. But we don't have a fixed number of total CPUs from
> hardware.
> On my Dell laptop, BIOS allows me to disable/enable one or several
> cores. When this happens, the 'total_cpus' changes, but CPUID.B/1F does
> not change. So I don't think CPUID.B/1F can be used to optimize the '__
> max_logical_packages' calculation.
>
> I'm not sure if we have a perfect solution here.
Are the implementations fixable? Or, at least tolerable?
For instance, I can live with the implementation being a bit goofy when
kernel commandlines are in play. We can pr_info() about those cases.
Powered by blists - more mailing lists