Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2010 10:51:27 +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: r211176 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201008111051.o7BApRp4028538@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Wed Aug 11 10:51:27 2010
New Revision: 211176
URL: http://svn.freebsd.org/changeset/base/211176

Log:
  IPI handlers may run generally with interrupts disabled because they
  are served via an interrupt gate.
  
  However, that doesn't explicitly prevent preemption and thread
  migration thus scheduler pinning may be necessary in some handlers.
  Fix that.
  
  Tested by:	gianni
  MFC after:	1 month

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/i386/i386/mp_machdep.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Wed Aug 11 09:29:33 2010	(r211175)
+++ head/sys/amd64/amd64/mp_machdep.c	Wed Aug 11 10:51:27 2010	(r211176)
@@ -1324,8 +1324,10 @@ cpustop_handler(void)
 	cpumask_t cpumask;
 	u_int cpu;
 
+	sched_pin();
 	cpu = PCPU_GET(cpuid);
 	cpumask = PCPU_GET(cpumask);
+	sched_unpin();
 
 	savectx(&stoppcbs[cpu]);
 
@@ -1356,8 +1358,10 @@ cpususpend_handler(void)
 	register_t cr3, rf;
 	u_int cpu;
 
+	sched_pin();
 	cpu = PCPU_GET(cpuid);
 	cpumask = PCPU_GET(cpumask);
+	sched_unpin();
 
 	rf = intr_disable();
 	cr3 = rcr3();
@@ -1535,10 +1539,14 @@ mp_grab_cpu_hlt(void)
 #endif
 	int retval;
 
-	mask = PCPU_GET(cpumask);
 #ifdef MP_WATCHDOG
+	sched_pin();
+	mask = PCPU_GET(cpumask);
 	cpuid = PCPU_GET(cpuid);
+	sched_unpin();
 	ap_watchdog(cpuid);
+#else
+	mask = PCPU_GET(cpumask);
 #endif
 
 	retval = mask & hlt_cpus_mask;

Modified: head/sys/i386/i386/mp_machdep.c
==============================================================================
--- head/sys/i386/i386/mp_machdep.c	Wed Aug 11 09:29:33 2010	(r211175)
+++ head/sys/i386/i386/mp_machdep.c	Wed Aug 11 10:51:27 2010	(r211176)
@@ -1411,8 +1411,10 @@ cpustop_handler(void)
 	cpumask_t cpumask;
 	u_int cpu;
 
+	sched_pin();
 	cpu = PCPU_GET(cpuid);
 	cpumask = PCPU_GET(cpumask);
+	sched_unpin();
 
 	savectx(&stoppcbs[cpu]);
 
@@ -1586,10 +1588,14 @@ mp_grab_cpu_hlt(void)
 #endif
 	int retval;
 
-	mask = PCPU_GET(cpumask);
 #ifdef MP_WATCHDOG
+	sched_pin();
+	mask = PCPU_GET(cpumask);
 	cpuid = PCPU_GET(cpuid);
+	sched_unpin();
 	ap_watchdog(cpuid);
+#else
+	mask = PCPU_GET(cpumask);
 #endif
 
 	retval = mask & hlt_cpus_mask;



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