DragonFly BSD
DragonFly kernel List (threaded) for 2004-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ATA timeout issues


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Oct 2004 22:11:24 -0700 (PDT)

:I'm going to have to type this by hand, so I'm going to limit it to the
:relevant portion, AFAICT.
:
:dmesg|grep ata
:
:atapci0: <Intel PIIX ATA33 controller> port 0xfe60-0xfe6f at device 7.1 on
:pci0
:
:pciconf -l|grep ata
:
:atapci0@pci0:7:1 class=0x010180 card=0x00000000 chip=0x71118086 rev=0x01
:hdr=0x00
:
:jm
:--
:My other computer is your Windows box.

    I compared the base code for the PIIX4 (71118086) chipset and it's
    the same between 4.10 and DragonFly.  However, I did find a potential
    issue in the bus_dma*() support code.  It appears to still be using
    M_NOWAIT mallocs in a number of places where it should not be.

    My question to you is whether you can better characterize the timeout
    issue.   Do you get a timeout immediately during probe or mounting root,
    or does the timeout occur later on?

    If it fails immediately the patch below probably will not help.  But if
    it fails at some random point later on the patch might help.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>


Index: i386/autoconf.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/autoconf.c,v
retrieving revision 1.13
diff -u -r1.13 autoconf.c
--- i386/autoconf.c	28 Jul 2004 06:04:41 -0000	1.13
+++ i386/autoconf.c	13 Oct 2004 05:02:45 -0000
@@ -340,7 +340,7 @@
 	if (!dev_is_good(newrootdev))
 		return;
 	sname = dsname(newrootdev, unit, slice, part, partname);
-	rootdevnames[0] = malloc(strlen(sname) + 6, M_DEVBUF, M_NOWAIT);
+	rootdevnames[0] = malloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK);
 	sprintf(rootdevnames[0], "ufs:%s%s", sname, partname);
 
 	/*
@@ -356,7 +356,7 @@
 		return;
 	slice = COMPATIBILITY_SLICE;
 	sname = dsname(newrootdev, unit, slice, part, partname);
-	rootdevnames[1] = malloc(strlen(sname) + 6, M_DEVBUF, M_NOWAIT);
+	rootdevnames[1] = malloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK);
 	sprintf(rootdevnames[1], "ufs:%s%s", sname, partname);
 }
 #endif
Index: i386/busdma_machdep.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/busdma_machdep.c,v
retrieving revision 1.9
diff -u -r1.9 busdma_machdep.c
--- i386/busdma_machdep.c	19 Apr 2004 13:37:43 -0000	1.9
+++ i386/busdma_machdep.c	13 Oct 2004 05:04:54 -0000
@@ -138,7 +138,7 @@
 	/* Return a NULL tag on failure */
 	*dmat = NULL;
 
-	newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT);
+	newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_INTWAIT);
 	if (newtag == NULL)
 		return (ENOMEM);
 
@@ -155,12 +155,7 @@
 	newtag->flags = flags;
 	newtag->ref_count = 1; /* Count ourself */
 	newtag->map_count = 0;
-	newtag->segments = malloc(sizeof(bus_dma_segment_t) * newtag->nsegments,
-				  M_DEVBUF, M_INTWAIT);
-	if (newtag->segments == NULL) {
-		free(newtag, M_DEVBUF);
-		return(ENOMEM);
-	}
+	newtag->segments = NULL;
 	
 	/* Take into account any restrictions imposed by our parent tag */
 	if (parent != NULL) {
@@ -259,12 +254,18 @@
 
 	error = 0;
 
+	if (dmat->segments == NULL) {
+		KKASSERT(dmat->nsegments < 16384);
+		dmat->segments = malloc(sizeof(bus_dma_segment_t) * 
+					dmat->nsegments, M_DEVBUF, M_INTWAIT);
+	}
+
 	if (dmat->lowaddr < ptoa(Maxmem)) {
 		/* Must bounce */
 		int maxpages;
 
 		*mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF,
-					     M_NOWAIT);
+					     M_INTWAIT);
 		if (*mapp == NULL) {
 			return (ENOMEM);
 		} else {
@@ -339,6 +340,12 @@
 	/* If we succeed, no mapping/bouncing will be required */
 	*mapp = NULL;
 
+	if (dmat->segments == NULL) {
+		KKASSERT(dmat->nsegments < 16384);
+		dmat->segments = malloc(sizeof(bus_dma_segment_t) * 
+					dmat->nsegments, M_DEVBUF, M_INTWAIT);
+	}
+
 	if (flags & BUS_DMA_NOWAIT)
 		mflags = M_NOWAIT;
 	else
@@ -775,7 +782,7 @@
 		int s;
 
 		bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF,
-						     M_NOWAIT);
+						     M_INTWAIT);
 
 		if (bpage == NULL)
 			break;
Index: i386/k6_mem.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/k6_mem.c,v
retrieving revision 1.3
diff -u -r1.3 k6_mem.c
--- i386/k6_mem.c	6 Jul 2003 21:23:48 -0000	1.3
+++ i386/k6_mem.c	13 Oct 2004 05:05:17 -0000
@@ -109,7 +109,7 @@
 	sc->mr_cap = 0;
 	sc->mr_ndesc = 2; /* XXX (BFF) For now, we only have one msr for this */
 	sc->mr_desc = malloc(sc->mr_ndesc * sizeof(struct mem_range_desc),
-			     M_MEMDESC, M_NOWAIT);
+			     M_MEMDESC, M_WAITOK);
 	if (sc->mr_desc == NULL)
 		panic("k6_mrinit: malloc returns NULL");
 	bzero(sc->mr_desc, sc->mr_ndesc * sizeof(struct mem_range_desc));
Index: i386/nexus.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/nexus.c,v
retrieving revision 1.10
diff -u -r1.10 nexus.c
--- i386/nexus.c	1 Mar 2004 06:33:16 -0000	1.10
+++ i386/nexus.c	13 Oct 2004 05:05:37 -0000
@@ -329,7 +329,7 @@
 	device_t		child;
 	struct nexus_device	*ndev;
 
-	ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
+	ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_INTWAIT|M_ZERO);
 	if (!ndev)
 		return(0);
 	resource_list_init(&ndev->nx_resources);
Index: i386/pnpbios.c
===================================================================
RCS file: /cvs/src/sys/i386/i386/pnpbios.c,v
retrieving revision 1.1
diff -u -r1.1 pnpbios.c
--- i386/pnpbios.c	29 Apr 2004 12:11:16 -0000	1.1
+++ i386/pnpbios.c	13 Oct 2004 05:05:50 -0000
@@ -132,7 +132,7 @@
     if (bootverbose)
 	printf("pnpbios: %d devices, largest %d bytes\n", ndevs, bigdev);
 
-    devnodebuf = malloc(bigdev + (sizeof(struct pnp_sysdevargs) - sizeof(struct pnp_sysdev)), M_DEVBUF, M_NOWAIT);
+    devnodebuf = malloc(bigdev + (sizeof(struct pnp_sysdevargs) - sizeof(struct pnp_sysdev)), M_DEVBUF, M_INTWAIT);
     pda = (struct pnp_sysdevargs *)devnodebuf;
     pd = &pda->node;
 
Index: isa/atapi.c
===================================================================
RCS file: /cvs/src/sys/i386/isa/atapi.c,v
retrieving revision 1.4
diff -u -r1.4 atapi.c
--- isa/atapi.c	7 Aug 2003 21:17:23 -0000	1.4
+++ isa/atapi.c	13 Oct 2004 05:06:09 -0000
@@ -412,7 +412,7 @@
 	/* Obtain parameters. */
 	insw (port + AR_DATA, tb, sizeof(tb) / sizeof(short));
 
-	ap = malloc (sizeof *ap, M_TEMP, M_NOWAIT);
+	ap = malloc (sizeof *ap, M_TEMP, M_INTWAIT);
 	if (! ap)
 		return (0);
 	bcopy (tb, ap, sizeof *ap);
Index: isa/ccbque.h
===================================================================
RCS file: /cvs/src/sys/i386/isa/ccbque.h,v
retrieving revision 1.5
diff -u -r1.5 ccbque.h
--- isa/ccbque.h	2 Aug 2004 13:22:32 -0000	1.5
+++ isa/ccbque.h	13 Oct 2004 05:06:14 -0000
@@ -87,7 +87,7 @@
 		}							\
 		else							\
 		{							\
-			cb = malloc(sizeof(*cb), M_DEVBUF, M_NOWAIT);	\
+			cb = malloc(sizeof(*cb), M_DEVBUF, M_INTWAIT);	\
 			if (cb != NULL)					\
 			{						\
 				bzero(cb, sizeof(*cb));			\



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]