summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-11-21 22:23:26 +0000
committerjhb <jhb@FreeBSD.org>2003-11-21 22:23:26 +0000
commitbbe7d290eaefab02b2aae1d8556f86baf226f87c (patch)
tree7f79b01520d78ae23fff9300b063754cafd92b32 /sys/kern
parente90ec154d72fc0eab43fed7a064653d3c0666241 (diff)
downloadFreeBSD-src-bbe7d290eaefab02b2aae1d8556f86baf226f87c.zip
FreeBSD-src-bbe7d290eaefab02b2aae1d8556f86baf226f87c.tar.gz
- Split cpu_mp_probe() into two parts. cpu_mp_setmaxid() is still called
very early (SI_SUB_TUNABLES - 1) and is responsible for setting mp_maxid. cpu_mp_probe() is now called at SI_SUB_CPU and determines if SMP is actually present and sets mp_ncpus and all_cpus. Splitting these up allows an architecture to probe CPUs later than SI_SUB_TUNABLES by just setting mp_maxid to MAXCPU in cpu_mp_setmaxid(). This could allow the CPU probing code to live in a module, for example, since modules sysinit's in modules cannot be invoked prior to SI_SUB_KLD. This is needed to re-enable the ACPI module on i386. - For the alpha SMP probing code, use LOCATE_PCS() instead of duplicating its contents in a few places. Also, add a smp_cpu_enabled() function to avoid duplicating some code. There is room for further code reduction later since much of this code is also present in cpu_mp_start(). - All archs besides i386 still set mp_maxid to the same values they set it to before this change. i386 now sets mp_maxid to MAXCPU. Tested on: alpha, amd64, i386, ia64, sparc64 Approved by: re (scottl)
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_smp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 5bb0289..b6fd97f 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -92,17 +92,16 @@ static void (*smp_rv_teardown_func)(void *arg);
static void *smp_rv_func_arg;
static volatile int smp_rv_waiters[2];
static struct mtx smp_rv_mtx;
-static int mp_probe_status;
/*
- * Initialize MI SMP variables.
+ * Let the MD SMP code initialize mp_maxid very early if it can.
*/
static void
-mp_probe(void *dummy)
+mp_setmaxid(void *dummy)
{
- mp_probe_status = cpu_mp_probe();
+ cpu_mp_setmaxid();
}
-SYSINIT(cpu_mp_probe, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_probe, NULL)
+SYSINIT(cpu_mp_setmaxid, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_setmaxid, NULL)
/*
* Call the MD SMP initialization code.
@@ -112,8 +111,9 @@ mp_start(void *dummy)
{
/* Probe for MP hardware. */
- if (mp_probe_status == 0 || smp_disabled != 0) {
+ if (smp_disabled != 0 || cpu_mp_probe() == 0) {
mp_ncpus = 1;
+ all_cpus = PCPU_GET(cpumask);
return;
}
OpenPOWER on IntegriCloud