linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] speed up SATA
@ 2004-03-27 22:37 Jeff Garzik
  2004-03-27 23:04 ` Stefan Smietanowski
                   ` (3 more replies)
  0 siblings, 4 replies; 104+ messages in thread
From: Jeff Garzik @ 2004-03-27 22:37 UTC (permalink / raw)
  To: linux-ide; +Cc: Linux Kernel, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2307 bytes --]


The "lba48" feature in ATA allows for addressing of sectors > 137GB, and 
also allows for transfers of up to 64K sector, instead of the 
traditional 256 sectors in older ATA.

libata simply limited all transfers to a 200 sectors (just under the 256 
sector limit).  This was mainly being careful, and making sure I had a 
solution that worked everywhere.  I also wanted to see how the iommu S/G 
stuff would shake out.

Things seem to be looking pretty good, so it's now time to turn on 
lba48-sized transfers.  Most SATA disks will be lba48 anyway, even the 
ones smaller than 137GB, for this and other reasons.

With this simple patch, the max request size goes from 128K to 32MB... 
so you can imagine this will definitely help performance.  Throughput 
goes up.  Interrupts go down.  Fun for the whole family.

The attached patch is for 2.6.x kernels only.  It should apply to 
2.6.5-rc2 or later, including my latest 2.6-libata patch on kernel.org. 
This patch should be pretty harmless, but you never know what could 
happen when you throw the throttle wide open.  Testing in -mm would be a 
good thing, for example :)

Volunteers are welcome to post a 2.4 backport of this patch to 
linux-ide@vger.kernel.org, and I'll merge it into my 2.4 libata queue.

Here's what dmesg looks like on my workstation.  Look for the "max 
request 32MB" message just after SCSI prints out the disk information.

libata version 1.02 loaded.
ata_piix version 1.02
PCI: Setting latency timer of device 0000:00:1f.2 to 64
ata1: SATA max UDMA/133 cmd 0x24F0 ctl 0x280A bmdma 0x24D0 irq 169
ata2: SATA max UDMA/133 cmd 0x24F8 ctl 0x280E bmdma 0x24D8 irq 169
ata1: dev 0 cfg 49:2f00 82:7c6b 83:7f09 84:4003 85:7c69 86:3e01 87:4003 
88:207f
ata1: dev 0 ATA, max UDMA/133, 488281250 sectors (lba48)
ata1: dev 0 configured for UDMA/133
scsi0 : ata_piix
ata2: SATA port has no device.
ata2: thread exiting
scsi1 : ata_piix
   Vendor: ATA       Model: Maxtor 6Y250M0    Rev: 1.02
   Type:   Direct-Access                      ANSI SCSI revision: 05
ata1: dev 0 max request 32MB (lba48)
SCSI device sda: 488281250 512-byte hdwr sectors (250000 MB)
SCSI device sda: drive cache: write through
  sda: sda1
Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 869 bytes --]

===== drivers/scsi/libata-scsi.c 1.18 vs edited =====
--- 1.18/drivers/scsi/libata-scsi.c	Sat Mar 27 00:21:29 2004
+++ edited/drivers/scsi/libata-scsi.c	Sat Mar 27 16:04:39 2004
@@ -168,6 +168,23 @@
 	sdev->use_10_for_ms = 1;
 	blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD);
 
+	if (sdev->id < ATA_MAX_DEVICES) {
+		struct ata_port *ap;
+		struct ata_device *dev;
+
+		ap = (struct ata_port *) &sdev->host->hostdata[0];
+		dev = &ap->device[sdev->id];
+
+		if (dev->flags & ATA_DFLAG_LBA48) {
+			sdev->host->max_sectors = 65534;
+			blk_queue_max_sectors(sdev->request_queue, 65534);
+			printk(KERN_INFO "ata%u: dev %u max request 32MB (lba48)\n",
+			       ap->id, sdev->id);
+		} else
+			printk(KERN_INFO "ata%u: dev %u max request 128K\n",
+			       ap->id, sdev->id);
+	}
+
 	return 0;	/* scsi layer doesn't check return value, sigh */
 }
 

^ permalink raw reply	[flat|nested] 104+ messages in thread

end of thread, other threads:[~2004-04-03 13:49 UTC | newest]

Thread overview: 104+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-27 22:37 [PATCH] speed up SATA Jeff Garzik
2004-03-27 23:04 ` Stefan Smietanowski
2004-03-27 23:11   ` Jeff Garzik
2004-03-28  7:23     ` Stefan Smietanowski
2004-03-28 15:37       ` Bartlomiej Zolnierkiewicz
2004-03-27 23:32   ` Bartlomiej Zolnierkiewicz
2004-03-27 23:36     ` Jeff Garzik
2004-03-27 23:40       ` Jeff Garzik
2004-03-28  0:13         ` Bartlomiej Zolnierkiewicz
2004-03-28  0:08           ` Jeff Garzik
2004-03-29 11:42       ` Pavel Machek
2004-03-27 23:37 ` Nick Piggin
2004-03-27 23:44   ` Jeff Garzik
2004-03-27 23:47     ` Nick Piggin
2004-03-27 23:59       ` Jeff Garzik
2004-03-28 14:10         ` Jens Axboe
2004-03-28 17:31           ` Jeff Garzik
2004-03-28 17:35             ` Jens Axboe
2004-03-28 17:48               ` Jeff Garzik
2004-03-28 17:54                 ` Jens Axboe
2004-03-28 18:08                   ` Jamie Lokier
2004-03-28 18:15                     ` Jens Axboe
2004-03-28 18:55                       ` Jeff Garzik
2004-03-29  8:09                         ` Jens Axboe
2004-03-29 12:41                           ` Jamie Lokier
2004-03-29 12:44                             ` Jens Axboe
2004-03-29 12:50                               ` Jamie Lokier
2004-03-29 13:05                               ` Arjan van de Ven
2004-03-29 13:08                                 ` Jens Axboe
2004-03-29 17:19                                 ` Craig I. Hagan
2004-03-29 18:19                           ` Jeff Garzik
2004-03-28 19:06                       ` Jeff Garzik
2004-03-28 18:12                   ` William Lee Irwin III
2004-03-28 18:17                     ` Jens Axboe
2004-03-28 18:30                     ` Bartlomiej Zolnierkiewicz
2004-03-28 18:30                       ` Jens Axboe
2004-03-28 18:45                         ` Bartlomiej Zolnierkiewicz
2004-03-28 18:59                           ` Jeff Garzik
2004-03-28 20:32                             ` Andrew Morton
2004-03-28 20:45                               ` Jeff Garzik
2004-03-29  0:55                             ` Andrea Arcangeli
2004-03-29  4:02                               ` Jeff Garzik
2004-03-29 13:04                                 ` Andrea Arcangeli
2004-03-29 19:45                                   ` Jeff Garzik
2004-03-30 11:09                                     ` Jens Axboe
2004-03-30 15:54                                       ` Timothy Miller
2004-03-30 16:20                                       ` Jeff Garzik
2004-03-30 18:05                                       ` Timothy Miller
2004-03-30 17:50                                         ` Jeff Garzik
2004-03-30 18:19                                           ` Timothy Miller
2004-03-29  4:29                               ` Wim Coekaerts
2004-03-29  7:32                                 ` Denis Vlasenko
2004-03-29  8:13                                 ` Jens Axboe
2004-03-29 13:05                                 ` Andrea Arcangeli
2004-03-29  4:31                               ` William Lee Irwin III
2004-03-29  4:57                               ` Jeff Garzik
2004-03-28 19:52                       ` Nuno Silva
2004-03-28 20:02                         ` Jeff Garzik
2004-03-28  0:06     ` Jeff Garzik
2004-03-28  0:15       ` Nick Piggin
2004-03-28  0:49         ` Jeff Garzik
2004-03-28  1:02           ` Andrew Morton
2004-03-28  1:09             ` Jeff Garzik
2004-03-28 13:59               ` Jens Axboe
2004-03-28 17:29                 ` Jeff Garzik
2004-03-28 17:31                   ` Jens Axboe
2004-03-28 13:51           ` Jamie Lokier
2004-03-28 17:24             ` Jeff Garzik
2004-03-28 17:36               ` Jamie Lokier
2004-03-28 17:54                 ` Jeff Garzik
2004-03-28 20:50                   ` Eric D. Mudama
2004-04-02 10:11                 ` Jeremy Higdon
2004-04-02 16:11                   ` Jamie Lokier
2004-04-03 10:48                     ` Jeremy Higdon
2004-04-03 13:49                       ` Jamie Lokier
2004-03-28 17:40               ` Jens Axboe
2004-03-28 17:49                 ` Jeff Garzik
2004-03-28 17:55                   ` Jens Axboe
2004-03-28 18:04                     ` Jeff Garzik
2004-03-28 18:09                       ` Jens Axboe
2004-03-28 20:12                         ` Jeff Garzik
2004-03-28 20:54                           ` Eric D. Mudama
2004-03-28  7:32       ` Stefan Smietanowski
2004-03-28 20:25         ` Jeff Garzik
2004-03-28 21:16           ` Stefan Smietanowski
2004-03-28 21:26             ` Jeff Garzik
2004-03-28 14:08     ` Jens Axboe
2004-03-28 17:38       ` Jeff Garzik
2004-03-28 17:45         ` Jens Axboe
2004-03-28 20:21       ` Jeff Garzik
2004-03-28  0:07   ` Andrew Morton
2004-03-28  0:21     ` Nick Piggin
2004-03-28  4:40   ` Eric D. Mudama
2004-03-28  6:56     ` Nick Piggin
2004-03-28 20:33       ` Eric D. Mudama
2004-03-28 20:59         ` Eric D. Mudama
2004-03-29  1:30           ` Nick Piggin
2004-03-29  5:24             ` Eric D. Mudama
2004-03-29 13:03               ` Jamie Lokier
2004-03-29 11:36 ` Pavel Machek
2004-03-29 18:46   ` David Lang
2004-03-29 20:13     ` Jeff Garzik
2004-03-30  5:55   ` Eric D. Mudama
2004-03-30 12:16 ` Marc Bevand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).