[Bug 297475] Bhyve does not recognize the proper processor topology for Intel N150 processir

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 19 Aug 2026 10:30:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297475

--- Comment #8 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=4b1974e9db63d6510406e4ef3e56c250edd2240a

commit 4b1974e9db63d6510406e4ef3e56c250edd2240a
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-08-19 10:07:03 +0000
Commit:     Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2026-08-19 10:28:33 +0000

    vmm: Emulate CPUID leaf 1Fh for guests

    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

 sys/amd64/vmm/x86.c | 5 ++++-
 sys/amd64/vmm/x86.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.