SCSI fixes for 4.16-rc7
Subsystems (7)
James Bottomley
maintainerTwo driver fixes (ibmvfc, iscsi_tcp) and a USB fix for devices that give the wrong return to Read Capacity and cause a huge log spew. The remaining 5 patches all try to fix commit 84676c1f21e8ff5 "genirq/affinity: assign vectors to all possible CPUs") which broke the non-mq I/O path.
The patch is available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes
The short changelog is:
Brian King (1):
scsi: ibmvfc: Avoid unnecessary port relogin
Jianchao Wang (1):
scsi: iscsi_tcp: set BDI_CAP_STABLE_WRITES when data digest enabled
Martin K. Petersen (1):
scsi: sd: Remember that READ CAPACITY(16) succeeded
Ming Lei (5):
scsi: virtio_scsi: unify scsi_host_template
scsi: virtio_scsi: fix IO hang caused by automatic irq vector affinity
scsi: core: introduce force_blk_mq
scsi: megaraid_sas: fix selection of reply queue
scsi: hpsa: fix selection of reply queue
And the diffstat:
drivers/scsi/hosts.c | 1 + drivers/scsi/hpsa.c | 73 ++++++++++++---- drivers/scsi/hpsa.h | 1 + drivers/scsi/ibmvscsi/ibmvfc.c | 6 +- drivers/scsi/iscsi_tcp.c | 8 ++ drivers/scsi/megaraid/megaraid_sas.h | 1 + drivers/scsi/megaraid/megaraid_sas_base.c | 39 ++++++++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 12 +-- drivers/scsi/sd.c | 2 + drivers/scsi/virtio_scsi.c | 129 ++++------------------------ include/scsi/scsi_host.h | 3 + 11 files changed, 128 insertions(+), 147 deletions(-)
With full diff below.
James
---
drivers/scsi/hosts.c +1 -0
@@ -474,6 +474,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->dma_boundary =0xffffffff ; shost->use_blk_mq = scsi_use_blk_mq; + shost->use_blk_mq = scsi_use_blk_mq || shost->hostt->force_blk_mq;device_initialize (&shost->shost_gendev);dev_set_name (&shost->shost_gendev,"host%d" , shost->host_no);
drivers/scsi/hpsa.c +54 -19
133 lines not on this page · raw message
drivers/scsi/hpsa.h +1 -0
@@ -158,6 +158,7 @@ struct bmic_controller_parameters {#pragma pack()struct ctlr_info { +unsigned int *reply_map;int ctlr;char devname[8 ];char *product_name;
drivers/scsi/ibmvscsi/ibmvfc.c +2 -4
@@ -3579,11 +3579,9 @@ static void ibmvfc_tgt_implicit_logout(struct ibmvfc_target *tgt)static int ibmvfc_adisc_needs_plogi (struct ibmvfc_passthru_mad *mad,struct ibmvfc_target *tgt) { -if (memcmp (&mad->fc_iu.response[2 ], &tgt->ids.port_name, -sizeof (tgt->ids.port_name))) +if (wwn_to_u64 ((u8 *)&mad->fc_iu.response[2 ]) != tgt->ids.port_name)return 1 ; -if (memcmp (&mad->fc_iu.response[4 ], &tgt->ids.node_name, -sizeof (tgt->ids.node_name))) +if (wwn_to_u64 ((u8 *)&mad->fc_iu.response[4 ]) != tgt->ids.node_name)return 1 ;if (be32_to_cpu (mad->fc_iu.response[6 ]) != tgt->scsi_id)return 1 ;
drivers/scsi/iscsi_tcp.c +8 -0
@@ -37,6 +37,7 @@#include <linux/kfifo.h> #include <linux/scatterlist.h> #include <linux/module.h> +#include <linux/backing-dev.h> #include <net/tcp.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h>
@@ -954,6 +955,13 @@ static int iscsi_sw_tcp_slave_alloc(struct scsi_device *sdev)static int iscsi_sw_tcp_slave_configure (struct scsi_device *sdev) { +struct iscsi_sw_tcp_host *tcp_sw_host =iscsi_host_priv (sdev->host); +struct iscsi_session *session = tcp_sw_host->session; +struct iscsi_conn *conn = session->leadconn; + +if (conn->datadgst_en) + sdev->request_queue->backing_dev_info->capabilities + |=BDI_CAP_STABLE_WRITES ;blk_queue_bounce_limit (sdev->request_queue,BLK_BOUNCE_ANY );blk_queue_dma_alignment (sdev->request_queue,0 );return 0 ;
drivers/scsi/megaraid/megaraid_sas.h +1 -0
@@ -2128,6 +2128,7 @@ enum MR_PD_TYPE {struct megasas_instance { +unsigned int *reply_map;__le32 *producer;dma_addr_t producer_h;__le32 *consumer;
drivers/scsi/megaraid/megaraid_sas_base.c +36 -3
@@ -5165,6 +5165,26 @@ megasas_setup_jbod_map(struct megasas_instance *instance) instance->use_seqnum_jbod_fp = false; } +static void megasas_setup_reply_map (struct megasas_instance *instance) +{ +const struct cpumask *mask; +unsigned int queue, cpu; + +for (queue =0 ; queue < instance->msix_vectors; queue++) { + mask =pci_irq_get_affinity (instance->pdev, queue); +if (!mask) + goto fallback; + +for_each_cpu (cpu, mask) + instance->reply_map[cpu] = queue; + } +return ; + +fallback: +for_each_possible_cpu (cpu) + instance->reply_map[cpu] = cpu % instance->msix_vectors; +} +/** * megasas_init_fw - Initializes the FW * @instance: Adapter soft state
@@ -5343,6 +5363,8 @@ static int megasas_init_fw(struct megasas_instance *instance) goto fail_setup_irqs; } +megasas_setup_reply_map (instance); +dev_info (&instance->pdev->dev,"firmware supports msix\t: (%d)" , fw_msix_count); dev_info(&instance->pdev->dev,
@@ -6123,20 +6145,29 @@ static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance)*/ static int megasas_alloc_ctrl_mem (struct megasas_instance *instance) { + instance->reply_map =kzalloc (sizeof (unsigned int ) * nr_cpu_ids, +GFP_KERNEL ); +if (!instance->reply_map) +return -ENOMEM ; +switch (instance->adapter_type) {case MFI_SERIES :if (megasas_alloc_mfi_ctrl_mem (instance)) -return -ENOMEM ; + goto fail;break ;case VENTURA_SERIES :case THUNDERBOLT_SERIES :case INVADER_SERIES :if (megasas_alloc_fusion_context (instance)) -return -ENOMEM ; + goto fail;break ; }return 0 ; + fail: +kfree (instance->reply_map); + instance->reply_map =NULL ; +return -ENOMEM ; }/*
@@ -6148,6 +6179,7 @@ static int megasas_alloc_ctrl_mem(struct megasas_instance *instance)*/ static inline void megasas_free_ctrl_mem (struct megasas_instance *instance) { +kfree (instance->reply_map);if (instance->adapter_type ==MFI_SERIES ) {if (instance->producer) pci_free_consistent(instance->pdev, sizeof(u32),
@@ -6540,7 +6572,6 @@ static int megasas_probe_one(struct pci_dev *pdev,pci_free_irq_vectors (instance->pdev); fail_init_mfi:scsi_host_put (host); - fail_alloc_instance:pci_disable_device (pdev);
@@ -6746,6 +6777,8 @@ megasas_resume(struct pci_dev *pdev)if (rval <0 ) goto fail_reenable_msix; +megasas_setup_reply_map (instance); +if (instance->adapter_type !=MFI_SERIES ) {megasas_reset_reply_desc (instance);if (megasas_ioc_init_fusion (instance)) {
drivers/scsi/megaraid/megaraid_sas_fusion.c +4 -8
@@ -2641,11 +2641,8 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, fp_possible = (io_info.fpOkForIo >0 ) ? true : false; } -/* Use raw_smp_processor_id() for now until cmd->request->cpu is CPU -id by default, not CPU group id, otherwise all MSI-X queues won't -be utilized */ - cmd->request_desc->SCSIIO.MSIxIndex = instance->msix_vectors ? -raw_smp_processor_id () % instance->msix_vectors :0 ; + cmd->request_desc->SCSIIO.MSIxIndex = + instance->reply_map[raw_smp_processor_id ()]; praid_context = &io_request->RaidContext;
@@ -2971,10 +2968,9 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, } cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; - cmd->request_desc->SCSIIO.MSIxIndex = - instance->msix_vectors ? - (raw_smp_processor_id () % instance->msix_vectors) :0 ; + cmd->request_desc->SCSIIO.MSIxIndex = + instance->reply_map[raw_smp_processor_id ()];if (!fp_possible) {/* system pd firmware path */
drivers/scsi/sd.c +2 -0
@@ -2513,6 +2513,8 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) sector_size = old_sector_size; goto got_data; } +/* Remember that READ CAPACITY(16) succeeded */ + sdp->try_rc_10_first =0 ; } }
drivers/scsi/virtio_scsi.c +16 -113
196 lines not on this page · raw message
include/scsi/scsi_host.h +3 -0
@@ -452,6 +452,9 @@ struct scsi_host_template {/* True if the controller does not support WRITE SAME */ unsigned no_write_same:1; +/* True if the low-level driver supports blk-mq only */ + unsigned force_blk_mq:1; +/* * Countdown for host blocking with no commands outstanding. */