linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] AHCI prefetch
@ 2006-03-04 17:35 Jeff Garzik
  2006-03-10  4:37 ` Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2006-03-04 17:35 UTC (permalink / raw)
  To: linux-ide; +Cc: linux-kernel


This patch has been sitting in my tmp directory for ages.

We should probably turn this on, though the practical difference is
probably minimal.


diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 4e96ec5..973a794 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -64,8 +64,10 @@ enum {
 	AHCI_PORT_PRIV_DMA_SZ	= AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ +
 				  AHCI_RX_FIS_SZ,
 	AHCI_IRQ_ON_SG		= (1 << 31),
+
 	AHCI_CMD_ATAPI		= (1 << 5),
 	AHCI_CMD_WRITE		= (1 << 6),
+	AHCI_CMD_PREFETCH	= (1 << 7),
 
 	RX_FIS_D2H_REG		= 0x40,	/* offset of D2H Register FIS data */
 
@@ -533,7 +535,7 @@ static void ahci_qc_prep(struct ata_queu
 	if (qc->tf.flags & ATA_TFLAG_WRITE)
 		opts |= AHCI_CMD_WRITE;
 	if (is_atapi_taskfile(&qc->tf))
-		opts |= AHCI_CMD_ATAPI;
+		opts |= AHCI_CMD_ATAPI | AHCI_CMD_PREFETCH;
 
 	pp->cmd_slot[0].opts = cpu_to_le32(opts);
 	pp->cmd_slot[0].status = 0;

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

* Re: [PATCH] AHCI prefetch
  2006-03-04 17:35 [PATCH] AHCI prefetch Jeff Garzik
@ 2006-03-10  4:37 ` Tejun Heo
  2006-03-12  0:32   ` Jeff Garzik
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2006-03-10  4:37 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, linux-kernel

On Sat, Mar 04, 2006 at 12:35:05PM -0500, Jeff Garzik wrote:
> 
> This patch has been sitting in my tmp directory for ages.
> 
> We should probably turn this on, though the practical difference is
> probably minimal.
> 

The patch works okay on my machine (ICH7R) although the patch didn't
apply to #upstream.  I'm not very sure about this change though.

1. Why apply it only to ATAPI devices?  ATA devices can benefit to.
   If it's because this bit shouldn't be turned on for NCQ, we can
   turn it on conditionally.  We'll probably need similar condition
   for ATAPI devices too if we support FIS-based PM switching.

2. I'm a bit skeptical whether this change will bring any noticeable
   performance improvement.  OTOH, this seems to be a good source for
   obscure problems on some controllers which might not implement/test
   this feature properly.  As more controllers implement AHCI spec,
   the possibility grows.

Anyways, here's the patch regenerated against #upstream.

diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 1c2ab3d..cfa6eaf 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -66,6 +66,7 @@ enum {
 	AHCI_IRQ_ON_SG		= (1 << 31),
 	AHCI_CMD_ATAPI		= (1 << 5),
 	AHCI_CMD_WRITE		= (1 << 6),
+	AHCI_CMD_PREFETCH	= (1 << 7),
 	AHCI_CMD_RESET		= (1 << 8),
 	AHCI_CMD_CLR_BUSY	= (1 << 10),
 
@@ -631,7 +632,7 @@ static void ahci_qc_prep(struct ata_queu
 	if (qc->tf.flags & ATA_TFLAG_WRITE)
 		opts |= AHCI_CMD_WRITE;
 	if (is_atapi)
-		opts |= AHCI_CMD_ATAPI;
+		opts |= AHCI_CMD_ATAPI | AHCI_CMD_PREFETCH;
 
 	ahci_fill_cmd_slot(pp, opts);
 }

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

* Re: [PATCH] AHCI prefetch
  2006-03-10  4:37 ` Tejun Heo
@ 2006-03-12  0:32   ` Jeff Garzik
  2006-03-12  2:25     ` [PATCH] ahci: enable prefetching for PACKET commands Tejun Heo
  2006-03-12  2:30     ` [PATCH] ahci: enable prefetching Tejun Heo
  0 siblings, 2 replies; 5+ messages in thread
From: Jeff Garzik @ 2006-03-12  0:32 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, linux-kernel

Tejun Heo wrote:
> On Sat, Mar 04, 2006 at 12:35:05PM -0500, Jeff Garzik wrote:
> 
>>This patch has been sitting in my tmp directory for ages.
>>
>>We should probably turn this on, though the practical difference is
>>probably minimal.
>>
> 
> 
> The patch works okay on my machine (ICH7R) although the patch didn't
> apply to #upstream.  I'm not very sure about this change though.
> 
> 1. Why apply it only to ATAPI devices?  ATA devices can benefit to.
>    If it's because this bit shouldn't be turned on for NCQ, we can
>    turn it on conditionally.  We'll probably need similar condition
>    for ATAPI devices too if we support FIS-based PM switching.

Main reason is that it will largely only have benefits on ATAPI devices, 
and I've only tested it on ATAPI devices.


> 2. I'm a bit skeptical whether this change will bring any noticeable
>    performance improvement.  OTOH, this seems to be a good source for

Agreed.


>    obscure problems on some controllers which might not implement/test
>    this feature properly.  As more controllers implement AHCI spec,
>    the possibility grows.

Agreed.


> Anyways, here's the patch regenerated against #upstream.

Could I trouble you for a resend, with a proper signed-off-by and patch 
description?

	Jeff




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

* [PATCH] ahci: enable prefetching for PACKET commands
  2006-03-12  0:32   ` Jeff Garzik
@ 2006-03-12  2:25     ` Tejun Heo
  2006-03-12  2:30     ` [PATCH] ahci: enable prefetching Tejun Heo
  1 sibling, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2006-03-12  2:25 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, linux-kernel

Turn on AHCI_CMD_PREFETCH for PACKET commands.  This hints the
controller that it can prefetch the CDB and the PRD entries.  This
patch is originally from Jeff Garzik.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

Jeff, I'll send two flavors of this patch.  The other one will enable
AHCI_CMD_PREFETCH for both ATA and ATAPI devices.  I've tested both
cases on ICH7R.

 ahci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 00dfdef..e97ab3e 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -66,6 +66,7 @@ enum {
 	AHCI_IRQ_ON_SG		= (1 << 31),
 	AHCI_CMD_ATAPI		= (1 << 5),
 	AHCI_CMD_WRITE		= (1 << 6),
+	AHCI_CMD_PREFETCH	= (1 << 7),
 	AHCI_CMD_RESET		= (1 << 8),
 	AHCI_CMD_CLR_BUSY	= (1 << 10),
 
@@ -631,7 +632,7 @@ static void ahci_qc_prep(struct ata_queu
 	if (qc->tf.flags & ATA_TFLAG_WRITE)
 		opts |= AHCI_CMD_WRITE;
 	if (is_atapi)
-		opts |= AHCI_CMD_ATAPI;
+		opts |= AHCI_CMD_ATAPI | AHCI_CMD_PREFETCH;
 
 	ahci_fill_cmd_slot(pp, opts);
 }

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

* [PATCH] ahci: enable prefetching
  2006-03-12  0:32   ` Jeff Garzik
  2006-03-12  2:25     ` [PATCH] ahci: enable prefetching for PACKET commands Tejun Heo
@ 2006-03-12  2:30     ` Tejun Heo
  1 sibling, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2006-03-12  2:30 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, linux-kernel

Enable prefetching.  This hints AHCI controller that it can prefetch
PRT entries and CDB (for PACKET commands).  This is a hint.  AHCI
controller is free to ignore it or prefetch regardless of this bit.

Note that prefetching bit should be turned off for NCQ commands or
FIS-based switching PM support.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

And this is the second version.

 ahci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 00dfdef..454a393 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -66,6 +66,7 @@ enum {
 	AHCI_IRQ_ON_SG		= (1 << 31),
 	AHCI_CMD_ATAPI		= (1 << 5),
 	AHCI_CMD_WRITE		= (1 << 6),
+	AHCI_CMD_PREFETCH	= (1 << 7),
 	AHCI_CMD_RESET		= (1 << 8),
 	AHCI_CMD_CLR_BUSY	= (1 << 10),
 
@@ -627,7 +628,7 @@ static void ahci_qc_prep(struct ata_queu
 	/*
 	 * Fill in command slot information.
 	 */
-	opts = cmd_fis_len | n_elem << 16;
+	opts = AHCI_CMD_PREFETCH | cmd_fis_len | n_elem << 16;
 	if (qc->tf.flags & ATA_TFLAG_WRITE)
 		opts |= AHCI_CMD_WRITE;
 	if (is_atapi)

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

end of thread, other threads:[~2006-03-12  2:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-04 17:35 [PATCH] AHCI prefetch Jeff Garzik
2006-03-10  4:37 ` Tejun Heo
2006-03-12  0:32   ` Jeff Garzik
2006-03-12  2:25     ` [PATCH] ahci: enable prefetching for PACKET commands Tejun Heo
2006-03-12  2:30     ` [PATCH] ahci: enable prefetching Tejun Heo

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).