aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_smp.c
diff options
context:
space:
mode:
authorTijl Coosemans <tijl@FreeBSD.org>2015-11-08 14:26:50 +0000
committerTijl Coosemans <tijl@FreeBSD.org>2015-11-08 14:26:50 +0000
commit27f38a8d699b6ffe5135ebae4641e679621a184e (patch)
treed99bd7707b05f7869f04d5798da496d2d1e398bd /sys/kern/subr_smp.c
parent91e93daf9c35eded8dd5e222a031aee4fbef8005 (diff)
downloadsrc-27f38a8d699b6ffe5135ebae4641e679621a184e.tar.gz
src-27f38a8d699b6ffe5135ebae4641e679621a184e.zip
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)
Notes
Notes: svn path=/head/; revision=290547
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 0ac3b17aa148..82349f87fdd1 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);