Fatal trap 18

Andriy Gapon avg at freebsd.org
Wed Nov 3 08:49:07 UTC 2010


on 03/11/2010 10:40 Andriy Gapon said the following:
> This problem seems to happen only on SMP systems that for some reason run as UP.
> E.g. because ACPI and/or APIC are disabled.
> Or some other BIOS configuration.
> But I am not sure what exactly is the case here.
> Verbose dmesg from a working kernel would be helpful.

I still would like to see verbose dmesg, just to be sure what's going on.
Here's a patch that I have in mind for this issue, if it is what I think it is.
If you have amd64 system, the patch is equally applicable to
sys/amd64/amd64/mp_machdep.c.

Index: sys/i386/i386/mp_machdep.c
===================================================================
--- sys/i386/i386/mp_machdep.c	(revision 214619)
+++ sys/i386/i386/mp_machdep.c	(working copy)
@@ -286,6 +286,9 @@
 			cpu_logical++;
 	}

+	KASSERT(cpu_cores >= 1 && cpu_logical >= 1,
+	    ("topo_probe_0x4 couldn't find BSP"));
+
 	cpu_cores /= cpu_logical;
 	hyperthreading_cpus = cpu_logical;
 }
@@ -357,7 +360,9 @@
 		return;

 	logical_cpus_mask = 0;
-	if (cpu_vendor_id == CPU_VENDOR_AMD)
+	if (mp_ncpus <= 1)
+		cpu_cores = cpu_logical = 1;
+	else if (cpu_vendor_id == CPU_VENDOR_AMD)
 		topo_probe_amd();
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL) {
 		/*
@@ -379,10 +384,8 @@
 	 * Fallback: assume each logical CPU is in separate
 	 * physical package.  That is, no multi-core, no SMT.
 	 */
-	if (cpu_cores == 0)
-		cpu_cores = 1;
-	if (cpu_logical == 0)
-		cpu_logical = 1;
+	if (cpu_cores == 0 || cpu_logical == 0)
+		cpu_cores = cpu_logical = 1;
 	cpu_topo_probed = 1;
 }


-- 
Andriy Gapon


More information about the freebsd-stable mailing list