Module Name: src
Committed By: rmind
Date: Sat Jan 9 19:02:18 UTC 2010
Modified Files:
src/sys/kern: kern_softint.c
Log Message:
softint_overlay: disable kernel preemption before curlwp->l_cpu use.
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/kern_softint.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_softint.c
diff -u src/sys/kern/kern_softint.c:1.30 src/sys/kern/kern_softint.c:1.31
--- src/sys/kern/kern_softint.c:1.30 Fri Jan 8 12:10:46 2010
+++ src/sys/kern/kern_softint.c Sat Jan 9 19:02:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_softint.c,v 1.30 2010/01/08 12:10:46 rmind Exp $ */
+/* $NetBSD: kern_softint.c,v 1.31 2010/01/09 19:02:17 rmind Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -176,7 +176,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.30 2010/01/08 12:10:46 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.31 2010/01/09 19:02:17 rmind Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -721,17 +721,21 @@
int s;
l = curlwp;
- ci = l->l_cpu;
- si = ((softcpu_t *)ci->ci_data.cpu_softcpu)->sc_int;
-
KASSERT((l->l_pflag & LP_INTR) == 0);
- /* Arrange to elevate priority if the LWP blocks. */
+ /*
+ * Arrange to elevate priority if the LWP blocks. Also, bind LWP
+ * to the CPU. Note: disable kernel preemption before doing that.
+ */
s = splhigh();
+ ci = l->l_cpu;
+ si = ((softcpu_t *)ci->ci_data.cpu_softcpu)->sc_int;
+
obase = l->l_kpribase;
l->l_kpribase = PRI_KERNEL_RT;
oflag = l->l_pflag;
l->l_pflag = oflag | LP_INTR | LP_BOUND;
+
while ((softints = ci->ci_data.cpu_softints) != 0) {
if ((softints & (1 << SOFTINT_SERIAL)) != 0) {
ci->ci_data.cpu_softints &= ~(1 << SOFTINT_SERIAL);