Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2003 23:22:41 +0100
From:      Thomas Moestl <tmoestl@gmx.net>
To:        Roderick van Domburg <r.s.a.vandomburg@student.utwente.nl>
Cc:        freebsd-sparc64@FreeBSD.ORG
Subject:   Re: panic: trap: fast data access mmu miss
Message-ID:  <20030113222241.GB278@crow.dom2ip.de>
In-Reply-To: <LJEKLJEBPDDLMNCFCIOGEEOACAAA.r.s.a.vandomburg@student.utwente.nl>
References:  <20030113004111.GD278@crow.dom2ip.de> <LJEKLJEBPDDLMNCFCIOGEEOACAAA.r.s.a.vandomburg@student.utwente.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

--AqsLC8rIMeq19msA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, 2003/01/13 at 04:03:14 +0100, Roderick van Domburg wrote:
> > Oh, you have an isp in that box? In that case this is expected, please
> > remove this line:
> >
> > 		printf("iommu_dvma_valloc: out of DVMA space.\n");
> >
> >  from sys/sparc64/sparc64/iommu.c and try again.
> 
> Okay, did that. Unfortunately It doesn't mention much more than it did
> before:
> 
> sym0: <875> port 0x2000-0x20ff mem 0x410a000-0x410afff, 0x4108000-0x41080ff
> irq 32 at device 3.1 on pci0
> sym0: No NVRAM, ID 7, Fast-20, SE, parity checking
> sym1: <875> port 0x2400-0x24ff mem 0x410e000-0x410efff, 0x410c000-0x410c0ff
> irq 38 at device 3.1 on pci0
> sym1: No NVRAM, ID 7, Fast-20, SE, parity checking
> __sym_calloc2: failed to allocate SCRIPTB0[1308]
> device_probe_and_attach: sym1 returned 6
> [cut]
> Mounting root from ufs:/dev/da0a
> setrootbyname: failed
> ffs_mountroot: can't find rootvp
> Root mount failed: 6

Damn. OK, here's another diff, with yet more diagnostics and an
increased IOTSB size. If this makes the problem go away, please supply
a complete dmesg.

	- Thomas

P.S: I'm sorry that this is taking so many iterations to diagnose;
debugging-over-mail sucks :)

-- 
Thomas Moestl <tmoestl@gmx.net>	http://www.tu-bs.de/~y0015675/
              <tmm@FreeBSD.org>	http://people.FreeBSD.org/~tmm/
PGP fingerprint: 1C97 A604 2BD0 E492 51D0  9C0F 1FE6 4F1D 419C 776C

--AqsLC8rIMeq19msA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="iommu-errbd.diff"

Index: sparc64/sparc64/iommu.c
===================================================================
RCS file: /ncvs/src/sys/sparc64/sparc64/iommu.c,v
retrieving revision 1.14
diff -u -r1.14 iommu.c
--- sparc64/sparc64/iommu.c	6 Jan 2003 21:59:54 -0000	1.14
+++ sparc64/sparc64/iommu.c	13 Jan 2003 22:01:55 -0000
@@ -517,10 +517,13 @@
 {
 	struct resource *res;
 	struct bus_dmamap_res *bdr;
-	bus_size_t align, bound, sgsize;
+	bus_size_t align, sgsize;
 
-	if ((bdr = malloc(sizeof(*bdr), M_IOMMU, M_NOWAIT)) == NULL)
+	if ((bdr = malloc(sizeof(*bdr), M_IOMMU, M_NOWAIT)) == NULL) {
+		printf("iommu_dvma_valloc: res descriptor allocation "
+		    "failed.\n");
 		return (EAGAIN);
+	}
 	/*
 	 * If a boundary is specified, a map cannot be larger than it; however
 	 * we do not clip currently, as that does not play well with the lazy
@@ -531,9 +534,8 @@
 	sgsize = round_io_page(size) >> IO_PAGE_SHIFT;
 	if (t->dt_boundary > 0 && t->dt_boundary < IO_PAGE_SIZE)
 		panic("iommu_dvmamap_load: illegal boundary specified");
-	bound = ulmax(t->dt_boundary >> IO_PAGE_SHIFT, 1);
 	res = rman_reserve_resource_bound(&iommu_dvma_rman, 0L,
-	    t->dt_lowaddr, sgsize, bound >> IO_PAGE_SHIFT,
+	    t->dt_lowaddr, sgsize, t->dt_boundary >> IO_PAGE_SHIFT,
 	    RF_ACTIVE | rman_make_alignment_flags(align), NULL);
 	if (res == NULL)
 		return (ENOMEM);
@@ -766,8 +768,10 @@
 	pmap_t pmap = NULL;
 
 	KASSERT(buflen != 0, ("iommu_dvmamap_load_buffer: buflen == 0!"));
-	if (buflen > dt->dt_maxsize)
+	if (buflen > dt->dt_maxsize) {
+		printf("iommu_dvmamap_load_buffer: buffer too long.\n");
 		return (EINVAL);
+	}
 
 	if (td != NULL)
 		pmap = vmspace_pmap(td->td_proc->p_vmspace);
@@ -813,6 +817,8 @@
 			sgcnt++;
 			if (sgcnt >= dt->dt_nsegments ||
 			    sgcnt >= BUS_DMAMAP_NSEGS) {
+				printf("iommu_dvmamap_load_buffer: too many "
+				    "segments.\n");
 				error = EFBIG;
 				break;
 			}
@@ -860,7 +866,7 @@
 
 	if (error != 0) {
 		iommu_dvmamap_vunload(is, map);
-		(*cb)(cba, NULL, 0, error);
+		(*cb)(cba, sgs, 0, error);
 	} else {
 		/* Move the map to the end of the LRU queue. */
 		iommu_map_insq(map);
Index: sparc64/pci/psycho.c
===================================================================
RCS file: /ncvs/src/sys/sparc64/pci/psycho.c,v
retrieving revision 1.25
diff -u -r1.25 psycho.c
--- sparc64/pci/psycho.c	6 Jan 2003 21:59:53 -0000	1.25
+++ sparc64/pci/psycho.c	13 Jan 2003 22:08:51 -0000
@@ -565,7 +565,7 @@
 		sc->sc_is->is_sb[1] = 0;
 		if (OF_getproplen(sc->sc_node, "no-streaming-cache") < 0)
 			sc->sc_is->is_sb[0] = sc->sc_pcictl + PCR_STRBUF;
-		psycho_iommu_init(sc, 2);
+		psycho_iommu_init(sc, 4);
 	} else {
 		/* Just copy IOMMU state, config tag and address */
 		sc->sc_is = osc->sc_is;
Index: dev/sym/sym_hipd.c
===================================================================
RCS file: /ncvs/src/sys/dev/sym/sym_hipd.c,v
retrieving revision 1.38
diff -u -r1.38 sym_hipd.c
--- dev/sym/sym_hipd.c	1 Jan 2003 18:48:52 -0000	1.38
+++ dev/sym/sym_hipd.c	13 Jan 2003 22:16:56 -0000
@@ -712,7 +712,10 @@
 {
 	bus_addr_t *baddr;
 	baddr = (bus_addr_t *)arg;
-	*baddr = segs->ds_addr;
+	if (error != 0)
+		*baddr = 0;
+	else
+		*baddr = segs->ds_addr;
 }
 
 static m_addr_t ___dma_getp(m_pool_s *mp)
@@ -720,16 +723,22 @@
 	m_vtob_s *vbp;
 	void *vaddr = 0;
 	bus_addr_t baddr = 0;
+	int err;
 
 	vbp = __sym_calloc(&mp0, sizeof(*vbp), "VTOB");
-	if (!vbp)
+	if (!vbp) {
+		printf("___dma_getp: malloc failed\n");
 		goto out_err;
+	}
 
 	if (bus_dmamem_alloc(mp->dmat, &vaddr,
 			      BUS_DMA_NOWAIT, &vbp->dmamap))
 		goto out_err;
-	bus_dmamap_load(mp->dmat, vbp->dmamap, vaddr,
-			MEMO_CLUSTER_SIZE, getbaddrcb, &baddr, 0);
+	if ((err = bus_dmamap_load(mp->dmat, vbp->dmamap, vaddr,
+		 MEMO_CLUSTER_SIZE, getbaddrcb, &baddr, 0))) {
+		printf("bus_dmamap_load: error %d\n", err);
+		goto out_err;
+	}
 	if (baddr) {
 		int hc = VTOB_HASH_CODE(vaddr);
 		vbp->vaddr = (m_addr_t) vaddr;
@@ -744,8 +753,6 @@
 		bus_dmamap_unload(mp->dmat, vbp->dmamap);
 	if (vaddr)
 		bus_dmamem_free(mp->dmat, vaddr, vbp->dmamap);
-	if (vbp->dmamap)
-		bus_dmamap_destroy(mp->dmat, vbp->dmamap);
 	if (vbp)
 		__sym_mfree(&mp0, vbp, sizeof(*vbp), "VTOB");
 	return 0;
Index: kern/subr_rman.c
===================================================================
RCS file: /ncvs/src/sys/kern/subr_rman.c,v
retrieving revision 1.27
diff -u -r1.27 subr_rman.c
--- kern/subr_rman.c	27 Nov 2002 03:55:22 -0000	1.27
+++ kern/subr_rman.c	12 Jan 2003 22:45:20 -0000
@@ -229,7 +229,7 @@
 		 */
 		do {
 			rstart = (rstart + amask) & ~amask;
-			if (((rstart ^ (rstart + count)) & bmask) != 0)
+			if (((rstart ^ (rstart + count - 1)) & bmask) != 0)
 				rstart += bound - (rstart & ~bmask);
 		} while ((rstart & amask) != 0 && rstart < end &&
 		    rstart < s->r_end);
@@ -263,8 +263,11 @@
 			 * two new allocations; the second requires but one.
 			 */
 			rv = malloc(sizeof *rv, M_RMAN, M_NOWAIT | M_ZERO);
-			if (rv == 0)
+			if (rv == 0) {
+				printf("rman_reserve_resource: out of "
+				    "memory.\n");
 				goto out;
+			}
 			rv->r_start = rstart;
 			rv->r_end = rstart + count - 1;
 			rv->r_flags = flags | RF_ALLOCATED;
@@ -282,6 +285,8 @@
 				 */
 				r = malloc(sizeof *r, M_RMAN, M_NOWAIT|M_ZERO);
 				if (r == 0) {
+					printf("rman_reserve_resource: out of "
+					    "memory.\n");
 					free(rv, M_RMAN);
 					rv = 0;
 					goto out;

--AqsLC8rIMeq19msA--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-sparc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030113222241.GB278>