Source-Changes-HG archive

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

[src/trunk]: src/sys/kern - softint_dispatch: perform pserialize(9) switchpoi...



details:   https://anonhg.NetBSD.org/src/rev/98603adb7b49
branches:  trunk
changeset: 783762:98603adb7b49
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon Jan 07 23:21:31 2013 +0000

description:
- softint_dispatch: perform pserialize(9) switchpoint when softintr processing
  finishes (without blocking).  Problem reported by hannken@, thanks!
- pserialize_read_enter: use splsoftserial(), not splsoftclock().
- pserialize_perform: add xcall(9) barrier as interrupts may be coalesced.

diffstat:

 sys/kern/kern_softint.c    |   8 ++++++--
 sys/kern/subr_pserialize.c |  12 ++++++++----
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (83 lines):

diff -r aa08552fb56c -r 98603adb7b49 sys/kern/kern_softint.c
--- a/sys/kern/kern_softint.c   Mon Jan 07 23:20:42 2013 +0000
+++ b/sys/kern/kern_softint.c   Mon Jan 07 23:21:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_softint.c,v 1.38 2011/09/27 01:02:38 jym Exp $    */
+/*     $NetBSD: kern_softint.c,v 1.39 2013/01/07 23:21:31 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.38 2011/09/27 01:02:38 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.39 2013/01/07 23:21:31 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -186,6 +186,7 @@
 #include <sys/evcnt.h>
 #include <sys/cpu.h>
 #include <sys/xcall.h>
+#include <sys/pserialize.h>
 
 #include <net/netisr.h>
 
@@ -828,6 +829,9 @@
                l->l_pflag &= ~LP_TIMEINTR;
        }
 
+       /* Indicate a soft-interrupt switch. */
+       pserialize_switchpoint();
+
        /*
         * If we blocked while handling the interrupt, the pinned LWP is
         * gone so switch to the idle LWP.  It will select a new LWP to
diff -r aa08552fb56c -r 98603adb7b49 sys/kern/subr_pserialize.c
--- a/sys/kern/subr_pserialize.c        Mon Jan 07 23:20:42 2013 +0000
+++ b/sys/kern/subr_pserialize.c        Mon Jan 07 23:21:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pserialize.c,v 1.5 2012/01/29 22:55:40 rmind Exp $        */
+/*     $NetBSD: subr_pserialize.c,v 1.6 2013/01/07 23:21:32 rmind Exp $        */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.5 2012/01/29 22:55:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.6 2013/01/07 23:21:32 rmind Exp $");
 
 #include <sys/param.h>
 
@@ -139,6 +139,7 @@
 void
 pserialize_perform(pserialize_t psz)
 {
+       uint64_t xc;
 
        KASSERT(!cpu_intr_p());
        KASSERT(!cpu_softintr_p());
@@ -168,7 +169,10 @@
         * Force some context switch activity on every CPU, as the system
         * may not be busy.  Note: should pass the point twice.
         */
-       xc_broadcast(XC_HIGHPRI, (xcfunc_t)nullop, NULL, NULL);
+       xc = xc_broadcast(XC_HIGHPRI, (xcfunc_t)nullop, NULL, NULL);
+       xc_wait(xc);
+
+       /* No need to xc_wait() as we implement our own condvar. */
        xc_broadcast(XC_HIGHPRI, (xcfunc_t)nullop, NULL, NULL);
 
        /*
@@ -191,7 +195,7 @@
 {
 
        KASSERT(!cpu_intr_p());
-       return splsoftclock();
+       return splsoftserial();
 }
 
 void



Home | Main Index | Thread Index | Old Index