From: Zhang Rui <rui.zhang@intel.com>
To: Dave Hansen <dave.hansen@intel.com>,
Feng Tang <feng.tang@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Cc: tim.c.chen@intel.com, Xiongfeng Wang <wangxiongfeng2@huawei.com>,
liaoyu15@huawei.com
Subject: Re: [PATCH v1 1/2] x86/tsc: use logical_package as a better estimation of socket numbers
Date: Sun, 23 Oct 2022 00:12:38 +0800 [thread overview]
Message-ID: <6636557f617ea5a1a1ab6f30f7aea0ececdd2a36.camel@intel.com> (raw)
In-Reply-To: <63dca468-c94d-844a-5b19-09c03cf84911@intel.com>
On Fri, 2022-10-21 at 09:21 -0700, Dave Hansen wrote:
> 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?
currently, I don't have any idea.
> 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.
My understanding is that the cpus in the last package may still have
small cpu id value. This means that the 'logical_packages' is hard to
break unless we boot with very small CPU count and happened to disable
all cpus in one/more packages. Feng is experiencing with this and may
have some update later.
If this is the case, is this a valid case that we need to take care of?
thanks,
rui
next prev parent reply other threads:[~2022-10-22 16:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 6:21 Feng Tang
2022-10-21 6:21 ` [PATCH v1 2/2] x86/tsc: Extend watchdog check exemption to 4-Sockets platform Feng Tang
2023-06-02 18:00 ` Paul E. McKenney
2023-06-05 6:28 ` Feng Tang
2022-10-21 15:00 ` [PATCH v1 1/2] x86/tsc: use logical_package as a better estimation of socket numbers Zhang Rui
2022-10-21 16:21 ` Dave Hansen
2022-10-22 16:12 ` Zhang Rui [this message]
2022-10-24 15:42 ` Dave Hansen
2022-10-25 7:35 ` Feng Tang
2022-10-24 7:37 ` Feng Tang
2022-10-24 15:43 ` Dave Hansen
2022-10-25 7:57 ` Feng Tang
2022-11-04 7:21 ` Feng Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6636557f617ea5a1a1ab6f30f7aea0ececdd2a36.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=feng.tang@intel.com \
--cc=hpa@zytor.com \
--cc=liaoyu15@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@intel.com \
--cc=wangxiongfeng2@huawei.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome