Skip to contentSkip to conversation

IDE tagged command queueing support

PATCH In review Jens Axboe 3 participants 6 messages Apr 8, 2002 – Apr 9, 2002

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH 1/1 IDE tagged command queueing support

Hi,

I've implemented tagged command queueing for ATA disk drives, and it's now ready for people to give it a test spin. As it has had only limited testing so far, please be very careful with it. It has been tested on two drives so far, a GXP75-30gb and a GXP120-40gb, and with a PIIX4 controller:

Intel Corp. 82371AB PIIX4 IDE: IDE controller on PCI slot 00:04.1 Intel Corp. 82371AB PIIX4 IDE: chipset revision 1
Intel Corp. 82371AB PIIX4 IDE: not 100% native mode: will probe irqs later
PIIX: Intel Corp. 82371AB PIIX4 IDE UDMA33 controller on pci00:04.1

    ide0: BM-DMA at 0xd800-0xd807, BIOS settings: hda:DMA, hdb:pio
    ide1: BM-DMA at 0xd808-0xd80f, BIOS settings: hdc:pio, hdd:pio

hda: IC35L040AVVA07-0, ATA DISK drive
hdc: IBM-DTLA-307030, ATA DISK drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: tagged command queueing enabled, command queue depth 32
hda: 80418240 sectors (41174 MB) w/1863KiB Cache, CHS=79780/16/63, UDMA(33)
hdc: tagged command queueing enabled, command queue depth 32
hdc: 60036480 sectors (30739 MB) w/1916KiB Cache, CHS=59560/16/63, UDMA(33)

I haven't patched hdparm to support enabling TCQ yet, so please use the 'TCQ on by default' option. If TCQ has been selected an enabled, there should be a 'tcq' file in the ide proc directory which will give you a bit of info about the current state of the drive:

bart:~ # cat /proc/ide/hdc/tcq

Max queue depth:        32
Max achieved depth:     23
Max depth since last:   16
Current depth:          10

ar dfd9e120 is tag 2
ar dfd9e360 is tag 3
ar dfd9e660 is tag 4
ar dfd9e5a0 is tag 5
ar dfd9e7e0 is tag 6
ar dfd9e600 is tag 7
ar dfd9e480 is tag 8
ar dfd9e2a0 is tag 9
ar dfd9e300 is tag 14
ar dfd9e720 is tag 15
hwgroup busy
dma busy
oldest command 5
immed rel 1153, immed comp 12370

As this is the first release, some of this info is a bit user-unfriendly. Let me explain the fields:

The first four are about the queue depth: maximum supported, maximum achieved during operations, maximum achieved since last cat of file, and the current depth at the time of the file cat. Then follows a listing of the requests in progress. Then some debug info about hwgroup and dma busy states, and oldest command (in jiffies) in the queue. The last line indicates the status of sent commands -- either they released the bus immediately (immed rel: data not ready, we can queue another), or the drive chose to fetch data immediately (immed comp, no bus release).

I could talk a bit about the IDE cores changes needed to make this happen (ata_request_t stuff), but I'm too lazy and will wait until people ask about it. Note that I'm no particular fan of hungarian notation either, but (again) due to laziness I've used that because it's easier on the typing fingers. Things are bound to change from this first alpha release anyways, so I'll just wait.

If you have a recent IBM Deskstar drive (these are the only ones that support TCQ current, to my knowledge), I would appreciate if you could give it a spin and report success and failure to me.

Random notes:

- For this release, only a single drive on a channel has been tested. So don't bother filing bug reports if you don't have a similar setup in that regard.
- Interrupt handler timer needs to be changed to be per-ata_request, not per hwgroup.
- General ata_request stuff isn't design complete yet, this could be taken much further.
- Due to memory consumption friendliness, block queues are configured for a maximum of 32 segments at this time. This is still enough to achieve the full 128kb for a dma request that we support anyways (modulo 48-bit lba, doesn't matter).
- TCQ can't be supported on Promise controllers at all, it intercepts interrupts so we don't see them.
- Backing off TCQ in case of failure is untested.
- ide.h TCQ stuff needs some cleaning

That said, please give it a go if you can! Patch is against 2.5.8-pre2.

Signature · 1 line
Jens Axboe
drivers/ide/Config.help renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/Config.help +22 -0
diff -urN -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.5.8-pre2/drivers/ide/Config.help linux/drivers/ide/Config.help
@@ -744,6 +744,28 @@
 
   Generally say N here.
 
+CONFIG_BLK_DEV_IDE_TCQ
+  Support for tagged command queueing on ATA disk drives. This enables
+  the IDE layer to have multiple in-flight requests on hardware that
+  supports it. For now this includes the IBM Deskstar series drives,
+  such as the GXP75, 40GV, GXP60, and GXP120 (ie any Deskstar made in
+  the last couple of years).
+
+  If you have such a drive, say Y here.
+
+CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
+  Enabled tagged command queueing unconditionally on drives that report
+  support for it.
+
+  Generally say Y here.
+
+CONFIG_BLK_DEV_IDE_TCQ_DEPTH
+  Maximum size of commands to enable per-drive. Any value between 1
+  and 32 is valid, with 32 being the maxium that the hardware supports.
+
+  You probably just want the default of 32 here. If you enter an invalid
+  number, the default value will be used.
+
 CONFIG_BLK_DEV_IT8172
   Say Y here to support the on-board IDE controller on the Integrated
   Technology Express, Inc. ITE8172 SBC.  Vendor page at
drivers/ide/Config.in renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/Config.in +5 -0
diff -urN -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.5.8-pre2/drivers/ide/Config.in linux/drivers/ide/Config.in
@@ -47,6 +47,11 @@
 	 dep_bool '      Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
          dep_bool '    Enable DMA only for disks ' CONFIG_IDEDMA_ONLYDISK $CONFIG_IDEDMA_PCI_AUTO
 	 define_bool CONFIG_BLK_DEV_IDEDMA $CONFIG_BLK_DEV_IDEDMA_PCI
+	 dep_bool '    IDE tagged command queueing' CONFIG_BLK_DEV_IDE_TCQ $CONFIG_BLK_DEV_IDEDMA_PCI
+	   dep_bool '    TCQ on by default' CONFIG_BLK_DEV_IDE_TCQ_DEFAULT $CONFIG_BLK_DEV_IDE_TCQ
+	   if [ $CONFIG_BLK_DEV_IDE_TCQ_DEFAULT != "n" ]; then
+		int '    Default queue depth' CONFIG_BLK_DEV_IDE_TCQ_DEPTH 32
+	   fi
 	 dep_bool '    ATA Work(s) In Progress (EXPERIMENTAL)' CONFIG_IDEDMA_PCI_WIP $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL
 	 dep_bool '    Good-Bad DMA Model-Firmware (WIP)' CONFIG_IDEDMA_NEW_DRIVE_LISTINGS $CONFIG_IDEDMA_PCI_WIP
 	 dep_bool '    AEC62XX chipset support' CONFIG_BLK_DEV_AEC62XX $CONFIG_BLK_DEV_IDEDMA_PCI
drivers/ide/Makefile renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/Makefile +1 -0
diff -urN -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.5.8-pre2/drivers/ide/Makefile linux/drivers/ide/Makefile
@@ -45,6 +45,7 @@
 ide-obj-$(CONFIG_BLK_DEV_HT6560B)	+= ht6560b.o
 ide-obj-$(CONFIG_BLK_DEV_IDE_ICSIDE)	+= icside.o
 ide-obj-$(CONFIG_BLK_DEV_IDEDMA_PCI)	+= ide-dma.o
+ide-obj-$(CONFIG_BLK_DEV_IDE_TCQ)	+= ide-tcq.o
 ide-obj-$(CONFIG_BLK_DEV_IDEPCI)	+= ide-pci.o
 ide-obj-$(CONFIG_BLK_DEV_ISAPNP)	+= ide-pnp.o
 ide-obj-$(CONFIG_BLK_DEV_IDE_PMAC)	+= ide-pmac.o
drivers/ide/ide-disk.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-disk.c +201 -84

424 lines not on this page · raw message

drivers/ide/ide-dma.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-dma.c +113 -91

336 lines not on this page · raw message

drivers/ide/ide-features.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-features.c +0 -3
diff -urN -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-features.c linux/drivers/ide/ide-features.c
@@ -75,10 +75,7 @@
 char *ide_dmafunc_verbose (ide_dma_action_t dmafunc)
 {
 	switch (dmafunc) {
-		case ide_dma_read:		return("ide_dma_read");
-		case ide_dma_write:		return("ide_dma_write");
 		case ide_dma_begin:		return("ide_dma_begin");
-		case ide_dma_end:		return("ide_dma_end:");
 		case ide_dma_check:		return("ide_dma_check");
 		case ide_dma_on:		return("ide_dma_on");
 		case ide_dma_off:		return("ide_dma_off");
drivers/ide/ide-probe.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-probe.c +17 -2
diff -urN -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
@@ -189,6 +189,21 @@
 	if (drive->channel->quirkproc)
 		drive->quirk_list = drive->channel->quirkproc(drive);
 
+	/*
+	 * it's an ata drive, build command list
+	 */
+#ifndef CONFIG_BLK_DEV_IDE_TCQ
+	drive->queue_depth = 1;
+#else
+	drive->queue_depth = drive->id->queue_depth + 1;
+	if (drive->queue_depth > CONFIG_BLK_DEV_IDE_TCQ_DEPTH)
+		drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
+	if (drive->queue_depth < 1 || drive->queue_depth > 32)
+		drive->queue_depth = 32;
+#endif
+	if (ide_build_commandlist(drive))
+		goto err_misc;
+
 	return;
 
 err_misc:
@@ -593,10 +608,10 @@
 	blk_queue_max_sectors(q, max_sectors);
 
 	/* IDE DMA can do PRD_ENTRIES number of segments. */
-	blk_queue_max_hw_segments(q, PRD_ENTRIES);
+	blk_queue_max_hw_segments(q, PRD_SEGMENTS);
 
 	/* This is a driver limit and could be eliminated. */
-	blk_queue_max_phys_segments(q, PRD_ENTRIES);
+	blk_queue_max_phys_segments(q, PRD_SEGMENTS);
 }
 
 #if MAX_HWIFS > 1
drivers/ide/ide-taskfile.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-taskfile.c +48 -15

128 lines not on this page · raw message

drivers/ide/ide-tcq.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/ide-tcq.c +563 -0

563 lines not on this page · raw message

drivers/ide/ide.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/ide.c +206 -11

375 lines not on this page · raw message

drivers/ide/pdc202xx.c renamed from opt/kernel/linux-2.5.8-pre2/drivers/ide/pdc202xx.c +6 -0
diff -urN -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.5.8-pre2/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
@@ -1057,6 +1057,12 @@
 		case ide_dma_timeout:
 			if (drive->channel->resetproc != NULL)
 				drive->channel->resetproc(drive);
+		/*
+		 * we cannot support queued operations on promise, so fail to
+		 * to enable it...
+		 */
+		case ide_dma_queued_on:
+			return 1;
 		default:
 			break;
 	}
include/linux/hdreg.h renamed from opt/kernel/linux-2.5.8-pre2/include/linux/hdreg.h +8 -0
diff -urN -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.5.8-pre2/include/linux/hdreg.h linux/include/linux/hdreg.h
@@ -34,6 +34,7 @@
 #define ECC_STAT		0x04	/* Corrected error */
 #define DRQ_STAT		0x08
 #define SEEK_STAT		0x10
+#define SERVICE_STAT		SEEK_STAT
 #define WRERR_STAT		0x20
 #define READY_STAT		0x40
 #define BUSY_STAT		0x80
@@ -50,6 +51,13 @@
 #define ICRC_ERR		0x80	/* new meaning:  CRC error during transfer */
 
 /*
+ * bits of NSECTOR reg
+ */
+#define NSEC_CD			0x1
+#define NSEC_IO			0x2
+#define NSEC_REL		0x4
+
+/*
  * Command Header sizes for IOCTL commands
  *	HDIO_DRIVE_CMD and HDIO_DRIVE_TASK
  */
include/linux/ide.h renamed from opt/kernel/linux-2.5.8-pre2/include/linux/ide.h +173 -10

294 lines not on this page · raw message

#1 lore raw
Quoted 7 lines · Jens Axboe

Hi,

I've implemented tagged command queueing for ATA disk drives, and it's now ready for people to give it a test spin. As it has had only limited testing so far, please be very careful with it. It has been tested on two drives so far, a GXP75-30gb and a GXP120-40gb, and with a PIIX4 controller:

OK after a cursory look I see that the patch contains quite a lot of ideas for the generic code itself. Do you think that it would be worth wile to extract them first or should the patch be just included in mainline. (I don't intent to interferre too much with your efforts to do something similar in 2.4.xx.)....

author
#2 lore raw
In reply to Jens Axboe
Quoted 9 lines · Martin Dalecki
Quoted 7 lines · Jens Axboe

Hi,

I've implemented tagged command queueing for ATA disk drives, and it's now ready for people to give it a test spin. As it has had only limited testing so far, please be very careful with it. It has been tested on two drives so far, a GXP75-30gb and a GXP120-40gb, and with a PIIX4 controller:

Quoted 5 lines

OK after a cursory look I see that the patch contains quite a lot of ideas for the generic code itself. Do you think that it would be worth wile to extract them first or should the patch be just included in mainline. (I don't intent to interferre too much with your efforts to do something similar in 2.4.xx.)....

Good question, I've asked myself that too... Yeah I see some of my ideas as being nice to have in mainline even without TCQ. The big one being ata_request_t of course, there are some parts to this:

- Separate scatterlist and dma table out from hwgroup. This is not really needed for TCQ, but saves doing a blk_rq_map_sg on a request more than once. If future ATA hardware would support more than one pending DMA operation per hwgroup, this would be useful even without TCQ.

- Use ata_request_t as the main request command. This is where I really want to go. I'm not saying that we need a complete IDE mid layer, but a private request type is a nice way to unify the passing of a general command around. So the taskfile stuff would remain very low level, ata_request would add the higher level parts. I could expand lots more on this, but I'm quite sure you know where I'm going :-)

Note that the ata_request_t usage is a bit messy in the current patch, that's merely because I was more focused on getting TCQ stable than designing this out right now. So I think we should let it mature in the TCQ patch for just a while before making any final commitments. Agreed? Of course this will leave me with the pain of merging with your IDE stuff every time a new -pre comes out (updating this patch from 2.5.1-pre where I last used it was _not_ funny! :-), but I can handle that.

In addition, there are small buglet fixes in the patch that should go to general. I will extract these, I already send you one of these earlier today.

BTW, I just found an SMP race in the current patch. I'll send out a new version later, for now it's here:

ide/ide.c renamed from ../linux-2.5.8-pre2/drivers/ide/ide.c +11 -2
@@ -1373,8 +1373,17 @@
 			break;
 		}
 
-		if (blk_queue_plugged(&drive->queue))
-			BUG();
+		/*
+		 * there's a small window between where the queue could be
+		 * replugged while we are in here when using tcq (in which
+		 * case the queue is probably empty anyways...), so check
+		 * and leave if appropriate. When not using tqc, this is
+		 * still a severe BUG!
+		 */
+		if (blk_queue_plugged(&drive->queue)) {
+			BUG_ON(!drive->using_tcq);
+			break;
+		}
 
 		/*
 		 * just continuing an interrupted request maybe
Signature · 1 line
Jens Axboe
#3 lore raw
In reply to Jens Axboe
Quoted 19 lines · Jens Axboe
Quoted 10 lines · Martin Dalecki
Quoted 7 lines · Jens Axboe

Hi,

I've implemented tagged command queueing for ATA disk drives, and it's now ready for people to give it a test spin. As it has had only limited testing so far, please be very careful with it. It has been tested on two drives so far, a GXP75-30gb and a GXP120-40gb, and with a PIIX4 controller:

Quoted 5 lines

OK after a cursory look I see that the patch contains quite a lot of ideas for the generic code itself. Do you think that it would be worth wile to extract them first or should the patch be just included in mainline. (I don't intent to interferre too much with your efforts to do something similar in 2.4.xx.)....

Quoted 3 lines

Good question, I've asked myself that too... Yeah I see some of my ideas as being nice to have in mainline even without TCQ. The big one being ata_request_t of course, there are some parts to this:

Sure ;-).

Quoted 5 lines

- Separate scatterlist and dma table out from hwgroup. This is not really needed for TCQ, but saves doing a blk_rq_map_sg on a request more than once. If future ATA hardware would support more than one pending DMA operation per hwgroup, this would be useful even without TCQ.

Agreed.

Quoted 6 lines

- Use ata_request_t as the main request command. This is where I really want to go. I'm not saying that we need a complete IDE mid layer, but a private request type is a nice way to unify the passing of a general command around. So the taskfile stuff would remain very low level, ata_request would add the higher level parts. I could expand lots more on this, but I'm quite sure you know where I'm going :-)

Well I can assure you that we are not dragging the towell in two different directions - please see for example my notes about the ata_taskfile function having too much parameters ;-).

Quoted 1 line

Note that the ata_request_t usage is a bit messy in the current patch,

I noted it already ;-)

Quoted 3 lines

that's merely because I was more focused on getting TCQ stable than designing this out right now. So I think we should let it mature in the TCQ patch for just a while before making any final commitments. Agreed?

No problem with me. I will just pull out the generally good stuff out of it OK? I hope this will not make the tracking of the alpha patches too difficult for you...

Quoted 4 lines

Of course this will leave me with the pain of merging with your IDE stuff every time a new -pre comes out (updating this patch from 2.5.1-pre where I last used it was _not_ funny! :-), but I can handle that.

Well, there is *no question* you are capable to do this...

Quoted 3 lines

In addition, there are small buglet fixes in the patch that should go to general. I will extract these, I already send you one of these earlier today.

Yes I have noticed this as well. However let's wait and see whatever maybe I'm able to save you the trobule and pull them out myself. Your alpha patch is "interresting" enough to have me a walk over it line by line anyway :-).

I have to catch up with 2.5.8-pre2 anyway, since apparently this weekend was more about alcohol consumption for me then hacking...

author
#4 lore raw
In reply to Jens Axboe
Quoted 7 lines · Martin Dalecki
Quoted 5 lines

- Separate scatterlist and dma table out from hwgroup. This is not really needed for TCQ, but saves doing a blk_rq_map_sg on a request more than once. If future ATA hardware would support more than one pending DMA operation per hwgroup, this would be useful even without TCQ.

Agreed.

If we do this, we need to make a decision about how many segments to enable per command. As I stated, current is 32 which gives us (at least) 128kb per request. This is all we need right now, and I'm not too convinced that doing much larger requests with 48-bit lba will buys us _anything_ but bigger latency problems :-). This is just my speculation, I have no numbers to back this up so far. Now, with a 1kb fs we are limited to 32kb requests if we don't get good clustering. This might be a small performance hit, but if you are writing big blocks in a 1kb fs chances are good thaat you _will_ get good clustering (writing out the 4 consecutive buffer_heads stringed to the page) so I'm not convinced that this will be a problem either.

So I'd just stick with PRD_SEGMENTS at 32 so far. The over head of going to, eg, 64 would be 8 * 64 == 512 bytes per ata_request instead of the current 256 right now. Ok, that's not a lot, but still :-)

Quoted 10 lines
Quoted 6 lines

- Use ata_request_t as the main request command. This is where I really want to go. I'm not saying that we need a complete IDE mid layer, but a private request type is a nice way to unify the passing of a general command around. So the taskfile stuff would remain very low level, ata_request would add the higher level parts. I could expand lots more on this, but I'm quite sure you know where I'm going :-)

Well I can assure you that we are not dragging the towell in two different directions - please see for example my notes about the ata_taskfile function having too much parameters ;-).

ata_taskfile(drive, ar);

or something to that effect should be very possible, it just requires taking my generalization a bit further.

Quoted 3 lines
Quoted 1 line

Note that the ata_request_t usage is a bit messy in the current patch,

I noted it already ;-)

I didn't want ata_request_t changes to pollute the patch too much :-)

Quoted 7 lines
Quoted 3 lines

that's merely because I was more focused on getting TCQ stable than designing this out right now. So I think we should let it mature in the TCQ patch for just a while before making any final commitments. Agreed?

No problem with me. I will just pull out the generally good stuff out of it OK? I hope this will not make the tracking of the alpha patches too difficult for you...

Yes that's fine with me, and feel free to extend the ata_request stuff (and anything else). I'll adapt the tcq stuff and submit when ready.

Quoted 8 lines
Quoted 3 lines

In addition, there are small buglet fixes in the patch that should go to general. I will extract these, I already send you one of these earlier today.

Yes I have noticed this as well. However let's wait and see whatever maybe I'm able to save you the trobule and pull them out myself. Your alpha patch is "interresting" enough to have me a walk over it line by line anyway :-).

Alright, I'll let you ponder the stuff for a while and pull what you want.

Quoted 2 lines

I have to catch up with 2.5.8-pre2 anyway, since apparently this weekend was more about alcohol consumption for me then hacking...

Ahem, yes that part I know too :)

Signature · 1 line
Jens Axboe
#5 lore raw
In reply to Jens Axboe

It fails for the most part because there are (3) three holes in the state diagram. Intel works because the hardware is smart. Highpoint 366 works because of the host polling timer (will add soon in 2.4). The majority will fail because of the invalid state the drive leaves the host. Since the host does not receive proper notice of the command block execution as a direct result of the device failing to default to a fixed state, it becomes a mess. In short, until the intelligent host hardware hits the market, nobody supports Tagged Command Queue. The reason it is randomly supported by FreeBSD is because it uses the host hardware polling interrupt. Otherwise the overhead for spinning and chortling cpu clock cycles is a lark.

Well have fun but expect little success on most hardware.

Cheers,

Andre Hedrick
LAD Storage Consulting Group

Quoted 95 lines · Jens Axboe

Hi,

I've implemented tagged command queueing for ATA disk drives, and it's now ready for people to give it a test spin. As it has had only limited testing so far, please be very careful with it. It has been tested on two drives so far, a GXP75-30gb and a GXP120-40gb, and with a PIIX4 controller:

Intel Corp. 82371AB PIIX4 IDE: IDE controller on PCI slot 00:04.1 Intel Corp. 82371AB PIIX4 IDE: chipset revision 1
Intel Corp. 82371AB PIIX4 IDE: not 100% native mode: will probe irqs later
PIIX: Intel Corp. 82371AB PIIX4 IDE UDMA33 controller on pci00:04.1

    ide0: BM-DMA at 0xd800-0xd807, BIOS settings: hda:DMA, hdb:pio
    ide1: BM-DMA at 0xd808-0xd80f, BIOS settings: hdc:pio, hdd:pio

hda: IC35L040AVVA07-0, ATA DISK drive
hdc: IBM-DTLA-307030, ATA DISK drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: tagged command queueing enabled, command queue depth 32
hda: 80418240 sectors (41174 MB) w/1863KiB Cache, CHS=79780/16/63, UDMA(33)
hdc: tagged command queueing enabled, command queue depth 32
hdc: 60036480 sectors (30739 MB) w/1916KiB Cache, CHS=59560/16/63, UDMA(33)

I haven't patched hdparm to support enabling TCQ yet, so please use the 'TCQ on by default' option. If TCQ has been selected an enabled, there should be a 'tcq' file in the ide proc directory which will give you a bit of info about the current state of the drive:

bart:~ # cat /proc/ide/hdc/tcq

Max queue depth:        32
Max achieved depth:     23
Max depth since last:   16
Current depth:          10

ar dfd9e120 is tag 2
ar dfd9e360 is tag 3
ar dfd9e660 is tag 4
ar dfd9e5a0 is tag 5
ar dfd9e7e0 is tag 6
ar dfd9e600 is tag 7
ar dfd9e480 is tag 8
ar dfd9e2a0 is tag 9
ar dfd9e300 is tag 14
ar dfd9e720 is tag 15
hwgroup busy
dma busy
oldest command 5
immed rel 1153, immed comp 12370

As this is the first release, some of this info is a bit user-unfriendly. Let me explain the fields:

The first four are about the queue depth: maximum supported, maximum achieved during operations, maximum achieved since last cat of file, and the current depth at the time of the file cat. Then follows a listing of the requests in progress. Then some debug info about hwgroup and dma busy states, and oldest command (in jiffies) in the queue. The last line indicates the status of sent commands -- either they released the bus immediately (immed rel: data not ready, we can queue another), or the drive chose to fetch data immediately (immed comp, no bus release).

I could talk a bit about the IDE cores changes needed to make this happen (ata_request_t stuff), but I'm too lazy and will wait until people ask about it. Note that I'm no particular fan of hungarian notation either, but (again) due to laziness I've used that because it's easier on the typing fingers. Things are bound to change from this first alpha release anyways, so I'll just wait.

If you have a recent IBM Deskstar drive (these are the only ones that support TCQ current, to my knowledge), I would appreciate if you could give it a spin and report success and failure to me.

Random notes:

- For this release, only a single drive on a channel has been tested. So don't bother filing bug reports if you don't have a similar setup in that regard.
- Interrupt handler timer needs to be changed to be per-ata_request, not per hwgroup.
- General ata_request stuff isn't design complete yet, this could be taken much further.
- Due to memory consumption friendliness, block queues are configured for a maximum of 32 segments at this time. This is still enough to achieve the full 128kb for a dma request that we support anyways (modulo 48-bit lba, doesn't matter).
- TCQ can't be supported on Promise controllers at all, it intercepts interrupts so we don't see them.
- Backing off TCQ in case of failure is untested.
- ide.h TCQ stuff needs some cleaning

That said, please give it a go if you can! Patch is against 2.5.8-pre2.

Signature · 1 line
Jens Axboe