Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern softint_overlay: disable kernel preemption before c...



details:   https://anonhg.NetBSD.org/src/rev/c0005956bb9d
branches:  trunk
changeset: 750657:c0005956bb9d
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat Jan 09 19:02:17 2010 +0000

description:
softint_overlay: disable kernel preemption before curlwp->l_cpu use.

diffstat:

 sys/kern/kern_softint.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r 30858affa62e -r c0005956bb9d sys/kern/kern_softint.c
--- a/sys/kern/kern_softint.c   Sat Jan 09 17:28:06 2010 +0000
+++ b/sys/kern/kern_softint.c   Sat Jan 09 19:02:17 2010 +0000
@@ -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;
+       KASSERT((l->l_pflag & LP_INTR) == 0);
+
+       /*
+        * 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;
 
-       KASSERT((l->l_pflag & LP_INTR) == 0);
-
-       /* Arrange to elevate priority if the LWP blocks. */
-       s = splhigh();
        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);



Home | Main Index | Thread Index | Old Index