summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_smp.c
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2015-11-08 14:26:50 +0000
committertijl <tijl@FreeBSD.org>2015-11-08 14:26:50 +0000
commit4e8b6b4a06e9b8bd64928b39a5a6cfe0fabaf9f0 (patch)
treed99bd7707b05f7869f04d5798da496d2d1e398bd /sys/kern/subr_smp.c
parentd94cce972ea22ac1b6d1ef125b413808e1dadf36 (diff)
downloadFreeBSD-src-4e8b6b4a06e9b8bd64928b39a5a6cfe0fabaf9f0.zip
FreeBSD-src-4e8b6b4a06e9b8bd64928b39a5a6cfe0fabaf9f0.tar.gz
Since r289279 bufinit() uses mp_ncpus, but some architectures set this
variable during mp_start() which is too late. Move this to mp_setmaxid() where other architectures set it and move x86 assertions to MI code. Reviewed by: kib (x86 part)
Diffstat (limited to 'sys/kern/subr_smp.c')
-rw-r--r--sys/kern/subr_smp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 0ac3b17..82349f8 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -125,7 +125,15 @@ struct mtx smp_ipi_mtx;
static void
mp_setmaxid(void *dummy)
{
+
cpu_mp_setmaxid();
+
+ KASSERT(mp_ncpus >= 1, ("%s: CPU count < 1", __func__));
+ KASSERT(mp_ncpus > 1 || mp_maxid == 0,
+ ("%s: one CPU but mp_maxid is not zero", __func__));
+ KASSERT(mp_maxid >= mp_ncpus - 1,
+ ("%s: counters out of sync: max %d, count %d", __func__,
+ mp_maxid, mp_ncpus));
}
SYSINIT(cpu_mp_setmaxid, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_setmaxid, NULL);
OpenPOWER on IntegriCloud