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

From: Peter Zijlstra
Date: Fri Jun 16 2023 - 04:02:54 EST


On Fri, Jun 16, 2023 at 06:53:21AM +0000, Zhang, Rui wrote:
> On Thu, 2023-06-15 at 11:20 +0200, Peter Zijlstra wrote:

> > So I have at least two machines where I boot with 'possible_cpus=#'
> > because the BIOS MADT is reporting a stupid number of CPUs that
> > aren't
> > actually there.
>
> Does the MADT report those CPUs as disabled but online capable?
> can you send me a copy of the acpidmp?

Sent privately, it's a bit big.

> I had a patch to parse MADT and count the number of physical packages
> by decoding all the valid APICIDs in MADT.
> I'm wondering if the patch still works on this machine.

I can certainly give it a spin; it has IPMI serial-over-ethernet that
works. Brilliant dev machine.

> > So I think I'm lucky and side-stepped this nonsense, but if someone
> > were
> > to use nr_cpus= for this same purpose, they get screwed over and get
> > the
> > watchdog. Sad day for them I suppose.
>
> what if using package_count_from_MADT?

So I'm thinking that if you cap possible_mask the actual logical
packages is the right number.

Suppose you have a machine with 8 sockets, but limit possible_mask to
only 1 socket. Then TSC will actually be stable, it doesn't matter you
have 7 idle sockets that are not synchronized.

Then again, perhaps if you limit it to 2 sockets you're still in
trouble, I'm not entirely sure how the TSC sync stuff comes apart on
these large systems.