Module Name: src
Committed By: skrll
Date: Mon Jul 16 06:26:43 UTC 2012
Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c
src/sys/arch/arm/include: cpu.h
Log Message:
Fix racy softint dispatch that lead to KASSERT(si->si_active) in
softint_execute
Discussed with matt@. "Looks good to me"
To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/arm/include/cpu.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.76 src/sys/arch/arm/arm32/arm32_machdep.c:1.77
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.76 Thu Jun 30 20:09:19 2011
+++ src/sys/arch/arm/arm32/arm32_machdep.c Mon Jul 16 06:26:43 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_machdep.c,v 1.76 2011/06/30 20:09:19 wiz Exp $ */
+/* $NetBSD: arm32_machdep.c,v 1.77 2012/07/16 06:26:43 skrll Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.76 2011/06/30 20:09:19 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.77 2012/07/16 06:26:43 skrll Exp $");
#include "opt_modular.h"
#include "opt_md.h"
@@ -59,11 +59,12 @@ __KERNEL_RCSID(0, "$NetBSD: arm32_machde
#include <sys/buf.h>
#include <sys/msgbuf.h>
#include <sys/device.h>
-#include <uvm/uvm_extern.h>
#include <sys/sysctl.h>
#include <sys/cpu.h>
#include <sys/module.h>
+#include <uvm/uvm_extern.h>
+
#include <dev/cons.h>
#include <dev/mm.h>
@@ -449,19 +450,21 @@ dosoftints(void)
const int opl = ci->ci_cpl;
const uint32_t softiplmask = SOFTIPLMASK(opl);
+ splhigh();
for (;;) {
u_int softints = ci->ci_softints & softiplmask;
KASSERT((softints != 0) == ((ci->ci_softints >> opl) != 0));
- if (softints == 0)
+ KASSERT(opl == IPL_NONE || (softints & (1 << (opl - IPL_SOFTCLOCK))) == 0);
+ if (softints == 0) {
+ splx(opl);
return;
- ci->ci_cpl = IPL_HIGH;
+ }
#define DOSOFTINT(n) \
- if (softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) { \
+ if (ci->ci_softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) { \
ci->ci_softints &= \
~(1 << (IPL_SOFT ## n - IPL_SOFTCLOCK)); \
softint_switch(ci->ci_softlwps[SOFTINT_ ## n], \
IPL_SOFT ## n); \
- ci->ci_cpl = opl; \
continue; \
}
DOSOFTINT(SERIAL);
Index: src/sys/arch/arm/include/cpu.h
diff -u src/sys/arch/arm/include/cpu.h:1.63 src/sys/arch/arm/include/cpu.h:1.64
--- src/sys/arch/arm/include/cpu.h:1.63 Thu Feb 16 02:30:32 2012
+++ src/sys/arch/arm/include/cpu.h Mon Jul 16 06:26:43 2012
@@ -247,7 +247,7 @@ struct cpu_info {
struct pcb *ci_curpcb; /* current pcb */
#ifdef __HAVE_FAST_SOFTINTS
lwp_t *ci_softlwps[SOFTINT_COUNT];
- uint32_t ci_softints;
+ volatile uint32_t ci_softints;
#endif
#if !defined(PROCESS_ID_IS_CURLWP)
lwp_t *ci_curlwp; /* current lwp */