Subject: Re: Consistent "panic: lockmgr: no context" on macppc
To: Monroe Williams <monroe@criticalpath.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 10/06/2001 15:04:08
--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii

On Thu, Oct 04, 2001 at 04:57:03PM -0700, Monroe Williams wrote:
> 
> I'm setting up a new machine that's supposed to replace an old server
> (PowerMac 9600 running NetBSD-1.5), and I can't seem to get it to run
> reliably.
> 
> The new machine is a G4/466 with 3 IBM DDYS-series (U160-capable) drives:
> two 18G drives as a mirrored RAID set for most of the filesystem and a 9G
> used for /tmp, swap, and an HFS partition.  I've already determined that an
> Adaptec 29160 SCSI card will not work reliably with NetBSD (see my posts to
> the port-macppc list last month for details), and I'm auditioning a
> 53c895-based card made by ATTO.
> 
> I'm consistently seeing the following panic right after the boot sequence
> finishes and the login: prompt is displayed:
> 
> panic: lockmgr: no context
> Stopped at      cpu_Debugger+0x10:   blah blah blah
> db> trace
> at panic+e8
> at lockmgr+a4
> at uvm_map+c4
> at uvm_km_valloc+5c
> at _bus_dmamem_map+68
> at siop_morecbd+138

Hum, I'm working on a patch for this. The problem is that _bus_dmamem_map()
(and so siop_morecbd()) shouldn't be called from interrupt context. I'm
locking for the best way to achieve this.

For now the attached diff should work around the problem for you.

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

--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

--- siop.c.orig	Sat Oct  6 15:00:04 2001
+++ siop.c	Sat Oct  6 15:03:28 2001
@@ -71,7 +71,7 @@
 #endif
 
 /* number of cmd descriptors per block */
-#define SIOP_NCMDPB (NBPG / sizeof(struct siop_xfer))
+#define SIOP_NCMDPB (2 * NBPG / sizeof(struct siop_xfer))
 
 void	siop_reset __P((struct siop_softc *));
 void	siop_handle_reset __P((struct siop_softc *));
@@ -1476,21 +1476,21 @@
 		error = ENOMEM;
 		goto bad3;
 	}
-	error = bus_dmamem_alloc(sc->sc_dmat, NBPG, NBPG, 0, &seg, 1, &rseg,
+	error = bus_dmamem_alloc(sc->sc_dmat, NBPG * 2, NBPG, 0, &seg, 1, &rseg,
 	    BUS_DMA_NOWAIT);
 	if (error) {
 		printf("%s: unable to allocate cbd DMA memory, error = %d\n",
 		    sc->sc_dev.dv_xname, error);
 		goto bad2;
 	}
-	error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, NBPG,
+	error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, NBPG * 2,
 	    (caddr_t *)&newcbd->xfers, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
 	if (error) {
 		printf("%s: unable to map cbd DMA memory, error = %d\n",
 		    sc->sc_dev.dv_xname, error);
 		goto bad2;
 	}
-	error = bus_dmamap_create(sc->sc_dmat, NBPG, 1, NBPG, 0,
+	error = bus_dmamap_create(sc->sc_dmat, NBPG * 2, 1, NBPG, 0,
 	    BUS_DMA_NOWAIT, &newcbd->xferdma);
 	if (error) {
 		printf("%s: unable to create cbd DMA map, error = %d\n",

--4Ckj6UjgE2iN1+kY--