Re: [Patch v2 2/2] x86/tsc: use logical_packages as a better estimation of socket numbers

From: Thomas Gleixner
Date: Tue Jun 27 2023 - 13:55:44 EST


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.