The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	David Woodhouse <dwmw@amazon.co.uk>,
	"Paul E . McKenney" <paulmck@kernel.org>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>, <rui.zhang@intel.com>,
	<tim.c.chen@intel.com>
Subject: Re: [Patch v2 2/2] x86/tsc: use logical_packages as a better estimation of socket numbers
Date: Thu, 29 Jun 2023 21:27:10 +0800	[thread overview]
Message-ID: <ZJ2Grrn7sq9Jdxf6@feng-clx> (raw)
In-Reply-To: <87r0px40o5.ffs@tglx>

On Tue, Jun 27, 2023 at 01:14:34PM +0200, Thomas Gleixner wrote:
> On Sun, Jun 25 2023 at 22:51, Feng Tang wrote:
> > From debug, the reason of the hung/stall is detect_extended_topology_early()
> > is called by cpu hotplug after boot, where there is "maxcpus=XXX" setting,
> > (#echo 1 > /sys/devices/system/cpu/cpuX/online).
> >
> > It could be fixed with below patch:
> > ----------------------------------------------------------------
> > diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c
> > index 828c1f7edac1..1ff73c8c4972 100644
> > --- a/arch/x86/kernel/cpu/topology.c
> > +++ b/arch/x86/kernel/cpu/topology.c
> > @@ -29,7 +29,7 @@ unsigned int __max_die_per_package __read_mostly = 1;
> >  EXPORT_SYMBOL(__max_die_per_package);
> >  
> >  #ifdef CONFIG_SMP
> > -unsigned int apic_to_pkg_shift __ro_after_init;
> > +unsigned int apic_to_pkg_shift;
> 
> Bah, yes. I missed the early_init() call from init_intel(). I hate that
> code with a passion.
   
I tested the patch on a 2S Icelake with Sub-NUMA-Cluster enabled, which
shows 4 NUMA nodes, and this patch gave the right package number: 2

On a hybrid system Alderlake with 8 P-core and 8 E-core,
'__max_logical_packages' is 1.

I also tried 'acpi=off' parameter. On a 2S Cascade Lake box, it only
brought up one CPU due to no MP table, while on another single socket
18C/36T Cascade Lake box which has MP table, it brought up 18 CPUs.
The '__max_logical_packages' is 1 for both of them.

The patch covers most of cases we have listed, so feel free to add:

Tested-by: Feng Tang <feng.tang@intel.com>

Thanks,
Feng

  reply	other threads:[~2023-06-29 14:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  5:25 [Patch v2 1/2] smp: Add helper function to mark possible bad package number Feng Tang
2023-06-13  5:25 ` [Patch v2 2/2] x86/tsc: use logical_packages as a better estimation of socket numbers Feng Tang
2023-06-15  9:20   ` Peter Zijlstra
2023-06-16  6:53     ` Zhang, Rui
2023-06-16  8:02       ` Peter Zijlstra
2023-06-16  8:10         ` Peter Zijlstra
2023-06-16  9:19           ` Zhang, Rui
2023-06-16  9:42             ` Peter Zijlstra
2023-06-16 11:23               ` Zhang, Rui
2023-06-16 11:47                 ` Feng Tang
2023-06-16  8:22         ` Peter Zijlstra
2023-06-19 10:42         ` Feng Tang
2023-06-16  7:18     ` Feng Tang
2023-06-22 14:27       ` Thomas Gleixner
2023-06-22 23:07         ` Thomas Gleixner
2023-06-23 15:49           ` Zhang, Rui
     [not found]           ` <ZJW0gi5oQQbxf8Df@feng-clx>
2023-06-25 14:51             ` Feng Tang
2023-06-27 11:14               ` Thomas Gleixner
2023-06-29 13:27                 ` Feng Tang [this message]
2023-07-17 13:38                   ` Feng Tang
2023-07-26 19:37                     ` Thomas Gleixner
2023-07-27  1:24                       ` Feng Tang
2023-06-23 15:36         ` Zhang, Rui

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=ZJ2Grrn7sq9Jdxf6@feng-clx \
    --to=feng.tang@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwmw@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rui.zhang@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@intel.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