[RFC PATCH #upstream-fixes] libata: don't use 32bit PIO for small transfers

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

 



Some configurations have problems with using 32bit PIO on ATAPI cdb
transfers.  The most likely cause is different division of payload
across FISes but hasn't been confirmed.  There isn't much to be gained
by using 32bit PIO for small transfers.  Play it safe and use 16bit
PIO for transfers smaller than 512 bytes.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
Reported-and-Tested-by: Lei Ming <tom.leiming@xxxxxxxxx>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=40592
Cc: Alan Cox <alan@xxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxx
---
 drivers/ata/libata-sff.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

This fixes the problem but I'm slightly uneasy about it as I don't
know what's going on for sure.  However, given that we've been using
16bit PIO for far longer time and haven't seen much problem, this
seems like a sensible thing to do.  Alan, Jeff, what do you guys
think?

Thanks.

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index c24127d..60e3bac 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -617,7 +617,15 @@ unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,
 	unsigned int words = buflen >> 2;
 	int slop = buflen & 3;
 
-	if (!(ap->pflags & ATA_PFLAG_PIO32))
+	/*
+	 * Some configurations have problem with 32bit PIO on ATAPI cdb
+	 * transfers and there isn't much to be gained by using 32bit PIO
+	 * for small transfers anyway.  Fall back to 16bit if 32bit isn't
+	 * enabled or transfer size is smaller than ATA_SECT_SIZE.
+	 *
+	 * https://bugzilla.kernel.org/show_bug.cgi?id=40592
+	 */
+	if (!(ap->pflags & ATA_PFLAG_PIO32) || buflen < ATA_SECT_SIZE)
 		return ata_sff_data_xfer(dev, buf, buflen, rw);
 
 	/* Transfer multiple of 4 bytes */
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux