Re: [PATCH] x86/tsc: Use topology_max_packages() to get package number

From: Thomas Gleixner
Date: Fri Mar 15 2024 - 16:58:10 EST


On Fri, Mar 15 2024 at 10:58, Dave Hansen wrote:
> On 3/15/24 04:26, Feng Tang wrote:
>> /*
>> * Today neither Intel nor AMD support heterogeneous systems so
>> * extrapolate the boot cpu's data to all packages.
>> */
>> ncpus = cpu_data(0).booted_cores * topology_max_smt_threads();
>> __max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
>
> Because Intel obviously has heterogeneous systems today.

Hybrid is a per package property.

But neither Intel nor AMD support populating multi socket systems with
random packages, where socket 0 has less cores than socket 1 or socket 0
is hybrid and socket 1 is not.

> So I'll buy that removing 'nr_online_nodes' takes NUMA out of the
> picture (which is good), but I want to hear more about why
> topology_max_packages() and '4' are the right things to be checking.
>
> I suspect the real reason '4' was picked was to give the calculation
> some wiggle room because it's not actually all that precise.

IIRC the TSC is only guaranteed to be synchronized up to 4 sockets, but
my memory might be wrong as usual.

Thanks,

tglx