Skip to contentSkip to conversation

SII SATA request size limit

DISCUSSION Eduardo Casino 2 participants 2 messages Sep 12, 2003 – Sep 15, 2003

lore
Share & tools
lore
#0 lore raw

Hi All,

I had a look at the NetBSD pciide.c driver and found this interesting bit of code:

	/*
	 * Rev. <= 0x01 of the 3112 have a bug that can cause data
	 * corruption if DMA transfers cross an 8K boundary.  This is
	 * apparently hard to tickle, but we'll go ahead and play it
	 * safe.
	 */
	if (PCI_REVISION(pa->pa_class) <= 0x01) {
		sc->sc_dma_maxsegsz = 8192;
		sc->sc_dma_boundary = 8192;
	}

This is basically the same as setting hwif->rqsize to 15, but the NetBSD folks apply the restriction only if the SiI3112 chipset revision is 1 or lower. As I have a rev. 2 chip, I raised the rqsize to 128 and made some disk intensive tests: kernel compilation while recursively copying some huge (~400MB) files. A couple of hours later, my system remained stable and getting transfers over 55MB/s with my 120GB Seagate. I'm running 2.4.22-ac1.

This silly patch makes the siimage driver to set rqsize to 15 only for older, supposedly buggy chips, and leaves the default for the rest.

Regards,
Eduardo.

siimage.c renamed from siimage.c.orig +6 -1
@@ -1065,7 +1065,12 @@ static void __init init_iops_siimage (id
 	hwif->hwif_data = 0;
 
 	hwif->rqsize = 128;
-	if (is_sata(hwif))
+	/*
+	 * From the NetBSD driver:
+	 * "Rev. <= 0x01 of the 3112 have a bug that can cause data
+	 *  corruption if DMA transfers cross an 8K boundary."
+	 */
+	if (dev->device == PCI_DEVICE_ID_SII_3112 && class_rev < 0x02)
 		hwif->rqsize = 15;
 
 	if (pci_get_drvdata(dev) == NULL)
#1 lore raw
Quoted 16 lines · Eduardo Casino

Hi All,

I had a look at the NetBSD pciide.c driver and found this interesting bit of code:

	/*
	 * Rev. <= 0x01 of the 3112 have a bug that can cause data
	 * corruption if DMA transfers cross an 8K boundary.  This is
	 * apparently hard to tickle, but we'll go ahead and play it
	 * safe.
	 */
	if (PCI_REVISION(pa->pa_class) <= 0x01) {
		sc->sc_dma_maxsegsz = 8192;
		sc->sc_dma_boundary = 8192;
	}
Quoted 1 line

This is basically the same as setting hwif->rqsize to 15, but the NetBSD

You can do much much better than that, it's pretty simply to just restrict the segment size and boundary if you have a controller with such a bug. And then you get the benefit of the larger requests too, it's basically not a performance hit at that point.

Signature · 1 line
Jens Axboe