Subject: Re: siop driver running out of resources?
To: Curt Sampson <cjs@cynic.net>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 02/28/2002 22:40:53
--r5Pyd7+fXNt84Ff3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Feb 27, 2002 at 09:33:54AM +0900, Curt Sampson wrote:
> On Tue, 26 Feb 2002, Manuel Bouyer wrote:
> 
> > Can you also post an example of the out of resources messages ?
> 
> Unfortunately, I didn't write it down before it got blown out of
> my dmesg buf.  But it was just one message, along the lines of
> "sd3(siop0:0:0): adapter resource shortage," appearing several
> times per second, continuously.

Hum, looks like I forgot to protect access to the lists. Can you try the
attached patch ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--

--r5Pyd7+fXNt84Ff3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: siop.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/siop.c,v
retrieving revision 1.49
diff -u -r1.49 siop.c
--- siop.c	2002/01/12 16:03:12	1.49
+++ siop.c	2002/02/28 21:39:20
@@ -1525,7 +1525,7 @@
 siop_morecbd(sc)
 	struct siop_softc *sc;
 {
-	int error, i, j;
+	int error, i, j, s;
 	bus_dma_segment_t seg;
 	int rseg;
 	struct siop_cbd *newcbd;
@@ -1647,7 +1647,9 @@
 		    Ent_ldsa_data);
 		/* JUMP foo, IF FALSE - used by MOVE MEMORY to clear the slot */
 		scr[Ent_ldsa_data / 4] = htole32(0x80000000);
+		s = splbio();
 		TAILQ_INSERT_TAIL(&sc->free_list, &newcbd->cmds[i], next);
+		splx(s);
 #ifdef SIOP_DEBUG
 		printf("tables[%d]: in=0x%x out=0x%x status=0x%x\n", i,
 		    le32toh(newcbd->cmds[i].siop_tables.t_msgin.addr),
@@ -1655,8 +1657,10 @@
 		    le32toh(newcbd->cmds[i].siop_tables.t_status.addr));
 #endif
 	}
+	s = splbio();
 	TAILQ_INSERT_TAIL(&sc->cmds, newcbd, next);
 	sc->sc_adapt.adapt_openings += SIOP_NCMDPB;
+	splx(s);
 	return;
 bad0:
 	bus_dmamap_unload(sc->sc_dmat, newcbd->xferdma);

--r5Pyd7+fXNt84Ff3--