diff options
| author | Jochen Neumeister <joneum@FreeBSD.org> | 2026-08-19 10:07:03 +0000 |
|---|---|---|
| committer | Lexi Winter <ivy@FreeBSD.org> | 2026-08-19 10:28:33 +0000 |
| commit | 4b1974e9db63d6510406e4ef3e56c250edd2240a (patch) | |
| tree | 3d1dac3402ac610fbeb7a4f339bdbf673115b8c0 /libexec/flua/libhash/hash.3lua | |
| parent | 8d29d242964976d9ffa89387d97de87d6cedc886 (diff) | |
On an Intel N150 host a guest started with sockets=1, cores=4,
threads=1 reports "1 package(s) x 2 core(s) x 2 hardware threads"
instead of four cores with one thread each, while the host itself
detects its topology correctly.
A FreeBSD guest picks the topology leaf in topo_probe_intel_0xb(),
sys/x86/x86/mp_x86.c, and since 6badb512a94d it prefers leaf 1Fh over
leaf 0Bh whenever cpu_high is 1Fh or higher. bhyve passes leaf 0
through unmodified, so the guest sees the maximum basic leaf of the
host, which is 1Fh or above on Alder Lake and newer, and takes that
path. x86_emulate_cpuid(), sys/amd64/vmm/x86.c, derives the topology
from vm_get_topology() for leaves 1, 4 and 0Bh, but has no case for
1Fh, so the request ends up in default_leaf and the host values are
returned verbatim. The guest therefore enumerates the topology of the
host: with an SMT shift of 1 in the host's leaf 1Fh and four vCPUs this
gives core_id_shift = 1 and pkg_id_shift = 2, which is exactly the
reported 2 cores x 2 threads. Hosts whose maximum basic leaf is below
1Fh are unaffected, as the request is clamped to cpu_high before the
switch statement.
Leaf 1Fh uses the same level encoding as leaf 0Bh for the SMT and the
core level, so handle both leaves in the same case. The module, tile
and die levels are not emulated and terminate the enumeration, exactly
as they already do for leaf 0Bh.
PR: 297475
MFC after: 1 week
Reported by: Richard Straka <fntms@pryse.net>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D58885
Diffstat (limited to 'libexec/flua/libhash/hash.3lua')
0 files changed, 0 insertions, 0 deletions
