RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
cover RFC: handle queue_depth adjustments because of QUEUE_FULLs in scsi_error.c
First four patches are from Mike Christie's original RFC at:-
http://www.spinics.net/lists/linux-scsi/msg35959.html
http://www.spinics.net/lists/linux-scsi/msg35962.html
http://www.spinics.net/lists/linux-scsi/msg35961.html
http://www.spinics.net/lists/linux-scsi/msg35963.html
http://www.spinics.net/lists/linux-scsi/msg35964.html
Above four patches adds ramp down code and I appended ramp up code in following patches and tested this entire series with libfc/fcoe. This series works fine without any regression and also queue_depth adjustment works for both ramp down and ramp up.
Above patches are updated to scsi-misc -rc7 plus recently submitted 64 fcoe patches series by Rob
"[PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc" This series also applies cleanly to scsi-misc -rc7.
I'd appreciate review comments for added more patches for ramp up.
I'll post my final patches to this list skipping fcoe list, this as per Rob Love suggestion since mostly scsi changes by this series beyond fcoe/libfc. However Rob agreed to review/Ack fcoe/libfc changes at this list.
Mike, I'll be able to post my ramp up patches only once you send final patches for ramp down on which my patches depends. As I said your patches are tested for libfc, so most common code is already tested and they are good go as far as libfc goes.
---
Mike Christie (4):
drivers: convert fc drivers calling scsi_track_queue_full
drivers: convert drivers setting the change_queue_depth callback scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
scsi-ml: modify change_queue_depth to take in reason why it is being called
Vasu Dev (5):
libfc: adds queue_depth ramp up to libfc
fcoe, libfc: fix an libfc issue with queue ramp down in libfc
scsi: add common queue_depth ramp up code
scsi: adds sdev->queue_ramp_up_period to sysfs
scsi: updates sdev to add queue_depth ramp up code
drivers/ata/libata-scsi.c | 6 ++- drivers/ata/sata_nv.c | 2 - drivers/message/fusion/mptscsih.c | 8 +++- drivers/message/fusion/mptscsih.h | 3 + drivers/scsi/3w-9xxx.c | 5 ++ drivers/scsi/3w-xxxx.c | 5 ++ drivers/scsi/53c700.c | 5 ++ drivers/scsi/aacraid/linit.c | 6 ++- drivers/scsi/arcmsr/arcmsr_hba.c | 5 ++ drivers/scsi/fcoe/fcoe.c | 2 - drivers/scsi/hptiop.c | 5 ++ drivers/scsi/ibmvscsi/ibmvfc.c | 7 +++ drivers/scsi/ibmvscsi/ibmvscsi.c | 7 +++ drivers/scsi/ipr.c | 7 +++ drivers/scsi/libfc/fc_fcp.c | 47 ++++++++++----------- drivers/scsi/libsas/sas_scsi_host.c | 6 ++- drivers/scsi/lpfc/lpfc_scsi.c | 75 ++++++++++++++++++--------------- drivers/scsi/megaraid/megaraid_mbox.c | 7 +++ drivers/scsi/mpt2sas/mpt2sas_scsih.c | 10 +++- drivers/scsi/qla2xxx/qla_isr.c | 32 -------------- drivers/scsi/qla2xxx/qla_os.c | 32 +++++++++++++- drivers/scsi/scsi.c | 10 ++++ drivers/scsi/scsi_error.c | 64 ++++++++++++++++++++++++++++ drivers/scsi/scsi_scan.c | 1 drivers/scsi/scsi_sysfs.c | 41 +++++++++++++++++- include/linux/libata.h | 2 - include/scsi/libfc.h | 2 - include/scsi/libsas.h | 3 + include/scsi/scsi_device.h | 8 ++-- include/scsi/scsi_host.h | 9 ++++ 30 files changed, 295 insertions(+), 127 deletions(-)
Signature · 1 line
Signature
RFC PATCH 1/9 scsi-ml: modify change_queue_depth to take in reason why it is being called
From: Mike Christie <[email protected]>
This patch modifies scsi_host_tematepl->change_queue_depth so that it takes an argument indicating why it is being called. This will be used so that if a LLD needs to do some extra processing when handling queue fulls or later ramp ups, it can do so.
To simplify the review, this patch only modifies scsi-ml. The next patches will convert each driver.
---
drivers/scsi/scsi_sysfs.c | 3 ++- include/scsi/scsi_host.h | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/scsi_sysfs.c +2 -1
@@ -766,7 +766,8 @@ sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,if (depth <1 )return -EINVAL ; - retval = sht->change_queue_depth (sdev, depth); + retval = sht->change_queue_depth (sdev, depth, +SCSI_QDEPTH_SYSFS_REQ );if (retval <0 )return retval;
include/scsi/scsi_host.h +8 -1
@@ -43,6 +43,13 @@ struct blk_queue_tags;#define DISABLE_CLUSTERING 0#define ENABLE_CLUSTERING 1 +enum { +SCSI_QDEPTH_SYSFS_REQ ,/* user requested change through sysfs */ +SCSI_QDEPTH_QFULL ,/* scsi-ml requested due to queue full */ +SCSI_QDEPTH_RAMP_UP ,/* scsi-ml requested due to threshhold event */ +SCSI_QDEPTH_RAMP_DOWN ,/* LLD/class requested due to lld/class event */ +}; +struct scsi_host_template {struct module *module;const char *name;
@@ -294,7 +301,7 @@ struct scsi_host_template {* * Status: OPTIONAL */ -int (* change_queue_depth)(struct scsi_device *,int ); +int (* change_queue_depth)(struct scsi_device *,int ,int );/* * Fill in this function to allow the changing of tag types
Re: [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called
Quoted 6 lines · Vasu Dev
include/scsi/scsi_host.h +0
-0@@ -43,6 +43,13 @@ struct blk_queue_tags;#define DISABLE_CLUSTERING 0#define ENABLE_CLUSTERING 1
include/scsi/scsi_host.h struct blk_queue_tags; · line 55
Quoted 10 lines
include/scsi/scsi_host.h +7
-0+enum { +SCSI_QDEPTH_SYSFS_REQ ,/* user requested change through sysfs */ +SCSI_QDEPTH_QFULL ,/* scsi-ml requested due to queue full */ +SCSI_QDEPTH_RAMP_UP ,/* scsi-ml requested due to threshhold event */ +SCSI_QDEPTH_RAMP_DOWN ,/* LLD/class requested due to lld/class event */ +}; +struct scsi_host_template {struct module *module;const char *name;
I did not find SCSI_QDEPTH_RAMP_DOWN being used. Would a LLD use this internally when changing the queue depth?
--
Christof Schmitt
Re: [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called
Quoted 7 lines · Christof Schmitt
Quoted 6 lines · Vasu Dev
include/scsi/scsi_host.h +0
-0@@ -43,6 +43,13 @@ struct blk_queue_tags;#define DISABLE_CLUSTERING 0#define ENABLE_CLUSTERING 1
Quoted 14 lines
include/scsi/scsi_host.h struct blk_queue_tags; · line 55
Quoted 10 lines
include/scsi/scsi_host.h +7
-0+enum { +SCSI_QDEPTH_SYSFS_REQ ,/* user requested change through sysfs */ +SCSI_QDEPTH_QFULL ,/* scsi-ml requested due to queue full */ +SCSI_QDEPTH_RAMP_UP ,/* scsi-ml requested due to threshhold event */ +SCSI_QDEPTH_RAMP_DOWN ,/* LLD/class requested due to lld/class event */ +}; +struct scsi_host_template {struct module *module;const char *name;I did not find
SCSI_QDEPTH_RAMP_DOWNbeing used. Would a LLD use this internally when changing the queue depth?
Yes it is not used, should be removed before final patches unless Mike have plan to use this reason code.
Vasu
Re: [RFC PATCH 1/9] scsi-ml: modify change_queue_depth to take in reason why it is being called
Quoted 22 lines · Vasu Dev
Quoted 7 lines · Christof Schmitt
Quoted 6 lines · Vasu Dev
include/scsi/scsi_host.h +0
-0@@ -43,6 +43,13 @@ struct blk_queue_tags;#define DISABLE_CLUSTERING 0#define ENABLE_CLUSTERING 1Quoted 13 lines
include/scsi/scsi_host.h struct blk_queue_tags; · line 55
Quoted 10 lines
include/scsi/scsi_host.h +7
-0+enum { +SCSI_QDEPTH_SYSFS_REQ ,/* user requested change through sysfs */ +SCSI_QDEPTH_QFULL ,/* scsi-ml requested due to queue full */ +SCSI_QDEPTH_RAMP_UP ,/* scsi-ml requested due to threshhold event */ +SCSI_QDEPTH_RAMP_DOWN ,/* LLD/class requested due to lld/class event */ +}; +struct scsi_host_template {struct module *module;const char *name;I did not find
SCSI_QDEPTH_RAMP_DOWNbeing used. Would a LLD use this internally when changing the queue depth?
Quoted 3 lines
Yes it is not used, should be removed before final patches unless Mike have plan to use this reason code.
It might have been a goof up on my part. It is not needed.
RFC PATCH 2/9 scsi error: have scsi-ml call change_queue_depth to handle QUEUE_FULL
In reply to Vasu DevFrom: Mike Christie <[email protected]>
This has scsi-ml call the change_queue_depth functions when we get a QUEUE_FULL. It will only change the queue depth if change_queue_depth is set because the LLD may have to modify some internal resources, so I thought this would be the safest route.
---
drivers/scsi/scsi_error.c | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)
drivers/scsi/scsi_error.c +25 -1
@@ -331,6 +331,27 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) } } +static void scsi_handle_queue_full (struct scsi_device *sdev) +{ +struct scsi_host_template *sht = sdev->host->hostt; +struct scsi_device *tmp_sdev; + +if (!sht->change_queue_depth) +return ; + +shost_for_each_device (tmp_sdev, sdev->host) { +if (tmp_sdev->id != sdev->id) +continue ; +/* +* We do not know the number of commands that were at +* the device when we got the queue full so we start +* from the highest possible value and work our way down. +*/ + sht->change_queue_depth (tmp_sdev, tmp_sdev->queue_depth -1 , +SCSI_QDEPTH_QFULL ); + } +} +/** * scsi_eh_completed_normally - Disposition a eh cmd on return from LLD. * @scmd: SCSI cmd to examine.
@@ -387,8 +408,10 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)* let issuer deal with this, it could be just fine */ return SUCCESS ; -case BUSY :case QUEUE_FULL : +scsi_handle_queue_full (scmd->device); +/* fall through */ +case BUSY :default :return FAILED ; }
@@ -1384,6 +1407,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)*/ switch (status_byte (scmd->result)) {case QUEUE_FULL : +scsi_handle_queue_full (scmd->device);/* * the case of trying to send too many commands to a * tagged queueing device.
RFC PATCH 3/9 drivers: convert drivers setting the change_queue_depth callback
In reply to Vasu DevFrom: Mike Christie <[email protected]>
This is a simple port of the drivers setting a change_queue_depth callback but were not tracking queue fulls. In the patch I just have these LLDs adjust the queue depth if the user was requesting it.
Patch is only compile tested.
---
drivers/ata/libata-scsi.c | 6 +++++- drivers/ata/sata_nv.c | 2 +- drivers/message/fusion/mptscsih.c | 8 ++++++-- drivers/message/fusion/mptscsih.h | 3 ++- drivers/scsi/3w-9xxx.c | 5 ++++- drivers/scsi/3w-xxxx.c | 5 ++++- drivers/scsi/53c700.c | 5 ++++- drivers/scsi/aacraid/linit.c | 6 +++++- drivers/scsi/arcmsr/arcmsr_hba.c | 5 ++++- drivers/scsi/hptiop.c | 5 ++++- drivers/scsi/ibmvscsi/ibmvfc.c | 7 ++++++- drivers/scsi/ibmvscsi/ibmvscsi.c | 7 ++++++- drivers/scsi/ipr.c | 7 ++++++- drivers/scsi/libsas/sas_scsi_host.c | 6 +++++- drivers/scsi/megaraid/megaraid_mbox.c | 7 ++++++- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 10 +++++++--- include/linux/libata.h | 2 +- include/scsi/libsas.h | 3 ++- 18 files changed, 78 insertions(+), 21 deletions(-)
drivers/ata/libata-scsi.c +5 -1
@@ -1223,12 +1223,16 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)* RETURNS: * Newly configured queue depth. */ -int ata_scsi_change_queue_depth (struct scsi_device *sdev,int queue_depth) +int ata_scsi_change_queue_depth (struct scsi_device *sdev,int queue_depth, +int reason) {struct ata_port *ap =ata_shost_to_port (sdev->host);struct ata_device *dev;unsigned long flags; +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (queue_depth <1 || queue_depth == sdev->queue_depth)return sdev->queue_depth;
drivers/ata/sata_nv.c +1 -1
@@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)ata_id_c_string (dev->id, model_num,ATA_ID_PROD ,sizeof (model_num));if (strncmp (model_num,"Maxtor" ,6 ) ==0 ) { -ata_scsi_change_queue_depth (sdev,1 ); +ata_scsi_change_queue_depth (sdev,1 ,SCSI_QDEPTH_SYSFS_REQ );ata_dev_printk (dev,KERN_NOTICE ,"Disabling SWNCQ mode (depth %x)\n" , sdev->queue_depth); }
drivers/message/fusion/mptscsih.c +6 -2
@@ -2269,7 +2269,7 @@ mptscsih_slave_destroy(struct scsi_device *sdev)* Adding support for new 'change_queue_depth' api. */ int -mptscsih_change_queue_depth (struct scsi_device *sdev,int qdepth) +mptscsih_change_queue_depth (struct scsi_device *sdev,int qdepth,int reason) {MPT_SCSI_HOST *hd =shost_priv (sdev->host);VirtTarget *vtarget;
@@ -2281,6 +2281,9 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth) starget =scsi_target (sdev); vtarget = starget->hostdata; +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (ioc->bus_type ==SPI ) {if (!(vtarget->tflags &MPT_TARGET_FLAGS_Q_YES )) max_depth =1 ;
@@ -2347,7 +2350,8 @@ mptscsih_slave_configure(struct scsi_device *sdev) ioc->name, vtarget->negoFlags, vtarget->maxOffset, vtarget->minSyncFactor)); -mptscsih_change_queue_depth (sdev,MPT_SCSI_CMD_PER_DEV_HIGH ); +mptscsih_change_queue_depth (sdev,MPT_SCSI_CMD_PER_DEV_HIGH , +SCSI_QDEPTH_SYSFS_REQ ); dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "tagged %d, simple %d, ordered %d\n", ioc->name,sdev->tagged_supported, sdev->simple_tags,
drivers/message/fusion/mptscsih.h +2 -1
@@ -128,7 +128,8 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_Fextern int mptscsih_scandv_complete (MPT_ADAPTER *ioc,MPT_FRAME_HDR *mf,MPT_FRAME_HDR *r);extern int mptscsih_event_process (MPT_ADAPTER *ioc,EventNotificationReply_t *pEvReply);extern int mptscsih_ioc_reset (MPT_ADAPTER *ioc,int post_reset); -extern int mptscsih_change_queue_depth (struct scsi_device *sdev,int qdepth); +extern int mptscsih_change_queue_depth (struct scsi_device *sdev,int qdepth, +int reason);extern u8 mptscsih_raid_id_to_num (MPT_ADAPTER *ioc,u8 channel,u8 id);extern int mptscsih_is_phys_disk (MPT_ADAPTER *ioc,u8 channel,u8 id);extern struct device_attribute *mptscsih_host_attrs[];
drivers/scsi/3w-9xxx.c +4 -1
@@ -186,8 +186,11 @@ static ssize_t twa_show_stats(struct device *dev, }/* End twa_show_stats() */ /* This function will set a devices queue depth */ -static int twa_change_queue_depth (struct scsi_device *sdev,int queue_depth) +static int twa_change_queue_depth (struct scsi_device *sdev,int queue_depth, +int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ;if (queue_depth >TW_Q_LENGTH -2 ) queue_depth =TW_Q_LENGTH -2 ;scsi_adjust_queue_depth (sdev,MSG_ORDERED_TAG , queue_depth);
drivers/scsi/3w-xxxx.c +4 -1
@@ -521,8 +521,11 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr, }/* End tw_show_stats() */ /* This function will set a devices queue depth */ -static int tw_change_queue_depth (struct scsi_device *sdev,int queue_depth) +static int tw_change_queue_depth (struct scsi_device *sdev,int queue_depth, +int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ;if (queue_depth >TW_Q_LENGTH -2 ) queue_depth =TW_Q_LENGTH -2 ;scsi_adjust_queue_depth (sdev,MSG_ORDERED_TAG , queue_depth);
drivers/scsi/53c700.c +4 -1
@@ -2082,8 +2082,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp) }static int -NCR_700_change_queue_depth (struct scsi_device *SDp,int depth) +NCR_700_change_queue_depth (struct scsi_device *SDp,int depth,int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (depth >NCR_700_MAX_TAGS ) depth =NCR_700_MAX_TAGS ;
drivers/scsi/aacraid/linit.c +5 -1
@@ -472,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev)* total capacity and the queue depth supported by the target device. */ -static int aac_change_queue_depth (struct scsi_device *sdev,int depth) +static int aac_change_queue_depth (struct scsi_device *sdev,int depth, +int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (sdev->tagged_supported && (sdev->type ==TYPE_DISK ) && (sdev_channel (sdev) ==CONTAINER_CHANNEL )) {struct scsi_device * dev;
drivers/scsi/arcmsr/arcmsr_hba.c +4 -1
@@ -98,8 +98,11 @@ static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);static const char *arcmsr_info (struct Scsi_Host *);static irqreturn_t arcmsr_interrupt (struct AdapterControlBlock *acb);static int arcmsr_adjust_disk_queue_depth (struct scsi_device *sdev, -int queue_depth) +int queue_depth,int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (queue_depth >ARCMSR_MAX_CMD_PERLUN ) queue_depth =ARCMSR_MAX_CMD_PERLUN ;scsi_adjust_queue_depth (sdev,MSG_ORDERED_TAG , queue_depth);
drivers/scsi/hptiop.c +4 -1
@@ -847,10 +847,13 @@ static int hptiop_reset(struct scsi_cmnd *scp) }static int hptiop_adjust_disk_queue_depth (struct scsi_device *sdev, -int queue_depth) +int queue_depth,int reason) {struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata; +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (queue_depth > hba->max_requests) queue_depth = hba->max_requests;scsi_adjust_queue_depth (sdev,MSG_ORDERED_TAG , queue_depth);
drivers/scsi/ibmvscsi/ibmvfc.c +6 -1
@@ -2478,12 +2478,17 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)* ibmvfc_change_queue_depth - Change the device's queue depth * @sdev: scsi device struct * @qdepth: depth to set +* @reason: calling context * * Return value: * actual depth set **/ -static int ibmvfc_change_queue_depth (struct scsi_device *sdev,int qdepth) +static int ibmvfc_change_queue_depth (struct scsi_device *sdev,int qdepth, +int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (qdepth >IBMVFC_MAX_CMDS_PER_LUN ) qdepth =IBMVFC_MAX_CMDS_PER_LUN ;
drivers/scsi/ibmvscsi/ibmvscsi.c +6 -1
@@ -1638,12 +1638,17 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)* ibmvscsi_change_queue_depth - Change the device's queue depth * @sdev: scsi device struct * @qdepth: depth to set +* @reason: calling context * * Return value: * actual depth set **/ -static int ibmvscsi_change_queue_depth (struct scsi_device *sdev,int qdepth) +static int ibmvscsi_change_queue_depth (struct scsi_device *sdev,int qdepth, +int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (qdepth >IBMVSCSI_MAX_CMDS_PER_LUN ) qdepth =IBMVSCSI_MAX_CMDS_PER_LUN ;
drivers/scsi/ipr.c +6 -1
@@ -3367,16 +3367,21 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; };* ipr_change_queue_depth - Change the device's queue depth * @sdev: scsi device struct * @qdepth: depth to set +* @reason: calling context * * Return value: * actual depth set **/ -static int ipr_change_queue_depth (struct scsi_device *sdev,int qdepth) +static int ipr_change_queue_depth (struct scsi_device *sdev,int qdepth, +int reason) {struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;struct ipr_resource_entry *res;unsigned long lock_flags =0 ; +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +spin_lock_irqsave (ioa_cfg->host->host_lock, lock_flags); res = (struct ipr_resource_entry *)sdev->hostdata;
drivers/scsi/libsas/sas_scsi_host.c +5 -1
@@ -820,10 +820,14 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)ata_port_disable (dev->sata_dev.ap); } -int sas_change_queue_depth (struct scsi_device *scsi_dev,int new_depth) +int sas_change_queue_depth (struct scsi_device *scsi_dev,int new_depth, +int reason) {int res =min (new_depth,SAS_MAX_QD ); +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (scsi_dev->tagged_supported)scsi_adjust_queue_depth (scsi_dev,scsi_get_tag_type (scsi_dev), res);
drivers/scsi/megaraid/megaraid_mbox.c +6 -1
@@ -335,12 +335,17 @@ static struct device_attribute *megaraid_sdev_attrs[] = {* megaraid_change_queue_depth - Change the device's queue depth * @sdev: scsi device struct * @qdepth: depth to set +* @reason: calling context * * Return value: * actual depth set */ -static int megaraid_change_queue_depth (struct scsi_device *sdev,int qdepth) +static int megaraid_change_queue_depth (struct scsi_device *sdev,int qdepth, +int reason) { +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; +if (qdepth >MBOX_MAX_SCSI_CMDS ) qdepth =MBOX_MAX_SCSI_CMDS ;scsi_adjust_queue_depth (sdev,0 , qdepth);
drivers/scsi/mpt2sas/mpt2sas_scsih.c +7 -3
@@ -1085,16 +1085,20 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,* _scsih_change_queue_depth - setting device queue depth * @sdev: scsi device struct * @qdepth: requested queue depth +* @reason: calling context * * Returns queue depth. */ static int -_scsih_change_queue_depth (struct scsi_device *sdev,int qdepth) +_scsih_change_queue_depth (struct scsi_device *sdev,int qdepth,int reason) {struct Scsi_Host *shost = sdev->host;int max_depth;int tag_type; +if (reason !=SCSI_QDEPTH_SYSFS_REQ ) +return -EOPNOTSUPP ; + max_depth = shost->can_queue;if (!sdev->tagged_supported) max_depth =1 ;
@@ -1524,7 +1528,7 @@ _scsih_slave_configure(struct scsi_device *sdev) r_level, raid_device->handle, (unsigned long long )raid_device->wwid, raid_device->num_pds, ds); -_scsih_change_queue_depth (sdev, qdepth); +_scsih_change_queue_depth (sdev, qdepth,SCSI_QDEPTH_SYSFS_REQ );return 0 ; }
@@ -1570,7 +1574,7 @@ _scsih_slave_configure(struct scsi_device *sdev)_scsih_display_sata_capabilities (ioc, sas_device, sdev); } -_scsih_change_queue_depth (sdev, qdepth); +_scsih_change_queue_depth (sdev, qdepth,SCSI_QDEPTH_SYSFS_REQ );if (ssp_target)sas_read_port_mode_page (sdev);
include/linux/libata.h +1 -1
@@ -1010,7 +1010,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev,extern int ata_scsi_slave_config (struct scsi_device *sdev);extern void ata_scsi_slave_destroy (struct scsi_device *sdev);extern int ata_scsi_change_queue_depth (struct scsi_device *sdev, -int queue_depth); +int queue_depth,int reason);extern struct ata_device *ata_dev_pair (struct ata_device *adev);extern int ata_do_set_mode (struct ata_link *link,struct ata_device **r_failed_dev);
include/scsi/libsas.h +2 -1
@@ -634,7 +634,8 @@ extern int sas_target_alloc(struct scsi_target *);extern int sas_slave_alloc (struct scsi_device *);extern int sas_slave_configure (struct scsi_device *);extern void sas_slave_destroy (struct scsi_device *); -extern int sas_change_queue_depth (struct scsi_device *,int new_depth); +extern int sas_change_queue_depth (struct scsi_device *,int new_depth, +int reason);extern int sas_change_queue_type (struct scsi_device *,int qt); extern int sas_bios_param(struct scsi_device *, struct block_device *,
Re: [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback
Quoted 5 lines · Vasu Dev
From: Mike Christie<[email protected]>
This is a simple port of the drivers setting a
change_queue_depthcallback but were not tracking queue fulls. In the patch I just have these LLDs adjust the queue depth if the user was requesting it.
Where is the doc describing how, and why, queue-full tracking occurs?
drivers/ata/sata_nv.c static int nv_swncq_slave_config(struct scsi_device *sdev) · line 1969
Quoted 13 lines
drivers/ata/sata_nv.c +1
-1@@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)ata_id_c_string (dev->id, model_num,ATA_ID_PROD ,sizeof (model_num));if (strncmp (model_num,"Maxtor" ,6 ) ==0 ) { -ata_scsi_change_queue_depth (sdev,1 ); +ata_scsi_change_queue_depth (sdev,1 ,SCSI_QDEPTH_SYSFS_REQ );ata_dev_printk (dev,KERN_NOTICE ,"Disabling SWNCQ mode (depth %x)\n" , sdev->queue_depth); }
This queue depth change was clearly not requested via sysfs...
Jeff
Re: [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback
Quoted 9 lines · Jeff Garzik
Quoted 5 lines · Vasu Dev
From: Mike Christie<[email protected]>
This is a simple port of the drivers setting a
change_queue_depthcallback but were not tracking queue fulls. In the patch I just have these LLDs adjust the queue depth if the user was requesting it.Where is the doc describing how, and why, queue-full tracking occurs?
The FCP-3 sec 4.2 states "If command queueing resources are unavailable in the logical unit when a command is received, the device server returns TASK SET FULL status or BUSY status in the FCP_RSP IU as specified by SAM-3".
But this patch series is to move the QUEUE_FULL and then the ramp up code from libfc, qla2xxx and lpfc drives to scsi-ml, the libfc had QUEUE_FULL code to move up. This series is not to change how and why part in current queue_full tracking and that was better described in first RFC cover by Mike at
http://www.spinics.net/lists/linux-scsi/msg35959.html .
Quoted 8 lines
Quoted 8 lines
drivers/ata/sata_nv.c +0
-0@@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)ata_id_c_string (dev->id, model_num,ATA_ID_PROD ,sizeof (model_num));
Quoted 9 lines
drivers/ata/sata_nv.c static int nv_swncq_slave_config(struct scsi_device *sdev) · line 1969
Quoted 6 lines
drivers/ata/sata_nv.c +1
-1if (strncmp (model_num,"Maxtor" ,6 ) ==0 ) { -ata_scsi_change_queue_depth (sdev,1 ); +ata_scsi_change_queue_depth (sdev,1 ,SCSI_QDEPTH_SYSFS_REQ );ata_dev_printk (dev,KERN_NOTICE ,"Disabling SWNCQ mode (depth %x)\n" , sdev->queue_depth); }This queue depth change was clearly not requested via sysfs...
Can be renamed as SCSI_QDEPTH_DEFAULT or SCSI_QDEPTH_NONE reason. What do you think Mike ?
Added SCSI_QDEPTH_SYSFS_REQ is default reason code for other drivers code impacted by addition of new reason parameter to existing scsi_host_template->change_queue_depth(), then other non-FC driver ignore any other reason code to keep their existing functionality intact by this API change, so any generic reason name will work and Mike may find more suitable common name for this.
Thanks
Vasu
Re: [RFC PATCH 3/9] drivers: convert drivers setting the change_queue_depth callback
Quoted 38 lines · Vasu Dev
Quoted 8 lines · Jeff Garzik
Quoted 5 lines · Vasu Dev
From: Mike Christie<[email protected]>
This is a simple port of the drivers setting a
change_queue_depthcallback but were not tracking queue fulls. In the patch I just have these LLDs adjust the queue depth if the user was requesting it.Where is the doc describing how, and why, queue-full tracking occurs?
The FCP-3 sec 4.2 states "If command queueing resources are unavailable in the logical unit when a command is received, the device server returns TASK SET FULL status or BUSY status in the
FCP_RSPIU as specified by SAM-3".But this patch series is to move the
QUEUE_FULLand then the ramp up code from libfc, qla2xxx and lpfc drives to scsi-ml, the libfc hadQUEUE_FULLcode to move up. This series is not to change how and why part in currentqueue_fulltracking and that was better described in first RFC cover by Mike at
http://www.spinics.net/lists/linux-scsi/msg35959.html .Quoted 7 lines
Quoted 7 lines
drivers/ata/sata_nv.c +0
-0@@ -1963,7 +1963,7 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)ata_id_c_string (dev->id, model_num,ATA_ID_PROD ,sizeof (model_num));Quoted 8 lines
drivers/ata/sata_nv.c static int nv_swncq_slave_config(struct scsi_device *sdev) · line 1969
Quoted 6 lines
drivers/ata/sata_nv.c +1
-1if (strncmp (model_num,"Maxtor" ,6 ) ==0 ) { -ata_scsi_change_queue_depth (sdev,1 ); +ata_scsi_change_queue_depth (sdev,1 ,SCSI_QDEPTH_SYSFS_REQ );ata_dev_printk (dev,KERN_NOTICE ,"Disabling SWNCQ mode (depth %x)\n" , sdev->queue_depth); }This queue depth change was clearly not requested via sysfs...
Quoted 2 lines
Can be renamed as
SCSI_QDEPTH_DEFAULTorSCSI_QDEPTH_NONEreason. What do you think Mike ?
Yes. That is better.
RFC PATCH 4/9 drivers: convert fc drivers calling scsi_track_queue_full
In reply to Vasu DevFrom: Mike Christie <[email protected]>
This converts the fc drivers that were using scsi_track_queue_full to track the queue full from the change_queue_depth callback.
I have not yet tested the qla2xxx or lpfc parts.
--
Adds check to ignore SCSI_QDEPTH_QFULL in case the ql2xqfulltracking is not set.
---
drivers/scsi/libfc/fc_fcp.c | 28 ++++++--------- drivers/scsi/lpfc/lpfc_scsi.c | 75 ++++++++++++++++++++++------------------ drivers/scsi/qla2xxx/qla_isr.c | 32 ----------------- drivers/scsi/qla2xxx/qla_os.c | 32 +++++++++++++++-- include/scsi/libfc.h | 2 + 5 files changed, 82 insertions(+), 87 deletions(-)
drivers/scsi/libfc/fc_fcp.c +11 -17
@@ -1814,21 +1814,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp) sc_cmd->result =DID_OK <<16 ;if (fsp->scsi_resid)CMD_RESID_LEN (sc_cmd) = fsp->scsi_resid; - }else if (fsp->cdb_status ==QUEUE_FULL ) { -struct scsi_device *tmp_sdev; -struct scsi_device *sdev = sc_cmd->device; - -shost_for_each_device (tmp_sdev, sdev->host) { -if (tmp_sdev->id != sdev->id) -continue ; - -if (tmp_sdev->queue_depth >1 ) { -scsi_track_queue_full (tmp_sdev, - tmp_sdev-> - queue_depth -1 ); - } - } - sc_cmd->result = (DID_OK <<16 ) | fsp->cdb_status; }else {/* * transport level I/O was ok but scsi
@@ -2062,9 +2047,18 @@ int fc_slave_alloc(struct scsi_device *sdev) }EXPORT_SYMBOL (fc_slave_alloc); -int fc_change_queue_depth (struct scsi_device *sdev,int qdepth) +int fc_change_queue_depth (struct scsi_device *sdev,int qdepth,int reason) { -scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), qdepth); +switch (reason) { +case SCSI_QDEPTH_SYSFS_REQ : +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), qdepth); +break ; +case SCSI_QDEPTH_QFULL : +scsi_track_queue_full (sdev, qdepth); +break ; +default : +return -EOPNOTSUPP ; + }return sdev->queue_depth; }EXPORT_SYMBOL (fc_change_queue_depth);
drivers/scsi/lpfc/lpfc_scsi.c +41 -34
105 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_isr.c +0 -32
@@ -836,20 +836,6 @@ qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data) sdev->queue_depth)); } -static void -qla2x00_adjust_sdev_qdepth_down (struct scsi_device *sdev,void *data) -{ -fc_port_t *fcport = data; - -if (!scsi_track_queue_full (sdev, sdev->queue_depth -1 )) -return ; - -DEBUG2 (qla_printk (KERN_INFO , fcport->vha->hw, -"scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n" , - fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun, - sdev->queue_depth)); -} -static inline void qla2x00_ramp_up_queue_depth (scsi_qla_host_t *vha,struct req_que *req,srb_t *sp)
@@ -1176,13 +1162,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)"scsi(%ld): QUEUE FULL status detected " "0x%x-0x%x.\n" , vha->host_no, comp_status, scsi_status)); - -/* Adjust queue depth for all luns on the port. */ -if (!ql2xqfulltracking) -break ; - fcport->last_queue_full = jiffies; -starget_for_each_device (cp->device->sdev_target, - fcport, qla2x00_adjust_sdev_qdepth_down);break ; }if (lscsi_status !=SS_CHECK_CONDITION )
@@ -1233,17 +1212,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)"scsi(%ld): QUEUE FULL status detected " "0x%x-0x%x.\n" , vha->host_no, comp_status, scsi_status)); - -/* -* Adjust queue depth for all luns on the -* port. -*/ -if (!ql2xqfulltracking) -break ; - fcport->last_queue_full = jiffies; -starget_for_each_device ( - cp->device->sdev_target, fcport, - qla2x00_adjust_sdev_qdepth_down);break ; }if (lscsi_status !=SS_CHECK_CONDITION )
drivers/scsi/qla2xxx/qla_os.c +29 -3
@@ -137,7 +137,7 @@ static int qla2xxx_eh_target_reset(struct scsi_cmnd *);static int qla2xxx_eh_bus_reset (struct scsi_cmnd *);static int qla2xxx_eh_host_reset (struct scsi_cmnd *); -static int qla2x00_change_queue_depth (struct scsi_device *,int ); +static int qla2x00_change_queue_depth (struct scsi_device *,int ,int );static int qla2x00_change_queue_type (struct scsi_device *,int );struct scsi_host_template qla2xxx_driver_template = {
@@ -1222,10 +1222,36 @@ qla2xxx_slave_destroy(struct scsi_device *sdev) sdev->hostdata =NULL ; } +static void qla2x00_handle_queue_full (struct scsi_device *sdev,int qdepth) +{ +fc_port_t *fcport = (struct fc_port *) sdev->hostdata; + + fcport->last_queue_full = jiffies; + +if (!scsi_track_queue_full (sdev, qdepth)) +return ; + +DEBUG2 (qla_printk (KERN_INFO , fcport->vha->hw, +"scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n" , + fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun, + sdev->queue_depth)); +} +static int -qla2x00_change_queue_depth (struct scsi_device *sdev,int qdepth) +qla2x00_change_queue_depth (struct scsi_device *sdev,int qdepth,int reason) { -scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), qdepth); +switch (reason) { +case SCSI_QDEPTH_SYSFS_REQ : +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), qdepth); +break ; +case SCSI_QDEPTH_QFULL : +if (!ql2xqfulltracking) +qla2x00_handle_queue_full (sdev, qdepth); +break ; +default : +return EOPNOTSUPP ; + } +return sdev->queue_depth; }
include/scsi/libfc.h +1 -1
@@ -919,7 +919,7 @@ int fc_slave_alloc(struct scsi_device *sdev);/* * Adjust the queue depth. */ -int fc_change_queue_depth (struct scsi_device *sdev,int qdepth); +int fc_change_queue_depth (struct scsi_device *sdev,int qdepth,int reason);/* * Change the tag type.
RFC PATCH 5/9 scsi: updates sdev to add queue_depth ramp up code
In reply to Vasu DevCurrent FC HBA queue_depth ramp up code depends on :-
1. last queue full time.
2. last queue ramp up time.
3. ramp up period (time interval)
The sdev already has last_queue_full_time field to track last queue full time but stored value is truncated by last four bits.
So this patch updates last_queue_full_time without truncating last 4 bits to store complete value and then updates its only current usages in scsi_track_queue_full to ignore last four bits to keep current usages same. This will allow same last_queue_full_time used by scsi_track_queue_full and queue_depth ramp up code.
Adds additional new sdev fields for above 2 and 3 items.
---
drivers/scsi/scsi.c | 10 ++++++++-- include/scsi/scsi_device.h | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/scsi/scsi.c +8 -2
@@ -937,10 +937,16 @@ EXPORT_SYMBOL(scsi_adjust_queue_depth);*/ int scsi_track_queue_full (struct scsi_device *sdev,int depth) { -if ((jiffies >>4 ) == sdev->last_queue_full_time) + +/* +* Don't let QUEUE_FULLs on the same +* jiffies count, they could all be from +* same event. +*/ +if ((jiffies >>4 ) == (sdev->last_queue_full_time >>4 ))return 0 ; - sdev->last_queue_full_time = (jiffies >>4 ); + sdev->last_queue_full_time = jiffies;if (sdev->last_queue_full_depth != depth) { sdev->last_queue_full_count =1 ; sdev->last_queue_full_depth = depth;
include/scsi/scsi_device.h +3 -3
@@ -83,9 +83,9 @@ struct scsi_device {unsigned short queue_depth;/* How deep of a queue we want */ unsigned short last_queue_full_depth;/* These two are used by */ unsigned short last_queue_full_count;/* scsi_track_queue_full() */ -unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same -jiffie count on our counter, they -could all be from the same event. */ +unsigned long last_queue_full_time;/* last queue full time */ +unsigned long queue_ramp_up_period;/* ramp up period in jiffies */ +unsigned long last_queue_ramp_up;/* last queue ramp up time */ unsigned int id, lun, channel;
RFC PATCH 6/9 scsi: adds sdev->queue_ramp_up_period to sysfs
In reply to Vasu DevAdds sysfs functions to show or store sdev->queue_ramp_up_period.
Adds queue_ramp_up_period to sysfs if change_queue_depth is supported since ramp up is needed only in case the dynamic queue_depth change is supported first.
Initializes queue_ramp_up_period to 120HZ jiffies as initial default value.
---
drivers/scsi/scsi_scan.c | 1 + drivers/scsi/scsi_sysfs.c | 38 ++++++++++++++++++++++++++++++++++++-- include/scsi/scsi_device.h | 2 ++ 3 files changed, 39 insertions(+), 2 deletions(-)
drivers/scsi/scsi_scan.c +1 -0
@@ -251,6 +251,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, sdev->model = scsi_null_device_strs; sdev->rev = scsi_null_device_strs; sdev->host = shost; + sdev->queue_ramp_up_period =SCSI_DEFAULT_RAMP_UP_PERIOD ; sdev->id = starget->id; sdev->lun = lun; sdev->channel = starget->channel;
drivers/scsi/scsi_sysfs.c +36 -2
@@ -779,6 +779,36 @@ static struct device_attribute sdev_attr_queue_depth_rw = sdev_store_queue_depth_rw);static ssize_t +sdev_show_queue_ramp_up_period (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct scsi_device *sdev; + sdev =to_scsi_device (dev); +return snprintf (buf,20 ,"%lu\n" , sdev->queue_ramp_up_period); +} + +static ssize_t +sdev_store_queue_ramp_up_period (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct scsi_device *sdev =to_scsi_device (dev); +unsigned long period; + +if (strict_strtoul (buf,10 , &period)) +return -EINVAL ; + + sdev->queue_ramp_up_period = period; +return period; +} + +static struct device_attribute sdev_attr_queue_ramp_up_period = +__ATTR (queue_ramp_up_period,S_IRUGO |S_IWUSR , + sdev_show_queue_ramp_up_period, + sdev_store_queue_ramp_up_period); + +static ssize_t sdev_store_queue_type_rw (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {
@@ -870,8 +900,12 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)get_device (&sdev->sdev_gendev);/* create queue files, which may be writable, depending on the host */ -if (sdev->host->hostt->change_queue_depth) - error =device_create_file (&sdev->sdev_gendev, &sdev_attr_queue_depth_rw); +if (sdev->host->hostt->change_queue_depth) { + error =device_create_file (&sdev->sdev_gendev, + &sdev_attr_queue_depth_rw); + error =device_create_file (&sdev->sdev_gendev, + &sdev_attr_queue_ramp_up_period); + }else error =device_create_file (&sdev->sdev_gendev, &dev_attr_queue_depth);if (error) {
include/scsi/scsi_device.h +2 -0
@@ -85,6 +85,8 @@ struct scsi_device {unsigned short last_queue_full_count;/* scsi_track_queue_full() */ unsigned long last_queue_full_time;/* last queue full time */ unsigned long queue_ramp_up_period;/* ramp up period in jiffies */ +#define SCSI_DEFAULT_RAMP_UP_PERIOD (120 * HZ) +unsigned long last_queue_ramp_up;/* last queue ramp up time */ unsigned int id, lun, channel;
RFC PATCH 7/9 scsi: add common queue_depth ramp up code
In reply to Vasu DevAdds scsi_handle_queue_ramp_up to ramp up queue_depth on successful completion of IO. The scsi_handle_queue_ramp_up will do ramp up on all luns of a target, just same as ramp down done on all luns on a target.
However ramp up is skipped if lapsed time since either last queue ramp up or down is less than LLD specified queue_ramp_up_period.
The ramp up is also skipped in case the change_queue_depth is not supported by LLD.
---
drivers/scsi/scsi_error.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
drivers/scsi/scsi_error.c +38 -0
@@ -331,6 +331,42 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) } } +static void scsi_handle_queue_ramp_up (struct scsi_device *sdev) +{ +struct scsi_host_template *sht = sdev->host->hostt; +struct scsi_device *tmp_sdev; + +if (!sht->change_queue_depth) +return ; + +if (time_before (jiffies, + sdev->last_queue_ramp_up + sdev->queue_ramp_up_period)) +return ; + +if (time_before (jiffies, + sdev->last_queue_full_time + sdev->queue_ramp_up_period)) +return ; + +/* +* Walk all devices of a target and do +* ramp up on them. +*/ +shost_for_each_device (tmp_sdev, sdev->host) { +if ((tmp_sdev->channel != sdev->channel) || + (tmp_sdev->id != sdev->id)) +continue ; +/* +* We do not know max queue_depth supported by the +* device, so pass the existing queue_depth and let +* device adjust the queue_depth on ramp up change +* event. +*/ + sht->change_queue_depth (tmp_sdev, tmp_sdev->queue_depth, +SCSI_QDEPTH_RAMP_UP ); + sdev->last_queue_ramp_up = jiffies; + } +} +static void scsi_handle_queue_full (struct scsi_device *sdev) {struct scsi_host_template *sht = sdev->host->hostt;
@@ -392,6 +428,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)*/ switch (status_byte (scmd->result)) {case GOOD : +scsi_handle_queue_ramp_up (scmd->device);case COMMAND_TERMINATED :return SUCCESS ;case CHECK_CONDITION :
@@ -1421,6 +1458,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)*/ return ADD_TO_MLQUEUE ;case GOOD : +scsi_handle_queue_ramp_up (scmd->device);case COMMAND_TERMINATED :return SUCCESS ;case TASK_ABORTED :
RFC PATCH 8/9 fcoe, libfc: fix an libfc issue with queue ramp down in libfc
In reply to Vasu DevThe cmd_per_lun value is used by scsi-ml as fall back lowest queue_depth value but in case of libfc cmd_per_lun is set to same value as max queue_depth = 32.
So this patch reduces cmd_per_lun value to 3 and configures each lun with default max queue_depth 32 in fc_slave_alloc.
---
drivers/scsi/fcoe/fcoe.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-)
drivers/scsi/fcoe/fcoe.c +1 -1
@@ -137,7 +137,7 @@ static struct scsi_host_template fcoe_shost_template = { .change_queue_depth = fc_change_queue_depth, .change_queue_type = fc_change_queue_type, .this_id = -1, - .cmd_per_lun = 32, + .cmd_per_lun = 3, .can_queue = FCOE_MAX_OUTSTANDING_COMMANDS, .use_clustering = ENABLE_CLUSTERING, .sg_tablesize = SG_ALL,
drivers/scsi/libfc/fc_fcp.c +6 -8
@@ -2031,18 +2031,16 @@ EXPORT_SYMBOL(fc_eh_host_reset);int fc_slave_alloc (struct scsi_device *sdev) {struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); -int queue_depth;if (!rport ||fc_remote_port_chkready (rport))return -ENXIO ; -if (sdev->tagged_supported) { -if (sdev->host->hostt->cmd_per_lun) - queue_depth = sdev->host->hostt->cmd_per_lun; -else - queue_depth =FC_FCP_DFLT_QUEUE_DEPTH ; -scsi_activate_tcq (sdev, queue_depth); - } +if (sdev->tagged_supported) +scsi_activate_tcq (sdev,FC_FCP_DFLT_QUEUE_DEPTH ); +else +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), +FC_FCP_DFLT_QUEUE_DEPTH ); +return 0 ; }EXPORT_SYMBOL (fc_slave_alloc);
RFC PATCH 9/9 libfc: adds queue_depth ramp up to libfc
In reply to Vasu DevIncreases queue_depth by one on fc_change_queue_depth call back with reason SCSI_QDEPTH_RAMP_UP.
---
drivers/scsi/libfc/fc_fcp.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/scsi/libfc/fc_fcp.c +5 -0
@@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)case SCSI_QDEPTH_QFULL :scsi_track_queue_full (sdev, qdepth);break ; +case SCSI_QDEPTH_RAMP_UP : +if (qdepth +1 <=FC_FCP_DFLT_QUEUE_DEPTH ) +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), + qdepth +1 ); +break ;default :return -EOPNOTSUPP ; }
Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
Quoted 15 lines · Vasu Dev
Increases
queue_depthby one onfc_change_queue_depthcall back with reasonSCSI_QDEPTH_RAMP_UP.Signed-off-by Vasu Dev <[email protected]>---
drivers/scsi/libfc/fc_fcp.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/scsi/libfc/fc_fcp.c +0
-0@@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)case SCSI_QDEPTH_QFULL :
drivers/scsi/libfc/fc_fcp.c int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) · line 2064
Quoted 10 lines
drivers/scsi/libfc/fc_fcp.c +5
-0scsi_track_queue_full (sdev, qdepth);break ; +case SCSI_QDEPTH_RAMP_UP : +if (qdepth +1 <=FC_FCP_DFLT_QUEUE_DEPTH ) +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), + qdepth +1 ); +break ;default :return -EOPNOTSUPP ; }
Overall the approach looks good to me.
I am trying to find out how this applies to the zfcp driver. Is the approach in fc_change_queue_depth a good example for a driver that does not have to adjust internal resources when changing the queue depth?
--
Christof Schmitt
Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
Quoted 29 lines · Christof Schmitt
Quoted 15 lines · Vasu Dev
Increases
queue_depthby one onfc_change_queue_depthcall back with reasonSCSI_QDEPTH_RAMP_UP.Signed-off-by Vasu Dev <[email protected]>---
drivers/scsi/libfc/fc_fcp.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/scsi/libfc/fc_fcp.c +0
-0@@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)case SCSI_QDEPTH_QFULL :drivers/scsi/libfc/fc_fcp.c int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) · line 2064
Quoted 10 lines
drivers/scsi/libfc/fc_fcp.c +5
-0scsi_track_queue_full (sdev, qdepth);break ; +case SCSI_QDEPTH_RAMP_UP : +if (qdepth +1 <=FC_FCP_DFLT_QUEUE_DEPTH ) +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), + qdepth +1 ); +break ;default :return -EOPNOTSUPP ; }Overall the approach looks good to me.
Quoted 5 lines
I am trying to find out how this applies to the zfcp driver. Is the approach in
fc_change_queue_deptha good example for a driver that does not have to adjust internal resources when changing the queue depth?
Yes, this is the case with libfc also since libfc also doesn't make any additional resource adjustments on this call back. However If needed then this call back can be used to make additional resource adjustments also as needed by lpfc driver in lpfc_change_queue_depth.
Vasu
Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
Quoted 36 lines · Vasu Dev
Quoted 29 lines · Christof Schmitt
Quoted 15 lines · Vasu Dev
Increases
queue_depthby one onfc_change_queue_depthcall back with reasonSCSI_QDEPTH_RAMP_UP.Signed-off-by Vasu Dev <[email protected]>---
drivers/scsi/libfc/fc_fcp.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/scsi/libfc/fc_fcp.c +0
-0@@ -2054,6 +2054,11 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)case SCSI_QDEPTH_QFULL :drivers/scsi/libfc/fc_fcp.c int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) · line 2064
Quoted 10 lines
drivers/scsi/libfc/fc_fcp.c +5
-0scsi_track_queue_full (sdev, qdepth);break ; +case SCSI_QDEPTH_RAMP_UP : +if (qdepth +1 <=FC_FCP_DFLT_QUEUE_DEPTH ) +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), + qdepth +1 ); +break ;default :return -EOPNOTSUPP ; }Overall the approach looks good to me.
Quoted 5 lines
I am trying to find out how this applies to the zfcp driver. Is the approach in
fc_change_queue_deptha good example for a driver that does not have to adjust internal resources when changing the queue depth?
Quoted 4 lines
Yes, this is the case with libfc also since libfc also doesn't make any additional resource adjustments on this call back. However If needed then this call back can be used to make additional resource adjustments also as needed by lpfc driver in
lpfc_change_queue_depth.
There are also no resource adjustments necessary inside the zfcp driver, i attached a first patch to adapt the zfcp change_queue_depth callback.
I reused the default_depth settings for checking the maximum queue depth. But i am wondering if the check should happen differently. Would it make more sense to have an adjustable maximum_depth attribute for each SCSI device? Or would it be possible to always increase the queue depth until the storage returns QUEUE_FULL again?
Christof
---
zfcp: Adapt change_queue_depth for queue full tracking
From: Christof Schmitt <[email protected]>
Adapt the change_queue_depth callback in zfcp for the new reason parameter. Simply pass each call back to the SCSI midlayer, there are no resource adjustments necessary for zfcp.
--- drivers/s390/scsi/zfcp_scsi.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +18 -2
@@ -28,9 +28,25 @@ char *zfcp_get_fcp_sns_info_ptr(struct freturn fcp_sns_info_ptr; } -static int zfcp_scsi_change_queue_depth (struct scsi_device *sdev,int depth) +static int zfcp_scsi_change_queue_depth (struct scsi_device *sdev,int depth, +int reason) { -scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), depth); +switch (reason) { +case SCSI_QDEPTH_SYSFS_REQ : +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), depth); +break ; +case SCSI_QDEPTH_QFULL : +scsi_track_queue_full (sdev, depth); +break ; +case SCSI_QDEPTH_RAMP_UP : + depth++; +if (depth <= default_depth) +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), + depth); +break ; +default : +return -EOPNOTSUPP ; + }return sdev->queue_depth; }
Re: [RFC PATCH 9/9] libfc: adds queue_depth ramp up to libfc
Quoted 1 line · Christof Schmitt
On Thu, Aug 27, 2009 at 01:56:31PM -0700, Vasu Dev wrote:
<snip>
Quoted 6 lines
I reused the
default_depthsettings for checking the maximum queue depth. But i am wondering if the check should happen differently. Would it make more sense to have an adjustablemaximum_depthattribute for each SCSI device? Or would it be possible to always increase the queue depth until the storage returnsQUEUE_FULLagain?
Increasing only up to initially configured maximum_depth by LLD is required otherwise there won't be any upper bound on qdepth increase and in case of no traffic the qdepth will keep on increasing since there won't be any QUEUE_FULL event in that case and that might lead to other issues with qdepth related other resources in the stack.
Currently scsi-ml is not aware of maximum_depth but as you suggested above it can be added to each scsi_device and then common scsi-ml ramp up code can ramp up up to configured maximum_depth. But that would require adding maximum_depth field to scsi_device for only ramp up purpose and given ramp up call back is required for LLD requiring their additional resources adjustment I had LLD checked for maximum_depth.
However I think moving qdepth increment qdepth++ to scsi-ml common ramp up code will eliminate increment in each LLD. I'll do that move.
Thanks
Vasu
Quoted 48 lines
---
zfcp: Adaptchange_queue_depthfor queue full trackingFrom: Christof Schmitt <[email protected]>
Adapt the
change_queue_depthcallback in zfcp for the new reason parameter. Simply pass each call back to the SCSI midlayer, there are no resource adjustments necessary for zfcp.Signed-off-by Christof Schmitt <[email protected]>--- drivers/s390/scsi/zfcp_scsi.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/s390/scsi/zfcp_scsi.c +18
-3@@ -28,9 +28,25 @@ char *zfcp_get_fcp_sns_info_ptr(struct freturn fcp_sns_info_ptr; } -static int zfcp_scsi_change_queue_depth (struct scsi_device *sdev,int depth) +static int zfcp_scsi_change_queue_depth (struct scsi_device *sdev,int depth, +int reason) { -scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), depth); +switch (reason) { +case SCSI_QDEPTH_SYSFS_REQ : +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), depth); +break ; +case SCSI_QDEPTH_QFULL : +scsi_track_queue_full (sdev, depth); +break ; +case SCSI_QDEPTH_RAMP_UP : + depth++; +if (depth <= default_depth) +scsi_adjust_queue_depth (sdev,scsi_get_tag_type (sdev), + depth); +break ; +default : +return -EOPNOTSUPP ; + }return sdev->queue_depth; } --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 27 lines · Vasu Dev
First four patches are from Mike Christie's original RFC at:-
http://www.spinics.net/lists/linux-scsi/msg35959.html
http://www.spinics.net/lists/linux-scsi/msg35962.html
http://www.spinics.net/lists/linux-scsi/msg35961.html
http://www.spinics.net/lists/linux-scsi/msg35963.html
http://www.spinics.net/lists/linux-scsi/msg35964.htmlAbove four patches adds ramp down code and I appended ramp up code in following patches and tested this entire series with libfc/fcoe. This series works fine without any regression and also
queue_depthadjustment works for both ramp down and ramp up.Above patches are updated to scsi-misc -rc7 plus recently submitted 64 fcoe patches series by Rob
"[PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc" This series also applies cleanly to scsi-misc -rc7.I'd appreciate review comments for added more patches for ramp up.
I'll post my final patches to this list skipping fcoe list, this as per Rob Love suggestion since mostly scsi changes by this series beyond fcoe/libfc. However Rob agreed to review/Ack fcoe/libfc changes at this list.
Quoted 6 lines
Mike, I'll be able to post my ramp up patches only once you send final patches for ramp down on which my patches depends. As I said your patches are tested for libfc, so most common code is already tested and they are good go as far as libfc goes.
Hey Mike,
I'd like to get final patches of this series out this week to
get them into next merge window but not sure how to get final patches out with your first four RFC patches in this series on which rest all patches depends. Please help me on this.
I see following ways to get final patches out:-
1. You post your first four as final patches and then I post mine.
2. I've tested this series for libfc, so I can trim your patches to
only scsi-ml and libfc changes excluding lpfc and qla changes for now since this is all I can test before I send out final patches. I suppose it should be okay to post your RFC patches by me with my verification with libfc and your approval as these RFC patches author.
Let me know which way you would like to proceed, In any case patches
needs to be updated for recent comments.
Thanks
Vasu
Quoted 18 lines
---
Mike Christie (4):
drivers: convert fc drivers callingscsi_track_queue_full
drivers: convert drivers setting thechange_queue_depthcallback scsi error: have scsi-ml callchange_queue_depthto handleQUEUE_FULL
scsi-ml: modifychange_queue_depthto take in reason why it is being calledVasu Dev (5):
libfc: addsqueue_depthramp up to libfc
fcoe, libfc: fix an libfc issue with queue ramp down in libfc
scsi: add commonqueue_depthramp up code
scsi: addssdev->queue_ramp_up_periodto sysfs
scsi: updates sdev to addqueue_depthramp up code
Quoted 35 lines · Vasu Dev
Quoted 27 lines · Vasu Dev
First four patches are from Mike Christie's original RFC at:-
http://www.spinics.net/lists/linux-scsi/msg35959.html
http://www.spinics.net/lists/linux-scsi/msg35962.html
http://www.spinics.net/lists/linux-scsi/msg35961.html
http://www.spinics.net/lists/linux-scsi/msg35963.html
http://www.spinics.net/lists/linux-scsi/msg35964.htmlAbove four patches adds ramp down code and I appended ramp up code in following patches and tested this entire series with libfc/fcoe. This series works fine without any regression and also
queue_depthadjustment works for both ramp down and ramp up.Above patches are updated to scsi-misc -rc7 plus recently submitted 64 fcoe patches series by Rob
"[PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc" This series also applies cleanly to scsi-misc -rc7.I'd appreciate review comments for added more patches for ramp up.
I'll post my final patches to this list skipping fcoe list, this as per Rob Love suggestion since mostly scsi changes by this series beyond fcoe/libfc. However Rob agreed to review/Ack fcoe/libfc changes at this list.
Quoted 6 lines
Mike, I'll be able to post my ramp up patches only once you send final patches for ramp down on which my patches depends. As I said your patches are tested for libfc, so most common code is already tested and they are good go as far as libfc goes.
Quoted 7 lines
Hey Mike,
I'd like to get final patches of this series out this week to
get them into next merge window but not sure how to get final patches out with your first four RFC patches in this series on which rest all patches depends. Please help me on this.
You should just post your patches with mine. I do not have time to test my stuff right now with the current kernel, and since you need them and are going to have to test your patches just make it easy for James/reviewers and send it all in one patchset so people do not have to search for dependencies.
For my patches just add your signed off after mine, since you are sending them and I had written them.
You can/should probably also pick up Christop's stuff too for him (zfcp patches).
Quoted 1 line · Mike Christie
On 09/01/2009 05:57 PM, Vasu Dev wrote:
<snip>
Quoted 8 lines
You should just post your patches with mine. I do not have time to test my stuff right now with the current kernel, and since you need them and are going to have to test your patches just make it easy for James/reviewers and send it all in one patchset so people do not have to search for dependencies.
For my patches just add your signed off after mine, since you are sending them and I had written them.
I'll get them out as per by your suggestions above, thanks.
Quoted 3 lines
You can/should probably also pick up Christop's stuff too for him (zfcp patches).
Christof, I'm fine picking up your patch also, let me know if that is not fine with you.
Thanks
Vasu
Quoted 14 lines · Vasu Dev
Quoted 1 line · Mike Christie
On 09/01/2009 05:57 PM, Vasu Dev wrote:
<snip>
Quoted 8 lines
You should just post your patches with mine. I do not have time to test my stuff right now with the current kernel, and since you need them and are going to have to test your patches just make it easy for James/reviewers and send it all in one patchset so people do not have to search for dependencies.
For my patches just add your signed off after mine, since you are sending them and I had written them.
Quoted 8 lines
I'll get them out as per by your suggestions above, thanks.
Quoted 3 lines
You can/should probably also pick up Christop's stuff too for him (zfcp patches).
Christof, I'm fine picking up your patch also, let me know if that is not fine with you.
Christof is currently on vacation, but I'm pretty sure he doesn't mind. Please go ahead.
Cheers Swen
Quoted 9 lines
Thanks
Vasu--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Vasu Dev
Quoted 2 lines
You can/should probably also pick up Christop's stuff too for him (zfcp patches).
Christof, I'm fine picking up your patch also, let me know if that is not fine with you.
Pick up the patch, that is ok with me. I guess it makes most sense to apply this in one run.
I have not seen the patches in scsi-misc yet. Will this go into 2.6.32?
--
Christof