Subject: powerpc softintr (was Re: ibm4xx interrupts)
To: None <port-powerpc@netbsd.org>
From: Tadashi G.Takaoka <t2@method.jp>
List: port-powerpc
Date: 06/27/2006 13:02:22
Hello,

On Tue, 27 Jun 2006 01:55:23 +0200,
Jachym Holecek <freza AT dspfpga.com> wrote
>the diff below converts ibm4xx to:
>  * generic soft interrupts

I think powerpc's softintr_schedule() has a problem when checking
si->si_refs value.  It should be checked in splvm() guard. right?

I have experienced KASSERT(si->si_refs > 0) failed at softintr__run()
when havily softintr/softnet had occured. Following quick patch
resolves the phenomenon.

--- softintr.c.orig	2006-04-12 21:30:50.000000000 +0900
+++ softintr.c	2006-06-27 12:50:46.000000000 +0900
@@ -136,6 +136,13 @@ softintr_schedule(void *cookie)
 	/*
 	 * Assume checking a single integer field is atomic.
 	 */
+#if 1
+	s = splvm();
+	if (si->si_refs > 1) {
+		splx(s);
+		return;
+	}
+#else
 	if (si->si_refs > 1)
 		return;
 
@@ -143,6 +150,7 @@ softintr_schedule(void *cookie)
 	 * Raise IPL and insert onto queue.
 	 */
 	s = splvm();
+#endif
 	SIMPLEQ_INSERT_TAIL(qh, si, si_link);
 	si->si_refs++;
 	switch (si->si_ipl) {

--
 TAKAOKA is gathering P*O*W*E*R.         http://method.jp/tadashi/