Patchwork [RFC,3/5] libsas: dynamic queue depth

login
register
mail settings
Submitter Dan Williams
Date Sept. 20, 2011, 10:10 p.m.
Message ID <20110920221038.1094.7832.stgit@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/115636/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Dan Williams - Sept. 20, 2011, 10:10 p.m.
The queue-depth for libsas-attached devices initializes to 32 and can
only be increased manually via sysfs to a max of 64, while mpt2sas
attached devices initialize to 254 and dynamically float via the
midlayer ->change_queue_depth interface.

No performance regression was observed with this change on the isci
driver.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Mark Salyzyn <msalyzyn@us.xyratex.com>
Cc: Xiangliang Yu <yuxiangl@marvell.com>
Cc: Jack Wang <jack_wang@usish.com>
Cc: Mark Salyzyn <msalyzyn@us.xyratex.com>
Cc: Luben Tuikov <ltuikov@yahoo.com>
Tested-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/libsas/sas_scsi_host.c |   39 ++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 21 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig - Sept. 20, 2011, 10:18 p.m.
On Tue, Sep 20, 2011 at 03:10:46PM -0700, Dan Williams wrote:
> The queue-depth for libsas-attached devices initializes to 32 and can
> only be increased manually via sysfs to a max of 64, while mpt2sas
> attached devices initialize to 254 and dynamically float via the
> midlayer ->change_queue_depth interface.
> 
> No performance regression was observed with this change on the isci
> driver.

Looks reasonable to me.

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jack Wang - Sept. 21, 2011, 1:17 a.m.
I suppose to prepare a similar patch, thanks for ding this.
 [RFC PATCH 3/5] libsas: dynamic queue depth
> 
> The queue-depth for libsas-attached devices initializes to 32 and can
> only be increased manually via sysfs to a max of 64, while mpt2sas
> attached devices initialize to 254 and dynamically float via the
> midlayer ->change_queue_depth interface.
> 
> No performance regression was observed with this change on the isci
> driver.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Mark Salyzyn <msalyzyn@us.xyratex.com>
> Cc: Xiangliang Yu <yuxiangl@marvell.com>
> Cc: Jack Wang <jack_wang@usish.com>
> Cc: Mark Salyzyn <msalyzyn@us.xyratex.com>
> Cc: Luben Tuikov <ltuikov@yahoo.com>
> Tested-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/scsi/libsas/sas_scsi_host.c |   39
> ++++++++++++++++-------------------
>  1 files changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_scsi_host.c
> b/drivers/scsi/libsas/sas_scsi_host.c
> index 4c6923c..fe08ef0 100644
> --- a/drivers/scsi/libsas/sas_scsi_host.c
> +++ b/drivers/scsi/libsas/sas_scsi_host.c
> @@ -784,8 +784,7 @@ int sas_target_alloc(struct scsi_target *starget)
>  	return 0;
>  }
> 
> -#define SAS_DEF_QD 32
> -#define SAS_MAX_QD 64
> +#define SAS_DEF_QD 256
> 
>  int sas_slave_configure(struct scsi_device *scsi_dev)
>  {
> @@ -828,31 +827,29 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)
>  		dev->sata_dev.ap->link.device[0].class = ATA_DEV_NONE;
>  }
> 
> -int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth,
> -			   int reason)
> +int sas_change_queue_depth(struct scsi_device *sdev, int depth, int
reason)
>  {
> -	struct domain_device *dev = sdev_to_domain_dev(scsi_dev);
> -	int res = min(new_depth, SAS_MAX_QD);
> +	struct domain_device *dev = sdev_to_domain_dev(sdev);
> 
>  	if (dev_is_sata(dev))
> -		return __ata_change_queue_depth(dev->sata_dev.ap, scsi_dev,
> -						new_depth, reason);
> -
> -	if (reason != SCSI_QDEPTH_DEFAULT)
> +		return __ata_change_queue_depth(dev->sata_dev.ap, sdev,
depth,
> +						reason);
> +
> +	switch (reason) {
> +	case SCSI_QDEPTH_DEFAULT:
> +	case SCSI_QDEPTH_RAMP_UP:
> +		if (!sdev->tagged_supported)
> +			depth = 1;
> +		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
depth);
> +		break;
> +	case SCSI_QDEPTH_QFULL:
> +		scsi_track_queue_full(sdev, depth);
> +		break;
> +	default:
>  		return -EOPNOTSUPP;
> -
> -	if (scsi_dev->tagged_supported)
> -		scsi_adjust_queue_depth(scsi_dev,
scsi_get_tag_type(scsi_dev),
> -					res);
> -	else {
> -		sas_printk("device %llx LUN %x queue depth changed to 1\n",
> -			   SAS_ADDR(dev->sas_addr),
> -			   scsi_dev->lun);
> -		scsi_adjust_queue_depth(scsi_dev, 0, 1);
> -		res = 1;
>  	}
> 
> -	return res;
> +	return depth;
>  }
> 
>  int sas_change_queue_type(struct scsi_device *scsi_dev, int qt)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 4c6923c..fe08ef0 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -784,8 +784,7 @@  int sas_target_alloc(struct scsi_target *starget)
 	return 0;
 }
 
-#define SAS_DEF_QD 32
-#define SAS_MAX_QD 64
+#define SAS_DEF_QD 256
 
 int sas_slave_configure(struct scsi_device *scsi_dev)
 {
@@ -828,31 +827,29 @@  void sas_slave_destroy(struct scsi_device *scsi_dev)
 		dev->sata_dev.ap->link.device[0].class = ATA_DEV_NONE;
 }
 
-int sas_change_queue_depth(struct scsi_device *scsi_dev, int new_depth,
-			   int reason)
+int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
 {
-	struct domain_device *dev = sdev_to_domain_dev(scsi_dev);
-	int res = min(new_depth, SAS_MAX_QD);
+	struct domain_device *dev = sdev_to_domain_dev(sdev);
 
 	if (dev_is_sata(dev))
-		return __ata_change_queue_depth(dev->sata_dev.ap, scsi_dev,
-						new_depth, reason);
-
-	if (reason != SCSI_QDEPTH_DEFAULT)
+		return __ata_change_queue_depth(dev->sata_dev.ap, sdev, depth,
+						reason);
+
+	switch (reason) {
+	case SCSI_QDEPTH_DEFAULT:
+	case SCSI_QDEPTH_RAMP_UP:
+		if (!sdev->tagged_supported)
+			depth = 1;
+		scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
+		break;
+	case SCSI_QDEPTH_QFULL:
+		scsi_track_queue_full(sdev, depth);
+		break;
+	default:
 		return -EOPNOTSUPP;
-
-	if (scsi_dev->tagged_supported)
-		scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev),
-					res);
-	else {
-		sas_printk("device %llx LUN %x queue depth changed to 1\n",
-			   SAS_ADDR(dev->sas_addr),
-			   scsi_dev->lun);
-		scsi_adjust_queue_depth(scsi_dev, 0, 1);
-		res = 1;
 	}
 
-	return res;
+	return depth;
 }
 
 int sas_change_queue_type(struct scsi_device *scsi_dev, int qt)