Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Nov 2011 14:36:56 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227058 - head/sys/kern
Message-ID:  <201111031436.pA3EauWL074438@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Thu Nov  3 14:36:56 2011
New Revision: 227058
URL: http://svn.freebsd.org/changeset/base/227058

Log:
  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

Modified:
  head/sys/kern/subr_smp.c

Modified: head/sys/kern/subr_smp.c
==============================================================================
--- head/sys/kern/subr_smp.c	Thu Nov  3 12:24:44 2011	(r227057)
+++ head/sys/kern/subr_smp.c	Thu Nov  3 14:36:56 2011	(r227058)
@@ -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();
 }
 
 /*



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