summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_smp.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-11-03 14:36:56 +0000
committerattilio <attilio@FreeBSD.org>2011-11-03 14:36:56 +0000
commit90682e14dbcf60dff021b0bec254cca712533124 (patch)
tree75f0d5133925c3b8c6bf4eef3abe4663e47a70c6 /sys/kern/subr_smp.c
parent7b84393d0d2b128f50777694476bc08671285033 (diff)
downloadFreeBSD-src-90682e14dbcf60dff021b0bec254cca712533124.zip
FreeBSD-src-90682e14dbcf60dff021b0bec254cca712533124.tar.gz
Disable interrupt and preemption for smp_rendezvous() also in the
UP/!SMP case. The callbacks may be relying on this feature and having 2 different ways to deal with them is not correct. Reported by: rstone Reviewed by: jhb MFC after: 2 weeks
Diffstat (limited to 'sys/kern/subr_smp.c')
-rw-r--r--sys/kern/subr_smp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 87d536c..dba82cf 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -415,13 +415,16 @@ smp_rendezvous_cpus(cpuset_t map,
{
int curcpumap, i, ncpus = 0;
+ /* Look comments in the !SMP case. */
if (!smp_started) {
+ spinlock_enter();
if (setup_func != NULL)
setup_func(arg);
if (action_func != NULL)
action_func(arg);
if (teardown_func != NULL)
teardown_func(arg);
+ spinlock_exit();
return;
}
@@ -666,12 +669,18 @@ smp_rendezvous_cpus(cpuset_t map,
void (*teardown_func)(void *),
void *arg)
{
+ /*
+ * In the !SMP case we just need to ensure the same initial conditions
+ * as the SMP case.
+ */
+ spinlock_enter();
if (setup_func != NULL)
setup_func(arg);
if (action_func != NULL)
action_func(arg);
if (teardown_func != NULL)
teardown_func(arg);
+ spinlock_exit();
}
void
@@ -681,12 +690,15 @@ smp_rendezvous(void (*setup_func)(void *),
void *arg)
{
+ /* Look comments in the smp_rendezvous_cpus() case. */
+ spinlock_enter();
if (setup_func != NULL)
setup_func(arg);
if (action_func != NULL)
action_func(arg);
if (teardown_func != NULL)
teardown_func(arg);
+ spinlock_exit();
}
/*
OpenPOWER on IntegriCloud