diff options
| author | Kashyap.Desai@avagotech.com <Kashyap.Desai@avagotech.com> | 2014-08-20 09:54:33 -0400 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2014-09-15 19:01:58 -0400 |
| commit | 64bdcbc449105377dd60c8da97cfc1663b39562c (patch) | |
| tree | be79dd9fe4dfd101dc68ed5ee6d0d53ce2efad09 | |
| parent | 2eefd57b97609949ae40952da2dea338e7d9a125 (diff) | |
scsi: add use_cmd_list flag
Add a use_cmd_list flag in struct Scsi_Host to request keeping track of
all outstanding commands per device.
Default behaviour is not to keep track of cmd_list per sdev, as this may
introduce lock contention. (overhead is more on multi-node NUMA.), and
only enable it on the two drivers that need it.
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
| -rw-r--r-- | drivers/scsi/aacraid/linit.c | 1 | ||||
| -rw-r--r-- | drivers/scsi/dpt_i2o.c | 1 | ||||
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 24 | ||||
| -rw-r--r-- | include/scsi/scsi_host.h | 1 |
4 files changed, 15 insertions, 12 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 63f576c9300a..a759cb2d4b15 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
| @@ -1152,6 +1152,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1152 | shost->irq = pdev->irq; | 1152 | shost->irq = pdev->irq; |
| 1153 | shost->unique_id = unique_id; | 1153 | shost->unique_id = unique_id; |
| 1154 | shost->max_cmd_len = 16; | 1154 | shost->max_cmd_len = 16; |
| 1155 | shost->use_cmd_list = 1; | ||
| 1155 | 1156 | ||
| 1156 | aac = (struct aac_dev *)shost->hostdata; | 1157 | aac = (struct aac_dev *)shost->hostdata; |
| 1157 | aac->base_start = pci_resource_start(pdev, 0); | 1158 | aac->base_start = pci_resource_start(pdev, 0); |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 67283ef418ac..072f0ec2851e 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
| @@ -2363,6 +2363,7 @@ static s32 adpt_scsi_host_alloc(adpt_hba* pHba, struct scsi_host_template *sht) | |||
| 2363 | host->unique_id = (u32)sys_tbl_pa + pHba->unit; | 2363 | host->unique_id = (u32)sys_tbl_pa + pHba->unit; |
| 2364 | host->sg_tablesize = pHba->sg_tablesize; | 2364 | host->sg_tablesize = pHba->sg_tablesize; |
| 2365 | host->can_queue = pHba->post_fifo_size; | 2365 | host->can_queue = pHba->post_fifo_size; |
| 2366 | host->use_cmd_list = 1; | ||
| 2366 | 2367 | ||
| 2367 | return 0; | 2368 | return 0; |
| 2368 | } | 2369 | } |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d837dc180522..b9a8ddd77eef 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -645,16 +645,18 @@ static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) | |||
| 645 | static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) | 645 | static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) |
| 646 | { | 646 | { |
| 647 | struct scsi_device *sdev = cmd->device; | 647 | struct scsi_device *sdev = cmd->device; |
| 648 | struct Scsi_Host *shost = sdev->host; | ||
| 648 | unsigned long flags; | 649 | unsigned long flags; |
| 649 | 650 | ||
| 650 | BUG_ON(list_empty(&cmd->list)); | ||
| 651 | |||
| 652 | scsi_mq_free_sgtables(cmd); | 651 | scsi_mq_free_sgtables(cmd); |
| 653 | scsi_uninit_cmd(cmd); | 652 | scsi_uninit_cmd(cmd); |
| 654 | 653 | ||
| 655 | spin_lock_irqsave(&sdev->list_lock, flags); | 654 | if (shost->use_cmd_list) { |
| 656 | list_del_init(&cmd->list); | 655 | BUG_ON(list_empty(&cmd->list)); |
| 657 | spin_unlock_irqrestore(&sdev->list_lock, flags); | 656 | spin_lock_irqsave(&sdev->list_lock, flags); |
| 657 | list_del_init(&cmd->list); | ||
| 658 | spin_unlock_irqrestore(&sdev->list_lock, flags); | ||
| 659 | } | ||
| 658 | } | 660 | } |
| 659 | 661 | ||
| 660 | /* | 662 | /* |
| @@ -1815,13 +1817,11 @@ static int scsi_mq_prep_fn(struct request *req) | |||
| 1815 | INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler); | 1817 | INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler); |
| 1816 | cmd->jiffies_at_alloc = jiffies; | 1818 | cmd->jiffies_at_alloc = jiffies; |
| 1817 | 1819 | ||
| 1818 | /* | 1820 | if (shost->use_cmd_list) { |
| 1819 | * XXX: cmd_list lookups are only used by two drivers, try to get | 1821 | spin_lock_irq(&sdev->list_lock); |
| 1820 | * rid of this list in common code. | 1822 | list_add_tail(&cmd->list, &sdev->cmd_list); |
| 1821 | */ | 1823 | spin_unlock_irq(&sdev->list_lock); |
| 1822 | spin_lock_irq(&sdev->list_lock); | 1824 | } |
| 1823 | list_add_tail(&cmd->list, &sdev->cmd_list); | ||
| 1824 | spin_unlock_irq(&sdev->list_lock); | ||
| 1825 | 1825 | ||
| 1826 | sg = (void *)cmd + sizeof(struct scsi_cmnd) + shost->hostt->cmd_size; | 1826 | sg = (void *)cmd + sizeof(struct scsi_cmnd) + shost->hostt->cmd_size; |
| 1827 | cmd->sdb.table.sgl = sg; | 1827 | cmd->sdb.table.sgl = sg; |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index ba2034779961..cafb260ef2d3 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
| @@ -680,6 +680,7 @@ struct Scsi_Host { | |||
| 680 | unsigned no_write_same:1; | 680 | unsigned no_write_same:1; |
| 681 | 681 | ||
| 682 | unsigned use_blk_mq:1; | 682 | unsigned use_blk_mq:1; |
| 683 | unsigned use_cmd_list:1; | ||
| 683 | 684 | ||
| 684 | /* | 685 | /* |
| 685 | * Optional work queue to be utilized by the transport | 686 | * Optional work queue to be utilized by the transport |
