Module Name: src Committed By: rmind Date: Mon Jan 7 23:21:32 UTC 2013
Modified Files: src/sys/kern: kern_softint.c subr_pserialize.c Log Message: - 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. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/kern/kern_softint.c cvs rdiff -u -r1.5 -r1.6 src/sys/kern/subr_pserialize.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.38 src/sys/kern/kern_softint.c:1.39 --- src/sys/kern/kern_softint.c:1.38 Tue Sep 27 01:02:38 2011 +++ src/sys/kern/kern_softint.c Mon Jan 7 23:21:31 2013 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: kern_softint #include <sys/evcnt.h> #include <sys/cpu.h> #include <sys/xcall.h> +#include <sys/pserialize.h> #include <net/netisr.h> @@ -828,6 +829,9 @@ softint_dispatch(lwp_t *pinned, int s) 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 Index: src/sys/kern/subr_pserialize.c diff -u src/sys/kern/subr_pserialize.c:1.5 src/sys/kern/subr_pserialize.c:1.6 --- src/sys/kern/subr_pserialize.c:1.5 Sun Jan 29 22:55:40 2012 +++ src/sys/kern/subr_pserialize.c Mon Jan 7 23:21:32 2013 @@ -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 @@ pserialize_destroy(pserialize_t psz) void pserialize_perform(pserialize_t psz) { + uint64_t xc; KASSERT(!cpu_intr_p()); KASSERT(!cpu_softintr_p()); @@ -168,7 +169,10 @@ pserialize_perform(pserialize_t psz) * 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 @@ pserialize_read_enter(void) { KASSERT(!cpu_intr_p()); - return splsoftclock(); + return splsoftserial(); } void