Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Nov 2010 10:48:50 +0200
From:      Andriy Gapon <avg@freebsd.org>
To:        Dan Allen <danallen46@airwired.net>
Cc:        Sergey Kandaurov <pluknet@gmail.com>, FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>
Subject:   Re: Fatal trap 18
Message-ID:  <4CD121F2.3010508@freebsd.org>
In-Reply-To: <4CD11FE9.8050105@freebsd.org>
References:  <68E248E0-8619-4859-BFFE-1B5F5ABBC51F@airwired.net> <AANLkTik0=x6h3YK0F_yrRJ_MGHp9pf8dVubbEwpmAa1y@mail.gmail.com> <4CD11FE9.8050105@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CD121F2.3010508>