NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/58693: x86-64 VM: assertion "lp_max >= core_max" failed
>Number: 58693
>Category: kern
>Synopsis: x86-64 VM: assertion "lp_max >= core_max" failed
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 24 16:25:01 +0000 2024
>Originator: Christof Meerwald
>Release: 10.0
>Organization:
>Environment:
NetBSD linveo.cmeerw.net 10.0 NetBSD 10.0 (GENERIC) #2: Tue Sep 24 15:50:04 UTC 2024 cmeerw%linveo.cmeerw.net@localhost:/home/cmeerw/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
In some VM environments (with Intel x86-64 CPUs), information returned from cpuid might be somewhat inconsistent, so we run into this assertion in arch/x86/x86/cpu_topology.c:
assertion "lp_max >= core_max" failed
In my case this was seen on an Intel VM with 2 CPU cores assigned to the VM, relevant bits from the cpuid information:
hyper-threading / multi-core supported = false
maximum IDs for cores in pkg = 0xf (15)
brand = "Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz"
This means that lp_max ends up being 1 and core_max = 16.
Other OSes like Linux or FreeBSD work fine in such an environment.
see https://mail-index.netbsd.org/tech-kern/2024/09/22/msg029737.html for some initial discussion on the mailing list.
>How-To-Repeat:
Try to boot NetBSD on a VM with somewhat inconsistent cpuid information as shown above.
>Fix:
It seems like the safest thing to do would be to turn the assertion into an if with maybe a warning and setting smt_bits = 0 in the else branch, e.g.
Index: arch/x86/x86/cpu_topology.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/cpu_topology.c,v
retrieving revision 1.21
diff -u -r1.21 cpu_topology.c
--- arch/x86/x86/cpu_topology.c 12 Oct 2022 10:26:09 -0000 1.21
+++ arch/x86/x86/cpu_topology.c 24 Sep 2024 15:49:12 -0000
@@ -160,8 +160,12 @@
core_max = 1;
}
- KASSERT(lp_max >= core_max);
- smt_bits = ilog2((lp_max / core_max) - 1) + 1;
+ if (lp_max >= core_max) {
+ smt_bits = ilog2((lp_max / core_max) - 1) + 1;
+ } else {
+ printf("WARNING: lp_max < core_max, assuming no SMT\n");
+ smt_bits = 0;
+ }
if (core_bits == 0) {
core_bits = ilog2(core_max - 1) + 1;
}
Home |
Main Index |
Thread Index |
Old Index