[PATCH 23/23] qla2xxx: Add IOCB Abort command asynchronous handling.
From: Armen Baloyan armen.balo...@qlogic.com Send aborts to the firmware via the request/response queue mechanism. Signed-off-by: Armen Baloyan armen.balo...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_gbl.h |2 +- drivers/scsi/qla2xxx/qla_init.c | 88 +++ drivers/scsi/qla2xxx/qla_iocb.c | 27 +++- drivers/scsi/qla2xxx/qla_isr.c | 21 + drivers/scsi/qla2xxx/qla_mbx.c |3 + drivers/scsi/qla2xxx/qla_mr.c | 88 --- drivers/scsi/qla2xxx/qla_os.c |2 +- 7 files changed, 140 insertions(+), 91 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index dcd084a..e665e81 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -330,6 +330,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *, dma_addr_t); extern int qla24xx_abort_command(srb_t *); +extern int qla24xx_async_abort_command(srb_t *); extern int qla24xx_abort_target(struct fc_port *, unsigned int, int); extern int @@ -604,7 +605,6 @@ extern char *qlafx00_fw_version_str(struct scsi_qla_host *, char *); extern irqreturn_t qlafx00_intr_handler(int, void *); extern void qlafx00_enable_intrs(struct qla_hw_data *); extern void qlafx00_disable_intrs(struct qla_hw_data *); -extern int qlafx00_abort_command(srb_t *); extern int qlafx00_abort_target(fc_port_t *, unsigned int, int); extern int qlafx00_lun_reset(fc_port_t *, unsigned int, int); extern int qlafx00_start_scsi(srb_t *); diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 2724842..0a25e8b 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -347,6 +347,94 @@ done: return rval; } +static void +qla24xx_abort_iocb_timeout(void *data) +{ + srb_t *sp = (srb_t *)data; + struct srb_iocb *abt = sp-u.iocb_cmd; + + abt-u.abt.comp_status = CS_TIMEOUT; + complete(abt-u.abt.comp); +} + +static void +qla24xx_abort_sp_done(void *data, void *ptr, int res) +{ + srb_t *sp = (srb_t *)ptr; + struct srb_iocb *abt = sp-u.iocb_cmd; + + complete(abt-u.abt.comp); +} + +static int +qla24xx_async_abort_cmd(srb_t *cmd_sp) +{ + scsi_qla_host_t *vha = cmd_sp-fcport-vha; + fc_port_t *fcport = cmd_sp-fcport; + struct srb_iocb *abt_iocb; + srb_t *sp; + int rval = QLA_FUNCTION_FAILED; + + sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); + if (!sp) + goto done; + + abt_iocb = sp-u.iocb_cmd; + sp-type = SRB_ABT_CMD; + sp-name = abort; + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha)); + abt_iocb-u.abt.cmd_hndl = cmd_sp-handle; + sp-done = qla24xx_abort_sp_done; + abt_iocb-timeout = qla24xx_abort_iocb_timeout; + init_completion(abt_iocb-u.abt.comp); + + rval = qla2x00_start_sp(sp); + if (rval != QLA_SUCCESS) + goto done_free_sp; + + ql_dbg(ql_dbg_async, vha, 0x507c, + Abort command issued - hdl=%x, target_id=%x\n, + cmd_sp-handle, fcport-tgt_id); + + wait_for_completion(abt_iocb-u.abt.comp); + + rval = abt_iocb-u.abt.comp_status == CS_COMPLETE ? + QLA_SUCCESS : QLA_FUNCTION_FAILED; + +done_free_sp: + sp-free(vha, sp); +done: + return rval; +} + +int +qla24xx_async_abort_command(srb_t *sp) +{ + unsigned long flags = 0; + + uint32_thandle; + fc_port_t *fcport = sp-fcport; + struct scsi_qla_host *vha = fcport-vha; + struct qla_hw_data *ha = vha-hw; + struct req_que *req = vha-req; + + spin_lock_irqsave(ha-hardware_lock, flags); + for (handle = 1; handle req-num_outstanding_cmds; handle++) { + if (req-outstanding_cmds[handle] == sp) + break; + } + spin_unlock_irqrestore(ha-hardware_lock, flags); + if (handle == req-num_outstanding_cmds) { + /* Command not found. */ + return QLA_FUNCTION_FAILED; + } + if (sp-type == SRB_FXIOCB_DCMD) + return qlafx00_fx_disc(vha, vha-hw-mr.fcport, + FXDISC_ABORT_IOCTL); + + return qla24xx_async_abort_cmd(sp); +} + void qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport, uint16_t *data) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 0aad5e4..8c5dec2 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2585,6 +2585,29 @@ queuing_error: return QLA_FUNCTION_FAILED; } +void +qla24xx_abort_iocb(srb_t *sp, struct abort_entry_24xx *abt_iocb) +{ + struct srb_iocb *aio = sp-u.iocb_cmd; + scsi_qla_host_t *vha = sp-fcport-vha; + struct req_que *req = vha-req; + + memset(abt_iocb, 0, sizeof(struct abort_entry_24xx)); +
[PATCH RESUBMIT 13/23] qla2xxx: Remove ISP_ABORT_NEEDED and ISP_ABORT_RETRY checks from watchdog function for ISP8044.
From: Atul Deshmukh atul.deshm...@qlogic.com Signed-off-by: Atul Deshmukh atul.deshm...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_nx2.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c index 1f4c72a..b7ed478 100644 --- a/drivers/scsi/qla2xxx/qla_nx2.c +++ b/drivers/scsi/qla2xxx/qla_nx2.c @@ -2014,8 +2014,6 @@ qla8044_watchdog(struct scsi_qla_host *vha) /* don't poll if reset is going on or FW hang in quiescent state */ if (!(test_bit(ABORT_ISP_ACTIVE, vha-dpc_flags) || - test_bit(ISP_ABORT_NEEDED, vha-dpc_flags) || - test_bit(ISP_ABORT_RETRY, vha-dpc_flags) || test_bit(FCOE_CTX_RESET_NEEDED, vha-dpc_flags))) { dev_state = qla8044_rd_direct(vha, QLA8044_CRB_DEV_STATE_INDEX); -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] qla2xxx: Poll during initialization for ISP25xx and ISP83xx.
From: Giridhar Malavali giridhar.malav...@qlogic.com This patch is for 3.14-rc. Cc: sta...@vger.kernel.org Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_def.h |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index e1fe95e..266724b 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2996,8 +2996,7 @@ struct qla_hw_data { IS_QLA82XX(ha) || IS_QLA83XX(ha) || \ IS_QLA8044(ha)) #define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA83XX(ha)) -#define IS_NOPOLLING_TYPE(ha) ((IS_QLA25XX(ha) || IS_QLA81XX(ha) || \ - IS_QLA83XX(ha)) (ha)-flags.msix_enabled) +#define IS_NOPOLLING_TYPE(ha) (IS_QLA81XX(ha) (ha)-flags.msix_enabled) #define IS_FAC_REQUIRED(ha)(IS_QLA81XX(ha) || IS_QLA83XX(ha)) #define IS_NOCACHE_VPD_TYPE(ha)(IS_QLA81XX(ha) || IS_QLA83XX(ha)) #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 21/23] qla2xxx: Correct the port no assignment for ISP82XX.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_os.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 61d42af..7b54e0a 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2271,7 +2271,7 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha) } if (IS_QLA82XX(ha)) - ha-port_no = !(ha-portnum 1); + ha-port_no = ha-portnum 1; else { /* Get adapter physical port no from interrupt pin register. */ pci_read_config_byte(ha-pdev, PCI_INTERRUPT_PIN, ha-port_no); -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 19/23] qla2xxx: Fix multiqueue MSI-X registration.
From: Chad Dupuis chad.dup...@qlogic.com This fixes requesting of the MSI-X vectors for the base response queue. The iteration in the for loop in qla24xx_enable_msix() was incorrect. We should only iterate of the first two MSI-X vectors and not the total number of MSI-X vectors that have given to the driver for this device from pci_enable_msix() in this function. Cc: sta...@vger.kernel.org Signed-off-by: Chad Dupuis chad.dup...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_isr.c | 46 ++-- 1 files changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index da5f466..c2aaf6a 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2882,6 +2882,7 @@ static int qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) { #define MIN_MSIX_COUNT 2 +#define ATIO_VECTOR2 int i, ret; struct msix_entry *entries; struct qla_msix_entry *qentry; @@ -2938,34 +2939,47 @@ msix_failed: } /* Enable MSI-X vectors for the base queue */ - for (i = 0; i ha-msix_count; i++) { + for (i = 0; i 2; i++) { qentry = ha-msix_entries[i]; - if (QLA_TGT_MODE_ENABLED() IS_ATIO_MSIX_CAPABLE(ha)) { - ret = request_irq(qentry-vector, - qla83xx_msix_entries[i].handler, - 0, qla83xx_msix_entries[i].name, rsp); - } else if (IS_P3P_TYPE(ha)) { + if (IS_P3P_TYPE(ha)) ret = request_irq(qentry-vector, qla82xx_msix_entries[i].handler, 0, qla82xx_msix_entries[i].name, rsp); - } else { + else ret = request_irq(qentry-vector, msix_entries[i].handler, 0, msix_entries[i].name, rsp); - } - if (ret) { - ql_log(ql_log_fatal, vha, 0x00cb, - MSI-X: unable to register handler -- %x/%d.\n, - qentry-vector, ret); - qla24xx_disable_msix(ha); - ha-mqenable = 0; - goto msix_out; - } + if (ret) + goto msix_register_fail; qentry-have_irq = 1; qentry-rsp = rsp; rsp-msix = qentry; } + /* +* If target mode is enable, also request the vector for the ATIO +* queue. +*/ + if (QLA_TGT_MODE_ENABLED() IS_ATIO_MSIX_CAPABLE(ha)) { + qentry = ha-msix_entries[ATIO_VECTOR]; + ret = request_irq(qentry-vector, + qla83xx_msix_entries[ATIO_VECTOR].handler, + 0, qla83xx_msix_entries[ATIO_VECTOR].name, rsp); + qentry-have_irq = 1; + qentry-rsp = rsp; + rsp-msix = qentry; + } + +msix_register_fail: + if (ret) { + ql_log(ql_log_fatal, vha, 0x00cb, + MSI-X: unable to register handler -- %x/%d.\n, + qentry-vector, ret); + qla24xx_disable_msix(ha); + ha-mqenable = 0; + goto msix_out; + } + /* Enable MSI-X vector for response queue update for queue 0 */ if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) { if (ha-msixbase ha-mqiobase -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 06/23] qla2xxx: Select correct request queue for error type IOCB for ISPFX00.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_mr.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index 4542247..9839da8 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -2794,7 +2794,7 @@ qlafx00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, srb_t *sp; struct qla_hw_data *ha = vha-hw; const char func[] = ERROR-IOCB; - uint16_t que = MSW(pkt-handle); + uint16_t que = 0; struct req_que *req = NULL; int res = DID_ERROR 16; -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 15/23] qla2xxx: Avoid poisoning in the response queue for ISPFX00.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_mr.c | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index 03e2050..290322f 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -2821,16 +2821,22 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha, { struct sts_entry_fx00 *pkt; response_t *lptr; + uint16_t lreq_q_in = 0; + uint16_t lreq_q_out = 0; - while (RD_REG_DWORD((void __iomem *)(rsp-ring_ptr-signature)) != - RESPONSE_PROCESSED) { + lreq_q_in = RD_REG_DWORD(rsp-rsp_q_in); + lreq_q_out = RD_REG_DWORD(rsp-rsp_q_out); + + while (lreq_q_in != lreq_q_out) { lptr = rsp-ring_ptr; memcpy_fromio(rsp-rsp_pkt, (void __iomem *)lptr, sizeof(rsp-rsp_pkt)); pkt = (struct sts_entry_fx00 *)rsp-rsp_pkt; rsp-ring_index++; + lreq_q_out++; if (rsp-ring_index == rsp-length) { + lreq_q_out = 0; rsp-ring_index = 0; rsp-ring_ptr = rsp-ring; } else { @@ -2842,7 +2848,6 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha, qlafx00_error_entry(vha, rsp, (struct sts_entry_fx00 *)pkt, pkt-entry_status, pkt-entry_type); - goto next_iter; continue; } @@ -2876,10 +2881,6 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha, pkt-entry_type, pkt-entry_status); break; } -next_iter: - WRT_REG_DWORD((void __iomem *)lptr-signature, - RESPONSE_PROCESSED); - wmb(); } /* Adjust ring index */ -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 01/23] qla2xxx: Add mutex around optrom calls to serialize accesses.
From: Chad Dupuis chad.dup...@qlogic.com Signed-off-by: Chad Dupuis chad.dup...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_attr.c | 61 ++ drivers/scsi/qla2xxx/qla_bsg.c | 12 ++- drivers/scsi/qla2xxx/qla_def.h |1 + drivers/scsi/qla2xxx/qla_os.c |1 + 4 files changed, 54 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 4a0d7c9..c214441 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -241,12 +241,17 @@ qla2x00_sysfs_read_optrom(struct file *filp, struct kobject *kobj, struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj, struct device, kobj))); struct qla_hw_data *ha = vha-hw; + ssize_t rval = 0; if (ha-optrom_state != QLA_SREADING) return 0; - return memory_read_from_buffer(buf, count, off, ha-optrom_buffer, - ha-optrom_region_size); + mutex_lock(ha-optrom_mutex); + rval = memory_read_from_buffer(buf, count, off, ha-optrom_buffer, + ha-optrom_region_size); + mutex_unlock(ha-optrom_mutex); + + return rval; } static ssize_t @@ -265,7 +270,9 @@ qla2x00_sysfs_write_optrom(struct file *filp, struct kobject *kobj, if (off + count ha-optrom_region_size) count = ha-optrom_region_size - off; + mutex_lock(ha-optrom_mutex); memcpy(ha-optrom_buffer[off], buf, count); + mutex_unlock(ha-optrom_mutex); return count; } @@ -288,10 +295,10 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj, struct device, kobj))); struct qla_hw_data *ha = vha-hw; - uint32_t start = 0; uint32_t size = ha-optrom_size; int val, valid; + ssize_t rval = count; if (off) return -EINVAL; @@ -304,12 +311,14 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, if (start ha-optrom_size) return -EINVAL; + mutex_lock(ha-optrom_mutex); switch (val) { case 0: if (ha-optrom_state != QLA_SREADING - ha-optrom_state != QLA_SWRITING) - return -EINVAL; - + ha-optrom_state != QLA_SWRITING) { + rval = -EINVAL; + goto out; + } ha-optrom_state = QLA_SWAITING; ql_dbg(ql_dbg_user, vha, 0x7061, @@ -320,8 +329,10 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, ha-optrom_buffer = NULL; break; case 1: - if (ha-optrom_state != QLA_SWAITING) - return -EINVAL; + if (ha-optrom_state != QLA_SWAITING) { + rval = -EINVAL; + goto out; + } ha-optrom_region_start = start; ha-optrom_region_size = start + size ha-optrom_size ? @@ -335,13 +346,15 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, (%x).\n, ha-optrom_region_size); ha-optrom_state = QLA_SWAITING; - return -ENOMEM; + rval = -ENOMEM; + goto out; } if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x7063, HBA not online, failing NVRAM update.\n); - return -EAGAIN; + rval = -EAGAIN; + goto out; } ql_dbg(ql_dbg_user, vha, 0x7064, @@ -353,8 +366,10 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, ha-optrom_region_start, ha-optrom_region_size); break; case 2: - if (ha-optrom_state != QLA_SWAITING) - return -EINVAL; + if (ha-optrom_state != QLA_SWAITING) { + rval = -EINVAL; + goto out; + } /* * We need to be more restrictive on which FLASH regions are @@ -388,7 +403,8 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, if (!valid) { ql_log(ql_log_warn, vha, 0x7065, Invalid start region 0x%x/0x%x.\n, start, size); - return -EINVAL; + rval = -EINVAL; + goto out; } ha-optrom_region_start = start; @@ -403,7 +419,8 @@
[PATCH 22/23] qla2xxx: Fix Task Management command asynchronous handling
From: Armen Baloyan armen.balo...@qlogic.com - Fix interpreting the wrong IOCB type for task management functions in the response path. - Merge the task management function handling for various adapters. Signed-off-by: Armen Baloyan armen.balo...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_dbg.c |1 + drivers/scsi/qla2xxx/qla_init.c | 79 +- drivers/scsi/qla2xxx/qla_isr.c | 46 +++ drivers/scsi/qla2xxx/qla_mr.c | 66 +--- 4 files changed, 69 insertions(+), 123 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index c68b600..97255f7 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -34,6 +34,7 @@ * | || 0x5047,0x5052 | * | || 0x5084,0x5075 | * | || 0x503d,0x5044 | + * | || 0x507b | * | Timer Routines | 0x6012 || * | User Space Interactions | 0x70e2 | 0x7018,0x702e | * | || 0x7020,0x7024 | diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index f75d19f..2724842 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -271,56 +271,46 @@ done: } static void -qla2x00_async_tm_cmd_done(void *data, void *ptr, int res) +qla2x00_tmf_iocb_timeout(void *data) { - srb_t *sp = (srb_t *)ptr; - struct srb_iocb *iocb = sp-u.iocb_cmd; - struct scsi_qla_host *vha = (scsi_qla_host_t *)data; - uint32_t flags; - uint16_t lun; - int rval; - - if (!test_bit(UNLOADING, vha-dpc_flags)) { - flags = iocb-u.tmf.flags; - lun = (uint16_t)iocb-u.tmf.lun; + srb_t *sp = (srb_t *)data; + struct srb_iocb *tmf = sp-u.iocb_cmd; - /* Issue Marker IOCB */ - rval = qla2x00_marker(vha, vha-hw-req_q_map[0], - vha-hw-rsp_q_map[0], sp-fcport-loop_id, lun, - flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID); + tmf-u.tmf.comp_status = CS_TIMEOUT; + complete(tmf-u.tmf.comp); +} - if ((rval != QLA_SUCCESS) || iocb-u.tmf.data) { - ql_dbg(ql_dbg_taskm, vha, 0x8030, - TM IOCB failed (%x).\n, rval); - } - } - sp-free(sp-fcport-vha, sp); +static void +qla2x00_tmf_sp_done(void *data, void *ptr, int res) +{ + srb_t *sp = (srb_t *)ptr; + struct srb_iocb *tmf = sp-u.iocb_cmd; + complete(tmf-u.tmf.comp); } int -qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t tm_flags, uint32_t lun, +qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun, uint32_t tag) { struct scsi_qla_host *vha = fcport-vha; + struct srb_iocb *tm_iocb; srb_t *sp; - struct srb_iocb *tcf; - int rval; + int rval = QLA_FUNCTION_FAILED; - rval = QLA_FUNCTION_FAILED; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; + tm_iocb = sp-u.iocb_cmd; sp-type = SRB_TM_CMD; sp-name = tmf; - qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); - - tcf = sp-u.iocb_cmd; - tcf-u.tmf.flags = tm_flags; - tcf-u.tmf.lun = lun; - tcf-u.tmf.data = tag; - tcf-timeout = qla2x00_async_iocb_timeout; - sp-done = qla2x00_async_tm_cmd_done; + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha)); + tm_iocb-u.tmf.flags = flags; + tm_iocb-u.tmf.lun = lun; + tm_iocb-u.tmf.data = tag; + sp-done = qla2x00_tmf_sp_done; + tm_iocb-timeout = qla2x00_tmf_iocb_timeout; + init_completion(tm_iocb-u.tmf.comp); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) @@ -330,10 +320,29 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t tm_flags, uint32_t lun, Async-tmf hdl=%x loop-id=%x portid=%02x%02x%02x.\n, sp-handle, fcport-loop_id, fcport-d_id.b.domain, fcport-d_id.b.area, fcport-d_id.b.al_pa); - return rval; + + wait_for_completion(tm_iocb-u.tmf.comp); + + rval = tm_iocb-u.tmf.comp_status == CS_COMPLETE ? + QLA_SUCCESS : QLA_FUNCTION_FAILED; + + if ((rval != QLA_SUCCESS) || tm_iocb-u.tmf.data) { + ql_dbg(ql_dbg_taskm, vha, 0x8030, + TM IOCB failed (%x).\n, rval); + } + + if (!test_bit(UNLOADING, vha-dpc_flags) !IS_QLAFX00(vha-hw)) { + flags = tm_iocb-u.tmf.flags; + lun = (uint16_t)tm_iocb-u.tmf.lun; + + /* Issue Marker IOCB */ +
[PATCH RESUBMIT 12/23] qla2xxx: Remove Marker type IOCB logic for ISPFX00.
From: Armen Baloyan armen.balo...@qlogic.com Signed-off-by: Armen Baloyan armen.balo...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_iocb.c | 11 +-- drivers/scsi/qla2xxx/qla_mr.c | 12 drivers/scsi/qla2xxx/qla_mr.h | 24 3 files changed, 1 insertions(+), 46 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 5e6ac6c..0aad5e4 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -524,7 +524,6 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req, { mrk_entry_t *mrk; struct mrk_entry_24xx *mrk24 = NULL; - struct mrk_entry_fx00 *mrkfx = NULL; struct qla_hw_data *ha = vha-hw; scsi_qla_host_t *base_vha = pci_get_drvdata(ha-pdev); @@ -541,15 +540,7 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req, mrk-entry_type = MARKER_TYPE; mrk-modifier = type; if (type != MK_SYNC_ALL) { - if (IS_QLAFX00(ha)) { - mrkfx = (struct mrk_entry_fx00 *) mrk; - mrkfx-handle = MAKE_HANDLE(req-id, mrkfx-handle); - mrkfx-handle_hi = 0; - mrkfx-tgt_id = cpu_to_le16(loop_id); - mrkfx-lun[1] = LSB(lun); - mrkfx-lun[2] = MSB(lun); - host_to_fcp_swap(mrkfx-lun, sizeof(mrkfx-lun)); - } else if (IS_FWI2_CAPABLE(ha)) { + if (IS_FWI2_CAPABLE(ha)) { mrk24 = (struct mrk_entry_24xx *) mrk; mrk24-nport_handle = cpu_to_le16(loop_id); mrk24-lun[1] = LSB(lun); diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index a9b5cf4..893e56d 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -2140,7 +2140,6 @@ qlafx00_initialize_adapter(scsi_qla_host_t *vha) vha-device_flags = DFLG_NO_CABLE; vha-dpc_flags = 0; vha-flags.management_server_logged_in = 0; - vha-marker_needed = 0; ha-isp_abort_cnt = 0; ha-beacon_blink_led = 0; @@ -3213,17 +3212,6 @@ qlafx00_start_scsi(srb_t *sp) /* So we know we haven't pci_map'ed anything yet */ tot_dsds = 0; - /* Forcing marker needed for now */ - vha-marker_needed = 0; - - /* Send marker if required */ - if (vha-marker_needed != 0) { - if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL) != - QLA_SUCCESS) - return QLA_FUNCTION_FAILED; - vha-marker_needed = 0; - } - /* Acquire ring specific lock */ spin_lock_irqsave(ha-hardware_lock, flags); diff --git a/drivers/scsi/qla2xxx/qla_mr.h b/drivers/scsi/qla2xxx/qla_mr.h index 5f3ed8b..1e60ca2 100644 --- a/drivers/scsi/qla2xxx/qla_mr.h +++ b/drivers/scsi/qla2xxx/qla_mr.h @@ -47,30 +47,6 @@ struct cmd_type_7_fx00 { uint32_t dseg_0_len;/* Data segment 0 length. */ }; -/* - * ISP queue - marker entry structure definition. - */ -struct mrk_entry_fx00 { - uint8_t entry_type; /* Entry type. */ - uint8_t entry_count;/* Entry count. */ - uint8_t handle_count; /* Handle count. */ - uint8_t entry_status; /* Entry Status. */ - - uint32_t handle;/* System handle. */ - uint32_t handle_hi; /* System handle. */ - - uint16_t tgt_id;/* Target ID. */ - - uint8_t modifier; /* Modifier (7-0). */ - uint8_t reserved_1; - - uint8_t reserved_2[5]; - - uint8_t lun[8]; /* FCP LUN (BE). */ - uint8_t reserved_3[36]; -}; - - #defineSTATUS_TYPE_FX000x01/* Status entry. */ struct sts_entry_fx00 { uint8_t entry_type; /* Entry type. */ -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 05/23] qla2xxx: Remove init control block related dead code for ISPFX00.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_def.h | 24 drivers/scsi/qla2xxx/qla_mr.c | 14 -- drivers/scsi/qla2xxx/qla_os.c |1 - 3 files changed, 0 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 4c286eb..638bdcc 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -1197,30 +1197,6 @@ typedef struct { uint8_t reserved_3[26]; } init_cb_t; - -struct init_cb_fx { - uint16_tversion; - uint16_treserved_1[13]; - __le16 request_q_outpointer; - __le16 response_q_inpointer; - uint16_treserved_2[2]; - __le16 response_q_length; - __le16 request_q_length; - uint16_treserved_3[2]; - __le32 request_q_address[2]; - __le32 response_q_address[2]; - uint16_treserved_4[4]; - uint8_t response_q_msivec; - uint8_t reserved_5[19]; - uint16_tinterrupt_delay_timer; - uint16_treserved_6; - uint32_tfwoptions1; - uint32_tfwoptions2; - uint32_tfwoptions3; - uint8_t reserved_7[24]; -}; - - /* * Get Link Status mailbox command return buffer. */ diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index 7c7849d..4542247 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -631,20 +631,6 @@ qlafx00_config_rings(struct scsi_qla_host *vha) { struct qla_hw_data *ha = vha-hw; struct device_reg_fx00 __iomem *reg = ha-iobase-ispfx00; - struct init_cb_fx *icb; - struct req_que *req = ha-req_q_map[0]; - struct rsp_que *rsp = ha-rsp_q_map[0]; - - /* Setup ring parameters in initialization control block. */ - icb = (struct init_cb_fx *)ha-init_cb; - icb-request_q_outpointer = __constant_cpu_to_le16(0); - icb-response_q_inpointer = __constant_cpu_to_le16(0); - icb-request_q_length = cpu_to_le16(req-length); - icb-response_q_length = cpu_to_le16(rsp-length); - icb-request_q_address[0] = cpu_to_le32(LSD(req-dma)); - icb-request_q_address[1] = cpu_to_le32(MSD(req-dma)); - icb-response_q_address[0] = cpu_to_le32(LSD(rsp-dma)); - icb-response_q_address[1] = cpu_to_le32(MSD(rsp-dma)); WRT_REG_DWORD(reg-req_q_in, 0); WRT_REG_DWORD(reg-req_q_out, 0); diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 53edc4b..c698e10 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2489,7 +2489,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ha-aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; req_length = REQUEST_ENTRY_CNT_FX00; rsp_length = RESPONSE_ENTRY_CNT_FX00; - ha-init_cb_size = sizeof(struct init_cb_fx); ha-isp_ops = qlafx00_isp_ops; ha-port_down_retry_count = 30; /* default value */ ha-mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/23] qla2xxx: Patches for 3.15 scsi misc branch.
From: Chad Dupuis chad.dup...@qlogic.com Hi James, Please apply the following patches to the scsi tree, misc branch at your earliest convenience. This patch set is a resubmission of a patch set we had previously submitted plus three new patches and that this supersedes what was posted in December. Thanks, ~Saurav Armen Baloyan (6): qla2xxx: Add handling for boot indication progress AENs for ISPFX00. qla2xxx: Replace constant value for IOCTL IOCB abort execution status with a macro for ISPFX00. qla2xxx: Remove Marker type IOCB logic for ISPFX00. qla2xxx: Add changes in the IOCB structures to adjust driver source codes to ISPFX00 firmware spec. qla2xxx: Fix Task Management command asynchronous handling qla2xxx: Add IOCB Abort command asynchronous handling. Atul Deshmukh (2): qla2xxx: Use proper message for Non owner reset ACK Timeout. qla2xxx: Remove ISP_ABORT_NEEDED and ISP_ABORT_RETRY checks from watchdog function for ISP8044. Chad Dupuis (6): qla2xxx: Add mutex around optrom calls to serialize accesses. qla2xxx: Set host can_queue value based on available resources. scsi_transport_fc: Add 32Gbps speed definition. qla2xxx: Add support for ISP2071. qla2xxx: Read capture firmware dump on mailbox timeout for ISP8044 and ISP82XX. qla2xxx: Fix multiqueue MSI-X registration. Joe Carnuccio (1): qla2xxx: Enable the Flash Access Control (FAC) mailbox command. Saurav Kashyap (8): qla2xxx: Remove init control block related dead code for ISPFX00. qla2xxx: Select correct request queue for error type IOCB for ISPFX00. qla2xxx: Properly handle 32 bit mailbox register for ISPFX00. qla2xxx: Avoid poisoning in the response queue for ISPFX00. qla2xxx: Simplify the ISPFX00 interrupt handler code for ISPFX00. qla2xxx: Correctly set the read_optrom pointer for ISP8044. qla2xxx: Update the driver version to 8.07.00.02-k. qla2xxx: Correct the port no assignment for ISP82XX. drivers/scsi/qla2xxx/Makefile |2 +- drivers/scsi/qla2xxx/qla_attr.c| 193 +++- drivers/scsi/qla2xxx/qla_bsg.c | 12 +- drivers/scsi/qla2xxx/qla_dbg.c | 134 +- drivers/scsi/qla2xxx/qla_dbg.h |7 + drivers/scsi/qla2xxx/qla_def.h | 65 ++-- drivers/scsi/qla2xxx/qla_dfs.c |3 +- drivers/scsi/qla2xxx/qla_fw.h |4 + drivers/scsi/qla2xxx/qla_gbl.h | 12 +- drivers/scsi/qla2xxx/qla_gs.c | 11 + drivers/scsi/qla2xxx/qla_init.c| 426 +++--- drivers/scsi/qla2xxx/qla_iocb.c| 42 ++- drivers/scsi/qla2xxx/qla_isr.c | 139 -- drivers/scsi/qla2xxx/qla_mbx.c | 50 ++- drivers/scsi/qla2xxx/qla_mid.c |4 +- drivers/scsi/qla2xxx/qla_mr.c | 252 ++- drivers/scsi/qla2xxx/qla_mr.h | 57 +-- drivers/scsi/qla2xxx/qla_nx.c | 21 +- drivers/scsi/qla2xxx/qla_nx2.c | 22 +- drivers/scsi/qla2xxx/qla_os.c | 155 +-- drivers/scsi/qla2xxx/qla_sup.c | 65 ++- drivers/scsi/qla2xxx/qla_tmpl.c| 909 drivers/scsi/qla2xxx/qla_tmpl.h| 205 drivers/scsi/qla2xxx/qla_version.h |4 +- drivers/scsi/scsi_transport_fc.c |1 + include/scsi/scsi_transport_fc.h |1 + 26 files changed, 2248 insertions(+), 548 deletions(-) create mode 100644 drivers/scsi/qla2xxx/qla_tmpl.c create mode 100644 drivers/scsi/qla2xxx/qla_tmpl.h -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 02/23] qla2xxx: Add handling for boot indication progress AENs for ISPFX00.
From: Armen Baloyan armen.balo...@qlogic.com Signed-off-by: Armen Baloyan armen.balo...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_def.h |2 +- drivers/scsi/qla2xxx/qla_mr.c |3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 7c69729..4c286eb 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -808,7 +808,7 @@ struct mbx_cmd_32 { Notification */ #define MBA_FW_POLL_STATE 0x8600 /* Firmware in poll diagnostic state */ #define MBA_FW_RESET_FCT 0x8502 /* Firmware reset factory defaults */ - +#define MBA_FW_INIT_INPROGRESS 0x8500 /* Firmware boot in progress */ /* 83XX FCoE specific */ #define MBA_IDC_AEN0x8200 /* FCoE: NIC Core state change AEN */ diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index ba6f8b1..6ca4807 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -997,6 +997,9 @@ qlafx00_init_fw_ready(scsi_qla_host_t *vha) break; default: + if ((aenmbx 0xFF00) == MBA_FW_INIT_INPROGRESS) + break; + /* If fw is apparently not ready. In order to continue, * we might need to issue Mbox cmd, but the problem is * that the DoorBell vector values that come with the -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 09/23] qla2xxx: Set host can_queue value based on available resources.
From: Chad Dupuis chad.dup...@qlogic.com Tell the mid-layer that number of commands we can queue is the available resources we have minus a small amount for internal commands. Signed-off-by: Chad Dupuis chad.dup...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_os.c | 19 ++- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index c698e10..925d45c 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2561,10 +2561,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) host = base_vha-host; base_vha-req = req; - if (IS_QLAFX00(ha)) - host-can_queue = QLAFX00_MAX_CANQUEUE; - else - host-can_queue = req-length + 128; if (IS_QLA2XXX_MIDTYPE(ha)) base_vha-mgmt_svr_loop_id = 10 + base_vha-vp_idx; else @@ -2587,11 +2583,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) if (!IS_QLA82XX(ha)) host-sg_tablesize = QLA_SG_ALL; } - ql_dbg(ql_dbg_init, base_vha, 0x0032, - can_queue=%d, req=%p, - mgmt_svr_loop_id=%d, sg_tablesize=%d.\n, - host-can_queue, base_vha-req, - base_vha-mgmt_svr_loop_id, host-sg_tablesize); host-max_id = ha-max_fibre_devices; host-cmd_per_lun = 3; host-unique_id = host-host_no; @@ -2707,6 +2698,16 @@ que_init: goto probe_failed; } + if (IS_QLAFX00(ha)) + host-can_queue = QLAFX00_MAX_CANQUEUE; + else + host-can_queue = req-num_outstanding_cmds - 10; + + ql_dbg(ql_dbg_init, base_vha, 0x0032, + can_queue=%d, req=%p, mgmt_svr_loop_id=%d, sg_tablesize=%d.\n, + host-can_queue, base_vha-req, + base_vha-mgmt_svr_loop_id, host-sg_tablesize); + if (ha-mqenable) { if (qla25xx_setup_mode(base_vha)) { ql_log(ql_log_warn, base_vha, 0x00ec, -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 18/23] qla2xxx: Correctly set the read_optrom pointer for ISP8044.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_os.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7c36eb2..61d42af 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2017,7 +2017,7 @@ static struct isp_operations qla8044_isp_ops = { .beacon_on = qla82xx_beacon_on, .beacon_off = qla82xx_beacon_off, .beacon_blink = NULL, - .read_optrom= qla82xx_read_optrom_data, + .read_optrom= qla8044_read_optrom_data, .write_optrom = qla8044_write_optrom_data, .get_flash_version = qla82xx_get_flash_version, .start_scsi = qla82xx_start_scsi, -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 17/23] qla2xxx: Read capture firmware dump on mailbox timeout for ISP8044 and ISP82XX.
From: Chad Dupuis chad.dup...@qlogic.com Allow for the capture of a firmware dump but have a sysfs node (allow_cna_fw_dump) to allow the feature to be enabled/disabled dynamically. The default is off. Signed-off-by: Chad Dupuis chad.dup...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_attr.c | 35 +++ drivers/scsi/qla2xxx/qla_def.h |1 + drivers/scsi/qla2xxx/qla_gbl.h |2 ++ drivers/scsi/qla2xxx/qla_nx.c | 17 + drivers/scsi/qla2xxx/qla_nx2.c | 16 drivers/scsi/qla2xxx/qla_os.c |4 ++-- 6 files changed, 73 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index f2d42b9..aa81829 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -1503,6 +1503,37 @@ qla2x00_fw_dump_size_show(struct device *dev, struct device_attribute *attr, return scnprintf(buf, PAGE_SIZE, %d\n, size); } +static ssize_t +qla2x00_allow_cna_fw_dump_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); + + if (!IS_P3P_TYPE(vha-hw)) + return scnprintf(buf, PAGE_SIZE, \n); + else + return scnprintf(buf, PAGE_SIZE, %s\n, + vha-hw-allow_cna_fw_dump ? true : false); +} + +static ssize_t +qla2x00_allow_cna_fw_dump_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); + int val = 0; + + if (!IS_P3P_TYPE(vha-hw)) + return -EINVAL; + + if (sscanf(buf, %d, val) != 1) + return -EINVAL; + + vha-hw-allow_cna_fw_dump = val != 0; + + return strlen(buf); +} + static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); @@ -1544,6 +1575,9 @@ static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL); static DEVICE_ATTR(diag_requests, S_IRUGO, qla2x00_diag_requests_show, NULL); static DEVICE_ATTR(diag_megabytes, S_IRUGO, qla2x00_diag_megabytes_show, NULL); static DEVICE_ATTR(fw_dump_size, S_IRUGO, qla2x00_fw_dump_size_show, NULL); +static DEVICE_ATTR(allow_cna_fw_dump, S_IRUGO | S_IWUSR, + qla2x00_allow_cna_fw_dump_show, + qla2x00_allow_cna_fw_dump_store); struct device_attribute *qla2x00_host_attrs[] = { dev_attr_driver_version, @@ -1576,6 +1610,7 @@ struct device_attribute *qla2x00_host_attrs[] = { dev_attr_diag_requests, dev_attr_diag_megabytes, dev_attr_fw_dump_size, + dev_attr_allow_cna_fw_dump, NULL, }; diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 400ef02..6a10613 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3301,6 +3301,7 @@ struct qla_hw_data { struct mr_data_fx00 mr; struct qlt_hw_data tgt; + int allow_cna_fw_dump; }; /* diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 19a0662..dcd084a 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -511,6 +511,8 @@ extern void qla2300_fw_dump(scsi_qla_host_t *, int); extern void qla24xx_fw_dump(scsi_qla_host_t *, int); extern void qla25xx_fw_dump(scsi_qla_host_t *, int); extern void qla81xx_fw_dump(scsi_qla_host_t *, int); +extern void qla82xx_fw_dump(scsi_qla_host_t *, int); +extern void qla8044_fw_dump(scsi_qla_host_t *, int); extern void qla27xx_fwdump(scsi_qla_host_t *, int); extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *); diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 26326f3..5511e24 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c @@ -4502,3 +4502,20 @@ exit: qla82xx_idc_unlock(ha); return rval; } + +void +qla82xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) +{ + struct qla_hw_data *ha = vha-hw; + + if (!ha-allow_cna_fw_dump) + return; + + scsi_block_requests(vha-host); + ha-flags.isp82xx_no_md_cap = 1; + qla82xx_idc_lock(ha); + qla82xx_set_reset_owner(vha); + qla82xx_idc_unlock(ha); + qla2x00_wait_for_chip_reset(vha); + scsi_unblock_requests(vha-host); +} diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c index b7ed478..86cf108 100644 --- a/drivers/scsi/qla2xxx/qla_nx2.c +++ b/drivers/scsi/qla2xxx/qla_nx2.c @@ -3713,3 +3713,19 @@ exit_isp_reset: return rval; } +void +qla8044_fw_dump(scsi_qla_host_t *vha, int hardware_locked) +{ + struct qla_hw_data *ha = vha-hw; + + if
[PATCH RESUBMIT 07/23] qla2xxx: Enable the Flash Access Control (FAC) mailbox command.
From: Joe Carnuccio joe.carnuc...@qlogic.com Signed-off-by: Joe Carnuccio joe.carnuc...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_init.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index e7e5f4f..9b271cc 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1718,9 +1718,6 @@ enable_82xx_npiv: spin_unlock_irqrestore(ha-hardware_lock, flags); } - if (IS_QLA83XX(ha)) - goto skip_fac_check; - if (rval == QLA_SUCCESS IS_FAC_REQUIRED(ha)) { uint32_t size; @@ -1733,7 +1730,7 @@ enable_82xx_npiv: Unsupported FAC firmware (%d.%02d.%02d).\n, ha-fw_major_version, ha-fw_minor_version, ha-fw_subminor_version); -skip_fac_check: + if (IS_QLA83XX(ha)) { ha-flags.fac_supported = 0; rval = QLA_SUCCESS; -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 08/23] qla2xxx: Properly handle 32 bit mailbox register for ISPFX00.
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_mr.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index 9839da8..ed44ec6 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c @@ -2916,9 +2916,9 @@ qlafx00_async_event(scsi_qla_host_t *vha) break; case QLAFX00_MBA_PORT_UPDATE: /* Port database update */ - ha-aenmb[1] = RD_REG_WORD(reg-aenmailbox1); - ha-aenmb[2] = RD_REG_WORD(reg-aenmailbox2); - ha-aenmb[3] = RD_REG_WORD(reg-aenmailbox3); + ha-aenmb[1] = RD_REG_DWORD(reg-aenmailbox1); + ha-aenmb[2] = RD_REG_DWORD(reg-aenmailbox2); + ha-aenmb[3] = RD_REG_DWORD(reg-aenmailbox3); ql_dbg(ql_dbg_async, vha, 0x5077, Asynchronous port Update received aenmb[0]: %x, aenmb[1]: %x, aenmb[2]: %x, aenmb[3]: %x\n, @@ -2975,7 +2975,7 @@ static void qlafx00_mbx_completion(scsi_qla_host_t *vha, uint32_t mb0) { uint16_tcnt; - uint16_t __iomem *wptr; + uint32_t __iomem *wptr; struct qla_hw_data *ha = vha-hw; struct device_reg_fx00 __iomem *reg = ha-iobase-ispfx00; @@ -2985,10 +2985,10 @@ qlafx00_mbx_completion(scsi_qla_host_t *vha, uint32_t mb0) /* Load return mailbox registers. */ ha-flags.mbox_int = 1; ha-mailbox_out32[0] = mb0; - wptr = (uint16_t __iomem *)reg-mailbox17; + wptr = (uint32_t __iomem *)reg-mailbox17; for (cnt = 1; cnt ha-mbx_count; cnt++) { - ha-mailbox_out32[cnt] = RD_REG_WORD(wptr); + ha-mailbox_out32[cnt] = RD_REG_DWORD(wptr); wptr++; } } -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESUBMIT 04/23] qla2xxx: Use proper message for Non owner reset ACK Timeout.
From: Atul Deshmukh atul.deshm...@qlogic.com Signed-off-by: Atul Deshmukh atul.deshm...@qlogic.com Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com --- drivers/scsi/qla2xxx/qla_nx2.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c index f60989d..1f4c72a 100644 --- a/drivers/scsi/qla2xxx/qla_nx2.c +++ b/drivers/scsi/qla2xxx/qla_nx2.c @@ -1578,8 +1578,8 @@ qla8044_need_reset_handler(struct scsi_qla_host *vha) do { if (time_after_eq(jiffies, dev_init_timeout)) { ql_log(ql_log_info, vha, 0xb0c4, - %s: Non Reset owner DEV INIT - TIMEOUT!\n, __func__); + %s: Non Reset owner: Reset Ack Timeout!\n, + __func__); break; } -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Proposal for a scalable SCSI midlayer
On 02/23/14 21:10, James Bottomley wrote: Right ... my ideal here if we can achieve it would be lockless threaded models, where we could make guarantees like single thread of execution per command, so all command state could be lockless. This approach sounds interesting but could be challenging to implement. With this approach it would no longer be safe to access the SCSI command state from interrupt nor from tasklet context. That means that the I/O completion path would have to be modified such that instead of using an IPI to invoke a tasklet at the CPU that submitted the SCSI command a new mechanism would have to be used that causes the I/O completion code to run directly on the context of the thread that submitted the SCSI command. Bart. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/16] sleep_on removal, second try
It's been a while since the first submission of these patches, but a lot of them have made it into linux-next already, so here is the stuff that is not merged yet, hopefully addressing all the comments. Geert and Michael: the I was expecting the ataflop and atari_scsi patches to be merged already, based on earlier discussion. Can you apply them to the linux-m68k tree, or do you prefer them to go through the scsi and block maintainers? Jens: I did not get any comments for the DAC960 and swim3 patches, I assume they are good to go in. Please merge. Hans and Mauro: As I commented on the old thread, I thought the four media patches were on their way. I have addressed the one comment that I missed earlier now, and used Hans' version for the two patches he changed. Please merge or let me know the status if you have already put them in some tree, but not yet into linux-next Greg or Andrew: The parport subsystem is orphaned unfortunately, can one of you pick up that patch? Davem: The two ATM patches got acks, but I did not hear back from Karsten regarding the ISDN patches. Can you pick up all six, or should we wait for comments about the ISDN patches? Arnd Cc: Andrew Morton a...@osdl.org Cc: David S. Miller da...@davemloft.net Cc: Geert Uytterhoeven ge...@linux-m68k.org Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Ingo Molnar mi...@kernel.org Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Jens Axboe ax...@kernel.dk Cc: Karsten Keil i...@linux-pingi.de Cc: Mauro Carvalho Chehab m.che...@samsung.com Cc: Michael Schmitz schm...@biophys.uni-duesseldorf.de Cc: Peter Zijlstra pet...@infradead.org Cc: linux-atm-gene...@lists.sourceforge.net Cc: linux-me...@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: net...@vger.kernel.org Arnd Bergmann (16): ataflop: fix sleep_on races scsi: atari_scsi: fix sleep_on race DAC960: remove sleep_on usage swim3: fix interruptible_sleep_on race [media] omap_vout: avoid sleep_on race [media] usbvision: drop unused define USBVISION_SAY_AND_WAIT [media] radio-cadet: avoid interruptible_sleep_on race [media] arv: fix sleep_on race parport: fix interruptible_sleep_on race atm: nicstar: remove interruptible_sleep_on_timeout atm: firestream: fix interruptible_sleep_on race isdn: pcbit: fix interruptible_sleep_on race isdn: hisax/elsa: fix sleep_on race in elsa FSM isdn: divert, hysdn: fix interruptible_sleep_on race isdn: fix multiple sleep_on races sched: remove sleep_on() and friends Documentation/DocBook/kernel-hacking.tmpl| 10 -- drivers/atm/firestream.c | 4 +-- drivers/atm/nicstar.c| 13 drivers/block/DAC960.c | 34 ++-- drivers/block/ataflop.c | 16 +- drivers/block/swim3.c| 18 ++- drivers/isdn/divert/divert_procfs.c | 7 +++-- drivers/isdn/hisax/elsa.c| 9 -- drivers/isdn/hisax/elsa_ser.c| 3 +- drivers/isdn/hysdn/hysdn_proclog.c | 7 +++-- drivers/isdn/i4l/isdn_common.c | 13 +--- drivers/isdn/pcbit/drv.c | 6 ++-- drivers/media/platform/arv.c | 6 ++-- drivers/media/platform/omap/omap_vout_vrfb.c | 3 +- drivers/media/radio/radio-cadet.c| 46 drivers/media/usb/usbvision/usbvision.h | 8 - drivers/parport/share.c | 3 +- drivers/scsi/atari_scsi.c| 12 ++-- include/linux/wait.h | 11 --- kernel/sched/core.c | 46 20 files changed, 113 insertions(+), 162 deletions(-) -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/16] scsi: atari_scsi: fix sleep_on race
sleep_on is known broken and going away. The atari_scsi driver is one of two remaining users in the falcon_get_lock() function, which is a rather crazy piece of code. This does not attempt to fix the driver's locking scheme in general, but at least prevents falcon_get_lock from going to sleep when no other thread holds the same lock or tries to get it, and we no longer schedule with irqs disabled. Signed-off-by: Arnd Bergmann a...@arndb.de Cc: Michael Schmitz schmitz...@gmail.com Cc: Geert Uytterhoeven ge...@linux-m68k.org Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/atari_scsi.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index a3e6c8a..b33ce34 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c @@ -90,6 +90,7 @@ #include linux/init.h #include linux/nvram.h #include linux/bitops.h +#include linux/wait.h #include asm/setup.h #include asm/atarihw.h @@ -549,8 +550,10 @@ static void falcon_get_lock(void) local_irq_save(flags); - while (!in_irq() falcon_got_lock stdma_others_waiting()) - sleep_on(falcon_fairness_wait); + wait_event_cmd(falcon_fairness_wait, + !in_irq() falcon_got_lock stdma_others_waiting(), + local_irq_restore(flags), + local_irq_save(flags)); while (!falcon_got_lock) { if (in_irq()) @@ -562,7 +565,10 @@ static void falcon_get_lock(void) falcon_trying_lock = 0; wake_up(falcon_try_wait); } else { - sleep_on(falcon_try_wait); + wait_event_cmd(falcon_try_wait, + falcon_got_lock !falcon_trying_lock, + local_irq_restore(flags), + local_irq_save(flags)); } } -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] bfa: Updating Maintainers email ids
From: Anil Gurumurthy anil.gurumur...@qlogic.com Signed-off-by: Anil Gurumurthy anil.gurumur...@qlogic.com --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0dba50b..0dff580 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1917,8 +1917,8 @@ F:drivers/bcma/ F: include/linux/bcma/ BROCADE BFA FC SCSI DRIVER -M: Anil Gurumurthy aguru...@brocade.com -M: Vijaya Mohan Guvva vmo...@brocade.com +M: Anil Gurumurthy anil.gurumur...@qlogic.com +M: Sudarsana Kalluru sudarsana.kall...@qlogic.com L: linux-scsi@vger.kernel.org S: Supported F: drivers/scsi/bfa/ -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/7] scsi_debug: fix false positive logical block reference tag check fail
Reading partially unwritten sectors generates a false positive logical block reference tag check failure when DIF is enabled. This bug is caused by missing ei_lba increment in loop of dif_verify() when unwritten sector is skipped. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Acked-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Douglas Gilbert dgilb...@interlog.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: Martin K. Petersen martin.peter...@oracle.com Cc: James Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/scsi_debug.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 2decc64..bdfb9be 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -1832,7 +1832,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec, struct sd_dif_tuple *sdt; sector_t sector; - for (i = 0; i sectors; i++) { + for (i = 0; i sectors; i++, ei_lba++) { int ret; sector = start_sec + i; @@ -1846,8 +1846,6 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec, dif_errors++; return ret; } - - ei_lba++; } dif_copy_prot(SCpnt, start_sec, sectors, true); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/7] scsi_debug: several bug fixes and enable clustering support
Hi James, Please consider to apply these patches to your tree. There is no change since the previous version except for adding Reviewed-by lines from Douglas and Martin. This patch set includes several bug fixes and patches for enabling clustering support for scsi_debug. The reason why I would like to enable clustering is to test commands with huge transfer length. Without enabling clustering support, the transfer length for read and write scsi commands is limited upto 8MB when page size is 4KB and sg_tablesize is 2048 (= SCSI_MAX_SG_CHAIN_SEGMENTS). Changes from v2: - add Reviewed-by lines Akinobu Mita (7): scsi_debug: fix false positive logical block reference tag check fail scsi_debug: make pseudo_primary static scsi_debug: fix duplicate dif_errors increment scsi_debug: fix resp_xdwriteread() return value when running out of memory scsi_debug: prepare to enable clustering scsi_debug: protect device access with atomic_rw lock scsi_debug: add ability to enable clustering drivers/scsi/scsi_debug.c | 141 +++--- 1 file changed, 82 insertions(+), 59 deletions(-) Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: Martin K. Petersen martin.peter...@oracle.com Cc: linux-scsi@vger.kernel.org -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/7] scsi_debug: fix resp_xdwriteread() return value when running out of memory
When resp_xdwriteread() can't allocate temporary buffer, it returns -1. But the return value is used as scsi status code and -1 is not interpreted as correct code. target_core_mod has similar xdwriteread emulation code. So this mimics what target_core_mod does for xdwriteread when running out of memory. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Reviewed-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/scsi_debug.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 1a42880..a102519 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -64,6 +64,7 @@ static const char * scsi_debug_version_date = 20100324; /* Additional Sense Code (ASC) */ #define NO_ADDITIONAL_SENSE 0x0 #define LOGICAL_UNIT_NOT_READY 0x4 +#define LOGICAL_UNIT_COMMUNICATION_FAILURE 0x8 #define UNRECOVERED_READ_ERR 0x11 #define PARAMETER_LIST_LENGTH_ERR 0x1a #define INVALID_OPCODE 0x20 @@ -2318,8 +2319,11 @@ static int resp_xdwriteread(struct scsi_cmnd *scp, unsigned long long lba, /* better not to use temporary buffer. */ buf = kmalloc(scsi_bufflen(scp), GFP_ATOMIC); - if (!buf) - return ret; + if (!buf) { + mk_sense_buffer(devip, NOT_READY, + LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); + return check_condition_result; + } scsi_sg_copy_to_buffer(scp, buf, scsi_bufflen(scp)); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 6/7] scsi_debug: protect device access with atomic_rw lock
This change ensures that concurrent device access including ramdisk storage, protection info, and provisioning map by read, write, and unmap commands are protected with atomic_rw spinlock. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Reviewed-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: Martin K. Petersen martin.peter...@oracle.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/scsi_debug.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 004b985..0bb1d49c 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -1888,17 +1888,19 @@ static int resp_read(struct scsi_cmnd *SCpnt, unsigned long long lba, return check_condition_result; } + read_lock_irqsave(atomic_rw, iflags); + /* DIX + T10 DIF */ if (scsi_debug_dix scsi_prot_sg_count(SCpnt)) { int prot_ret = prot_verify_read(SCpnt, lba, num, ei_lba); if (prot_ret) { + read_unlock_irqrestore(atomic_rw, iflags); mk_sense_buffer(devip, ABORTED_COMMAND, 0x10, prot_ret); return illegal_condition_result; } } - read_lock_irqsave(atomic_rw, iflags); ret = do_device_access(SCpnt, devip, lba, num, 0); read_unlock_irqrestore(atomic_rw, iflags); if (ret == -1) @@ -2098,17 +2100,19 @@ static int resp_write(struct scsi_cmnd *SCpnt, unsigned long long lba, if (ret) return ret; + write_lock_irqsave(atomic_rw, iflags); + /* DIX + T10 DIF */ if (scsi_debug_dix scsi_prot_sg_count(SCpnt)) { int prot_ret = prot_verify_write(SCpnt, lba, num, ei_lba); if (prot_ret) { + write_unlock_irqrestore(atomic_rw, iflags); mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x10, prot_ret); return illegal_condition_result; } } - write_lock_irqsave(atomic_rw, iflags); ret = do_device_access(SCpnt, devip, lba, num, 1); if (scsi_debug_lbp()) map_region(lba, num); @@ -2187,6 +2191,7 @@ static int resp_unmap(struct scsi_cmnd * scmd, struct sdebug_dev_info * devip) struct unmap_block_desc *desc; unsigned int i, payload_len, descriptors; int ret; + unsigned long iflags; ret = check_readiness(scmd, 1, devip); if (ret) @@ -2208,6 +2213,8 @@ static int resp_unmap(struct scsi_cmnd * scmd, struct sdebug_dev_info * devip) desc = (void *)buf[8]; + write_lock_irqsave(atomic_rw, iflags); + for (i = 0 ; i descriptors ; i++) { unsigned long long lba = get_unaligned_be64(desc[i].lba); unsigned int num = get_unaligned_be32(desc[i].blocks); @@ -,6 +2229,7 @@ static int resp_unmap(struct scsi_cmnd * scmd, struct sdebug_dev_info * devip) ret = 0; out: + write_unlock_irqrestore(atomic_rw, iflags); kfree(buf); return ret; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 5/7] scsi_debug: prepare to enable clustering
Currently, clustering support for scsi_debug is disabled. This is because there are for_each_sg() loops which assume that each sg list element is consisted with a single page. But enabling clustering support, each sg list element for scsi commands can be consisted with multiple pages. This replaces these for_each_sg() loops with sg mapping iterator which is capable of handling each sg list element is consisted with multiple pages. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Reviewed-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: Martin K. Petersen martin.peter...@oracle.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/scsi_debug.c | 109 +- 1 file changed, 59 insertions(+), 50 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index a102519..004b985 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -1789,23 +1789,27 @@ static int dif_verify(struct sd_dif_tuple *sdt, const void *data, static void dif_copy_prot(struct scsi_cmnd *SCpnt, sector_t sector, unsigned int sectors, bool read) { - unsigned int i, resid; - struct scatterlist *psgl; + size_t resid; void *paddr; const void *dif_store_end = dif_storep + sdebug_store_sectors; + struct sg_mapping_iter miter; /* Bytes of protection data to copy into sgl */ resid = sectors * sizeof(*dif_storep); - scsi_for_each_prot_sg(SCpnt, psgl, scsi_prot_sg_count(SCpnt), i) { - int len = min(psgl-length, resid); + sg_miter_start(miter, scsi_prot_sglist(SCpnt), + scsi_prot_sg_count(SCpnt), SG_MITER_ATOMIC | + (read ? SG_MITER_TO_SG : SG_MITER_FROM_SG)); + + while (sg_miter_next(miter) resid 0) { + size_t len = min(miter.length, resid); void *start = dif_store(sector); - int rest = 0; + size_t rest = 0; if (dif_store_end start + len) rest = start + len - dif_store_end; - paddr = kmap_atomic(sg_page(psgl)) + psgl-offset; + paddr = miter.addr; if (read) memcpy(paddr, start, len - rest); @@ -1821,8 +1825,8 @@ static void dif_copy_prot(struct scsi_cmnd *SCpnt, sector_t sector, sector += len / sizeof(*dif_storep); resid -= len; - kunmap_atomic(paddr); } + sg_miter_stop(miter); } static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec, @@ -1929,55 +1933,62 @@ void dump_sector(unsigned char *buf, int len) static int prot_verify_write(struct scsi_cmnd *SCpnt, sector_t start_sec, unsigned int sectors, u32 ei_lba) { - int i, j, ret; + int ret; struct sd_dif_tuple *sdt; - struct scatterlist *dsgl; - struct scatterlist *psgl = scsi_prot_sglist(SCpnt); - void *daddr, *paddr; + void *daddr; sector_t sector = start_sec; int ppage_offset; + int dpage_offset; + struct sg_mapping_iter diter; + struct sg_mapping_iter piter; BUG_ON(scsi_sg_count(SCpnt) == 0); BUG_ON(scsi_prot_sg_count(SCpnt) == 0); - ppage_offset = 0; - - /* For each data page */ - scsi_for_each_sg(SCpnt, dsgl, scsi_sg_count(SCpnt), i) { - daddr = kmap_atomic(sg_page(dsgl)) + dsgl-offset; - paddr = kmap_atomic(sg_page(psgl)) + psgl-offset; - - /* For each sector-sized chunk in data page */ - for (j = 0; j dsgl-length; j += scsi_debug_sector_size) { + sg_miter_start(piter, scsi_prot_sglist(SCpnt), + scsi_prot_sg_count(SCpnt), + SG_MITER_ATOMIC | SG_MITER_FROM_SG); + sg_miter_start(diter, scsi_sglist(SCpnt), scsi_sg_count(SCpnt), + SG_MITER_ATOMIC | SG_MITER_FROM_SG); + + /* For each protection page */ + while (sg_miter_next(piter)) { + dpage_offset = 0; + if (WARN_ON(!sg_miter_next(diter))) { + ret = 0x01; + goto out; + } + for (ppage_offset = 0; ppage_offset piter.length; +ppage_offset += sizeof(struct sd_dif_tuple)) { /* If we're at the end of the current -* protection page advance to the next one +* data page advance to the next one */ - if (ppage_offset = psgl-length) { - kunmap_atomic(paddr); - psgl = sg_next(psgl); - BUG_ON(psgl ==
[PATCH v3 7/7] scsi_debug: add ability to enable clustering
This adds a module parameter to enable clustering. Without enabling clustering support, the transfer length for read and write scsi commands is limited upto 8MB when page size is 4KB and sg_tablesize is 2048 (= SCSI_MAX_SG_CHAIN_SEGMENTS). I would like to test commands with more than that transfer length. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Reviewed-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: Martin K. Petersen martin.peter...@oracle.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/scsi_debug.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 0bb1d49c..f3e9cc0 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -196,6 +196,7 @@ static unsigned int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS; static unsigned int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC; static unsigned int scsi_debug_write_same_length = DEF_WRITESAME_LENGTH; static bool scsi_debug_removable = DEF_REMOVABLE; +static bool scsi_debug_clustering; static int scsi_debug_cmnd_count = 0; @@ -2762,6 +2763,7 @@ static int schedule_resp(struct scsi_cmnd * cmnd, */ module_param_named(add_host, scsi_debug_add_host, int, S_IRUGO | S_IWUSR); module_param_named(ato, scsi_debug_ato, int, S_IRUGO); +module_param_named(clustering, scsi_debug_clustering, bool, S_IRUGO | S_IWUSR); module_param_named(delay, scsi_debug_delay, int, S_IRUGO | S_IWUSR); module_param_named(dev_size_mb, scsi_debug_dev_size_mb, int, S_IRUGO); module_param_named(dif, scsi_debug_dif, int, S_IRUGO); @@ -2805,6 +2807,7 @@ MODULE_VERSION(SCSI_DEBUG_VERSION); MODULE_PARM_DESC(add_host, 0..127 hosts allowed(def=1)); MODULE_PARM_DESC(ato, application tag ownership: 0=disk 1=host (def=1)); +MODULE_PARM_DESC(clustering, when set enables larger transfers (def=0)); MODULE_PARM_DESC(delay, # of jiffies to delay response(def=1)); MODULE_PARM_DESC(dev_size_mb, size in MB of ram shared by devs(def=8)); MODULE_PARM_DESC(dif, data integrity field type: 0-3 (def=0)); @@ -3952,6 +3955,8 @@ static int sdebug_driver_probe(struct device * dev) sdbg_host = to_sdebug_host(dev); sdebug_driver_template.can_queue = scsi_debug_max_queue; + if (scsi_debug_clustering) + sdebug_driver_template.use_clustering = ENABLE_CLUSTERING; hpnt = scsi_host_alloc(sdebug_driver_template, sizeof(sdbg_host)); if (NULL == hpnt) { printk(KERN_ERR %s: scsi_register failed\n, __func__); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/7] scsi_debug: fix duplicate dif_errors increment
It is unnecessary to increase dif_errors in dif_verify(), because the caller will increment it when dif_verify() detects failure. This bug was introduced by commit beb40ea42bd6 ([SCSI] scsi_debug: reduce duplication between prot_verify_read and prot_verify_write) Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Acked-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Douglas Gilbert dgilb...@interlog.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: Martin K. Petersen martin.peter...@oracle.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/scsi_debug.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9cd211e..1a42880 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -1780,7 +1780,6 @@ static int dif_verify(struct sd_dif_tuple *sdt, const void *data, be32_to_cpu(sdt-ref_tag) != ei_lba) { pr_err(%s: REF check failed on sector %lu\n, __func__, (unsigned long)sector); - dif_errors++; return 0x03; } return 0; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/7] scsi_debug: make pseudo_primary static
As pseudo_primary is only used in scsi_debug.c, it should be static. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Reviewed-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Douglas Gilbert dgilb...@interlog.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index bdfb9be..9cd211e 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -3246,7 +3246,7 @@ static struct attribute *sdebug_drv_attrs[] = { }; ATTRIBUTE_GROUPS(sdebug_drv); -struct device *pseudo_primary; +static struct device *pseudo_primary; static int __init scsi_debug_init(void) { -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] scsi: remove __scsi_release_buffers
We always do the bidi check now, so it can be folded into scsi_release_buffers. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 38 +++--- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 51063ca..94e46ee 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -538,8 +538,6 @@ void scsi_run_host_queues(struct Scsi_Host *shost) scsi_run_queue(sdev-request_queue); } -static void __scsi_release_buffers(struct scsi_cmnd *, int); - static inline unsigned int scsi_sgtable_index(unsigned short nents) { unsigned int index; @@ -591,26 +589,6 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb) __sg_free_table(sdb-table, SCSI_MAX_SG_SEGMENTS, scsi_sg_free); } -static void __scsi_release_buffers(struct scsi_cmnd *cmd, int do_bidi_check) -{ - - if (cmd-sdb.table.nents) - scsi_free_sgtable(cmd-sdb); - - memset(cmd-sdb, 0, sizeof(cmd-sdb)); - - if (do_bidi_check scsi_bidi_cmnd(cmd)) { - struct scsi_data_buffer *bidi_sdb = - cmd-request-next_rq-special; - scsi_free_sgtable(bidi_sdb); - kmem_cache_free(scsi_sdb_cache, bidi_sdb); - cmd-request-next_rq-special = NULL; - } - - if (scsi_prot_sg_count(cmd)) - scsi_free_sgtable(cmd-prot_sdb); -} - /* * Function:scsi_release_buffers() * @@ -630,7 +608,21 @@ static void __scsi_release_buffers(struct scsi_cmnd *cmd, int do_bidi_check) */ void scsi_release_buffers(struct scsi_cmnd *cmd) { - __scsi_release_buffers(cmd, 1); + if (cmd-sdb.table.nents) + scsi_free_sgtable(cmd-sdb); + + memset(cmd-sdb, 0, sizeof(cmd-sdb)); + + if (scsi_bidi_cmnd(cmd)) { + struct scsi_data_buffer *bidi_sdb = + cmd-request-next_rq-special; + scsi_free_sgtable(bidi_sdb); + kmem_cache_free(scsi_sdb_cache, bidi_sdb); + cmd-request-next_rq-special = NULL; + } + + if (scsi_prot_sg_count(cmd)) + scsi_free_sgtable(cmd-prot_sdb); } EXPORT_SYMBOL(scsi_release_buffers); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 13/17] scsi: push host_lock down into scsi_{host,target}_queue_ready
On 02/17/14 23:00, Christoph Hellwig wrote: Most of the scsi multiqueue work so far has been about modifying the block layer, so I'm definitively now shy about doing that were needed. And I think we will eventually need to be able to have n:m queue to hctx mapping instead of the current 1:n one. I think it would be great if the blk-mq core would support an n:m queue to hctx mapping. One of the advantages of that approach would be that the blk-mq layer already keeps track of how many commands are queued per hctx and hence that would allow to eliminate the host_busy counter from the SCSI mid-layer. However, this involves a change in semantics. I hope it's fine to change the semantics of the hosts-can_queue parameter from maximum number of commands queued per SCSI host into maximum number of commands queued per hctx ? Bart. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] scsi: remove scsi_end_request
Turns out the bidi handling could cause a use after free in this version, I'll respin it with a fix for that. On Wed, Feb 26, 2014 at 06:23:21AM -0800, Christoph Hellwig wrote: By folding scsi_end_request into its only caller we can significantly clean up the completion logic. We can use simple goto labels now to only have a single place to finish or requeue command there instead of the previous convoluted logic. Note that the switch from __scsi_release_buffers without the bidi check argument to scsi_release_buffers is always correct as we handle bidi commands separately in scsi_io_completion and they never reach the path scsi_end_request was called from. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 119 +-- 1 file changed, 32 insertions(+), 87 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 62ec84b..51063ca 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -540,66 +540,6 @@ void scsi_run_host_queues(struct Scsi_Host *shost) static void __scsi_release_buffers(struct scsi_cmnd *, int); -/* - * Function:scsi_end_request() - * - * Purpose: Post-processing of completed commands (usually invoked at end - * of upper level post-processing and scsi_io_completion). - * - * Arguments: cmd - command that is complete. - * error- 0 if I/O indicates success, 0 for I/O error. - * bytes- number of bytes of completed I/O - * requeue - indicates whether we should requeue leftovers. - * - * Lock status: Assumed that lock is not held upon entry. - * - * Returns: cmd if requeue required, NULL otherwise. - * - * Notes: This is called for block device requests in order to - * mark some number of sectors as complete. - * - * We are guaranteeing that the request queue will be goosed - * at some point during this call. - * Notes:If cmd was requeued, upon return it will be a stale pointer. - */ -static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error, - int bytes, int requeue) -{ - struct request_queue *q = cmd-device-request_queue; - struct request *req = cmd-request; - - /* - * If there are blocks left over at the end, set up the command - * to queue the remainder of them. - */ - if (blk_end_request(req, error, bytes)) { - /* kill remainder if no retrys */ - if (error scsi_noretry_cmd(cmd)) - blk_end_request_all(req, error); - else { - if (requeue) { - /* - * Bleah. Leftovers again. Stick the - * leftovers in the front of the - * queue, and goose the queue again. - */ - scsi_release_buffers(cmd); - scsi_requeue_command(q, cmd); - cmd = NULL; - } - return cmd; - } - } - - /* - * This will goose the queue request function at the end, so we don't - * need to worry about launching another command. - */ - __scsi_release_buffers(cmd, 0); - scsi_next_command(cmd); - return NULL; -} - static inline unsigned int scsi_sgtable_index(unsigned short nents) { unsigned int index; @@ -751,16 +691,9 @@ static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) * * Returns: Nothing * - * Notes: This function is matched in terms of capabilities to - * the function that created the scatter-gather list. - * In other words, if there are no bounce buffers - * (the normal case for most drivers), we don't need - * the logic to deal with cleaning up afterwards. - * - * We must call scsi_end_request(). This will finish off - * the specified number of sectors. If we are done, the - * command block will be released and the queue function - * will be goosed. If we are not done then we have to + * Notes: We will finish off the specified number of sectors. If we + * are done, the command block will be released and the queue + * function will be goosed. If we are not done then we have to * figure out what to do next: * * a) We can call scsi_requeue_command(). The request @@ -769,7 +702,7 @@ static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) * be used if we made forward progress, or if we want * to switch from READ(10) to READ(6) for example. * - * b) We can call
Re: [PATCH 00/16] sleep_on removal, second try
On Wed, Feb 26 2014, Arnd Bergmann wrote: It's been a while since the first submission of these patches, but a lot of them have made it into linux-next already, so here is the stuff that is not merged yet, hopefully addressing all the comments. Geert and Michael: the I was expecting the ataflop and atari_scsi patches to be merged already, based on earlier discussion. Can you apply them to the linux-m68k tree, or do you prefer them to go through the scsi and block maintainers? Jens: I did not get any comments for the DAC960 and swim3 patches, I assume they are good to go in. Please merge. Picked up 1, 3, 4 of the patches. Thanks Arnd. -- Jens Axboe -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND] scsi: Output error messages using structured printk in single line
Output error messages using structured printk in single line. In SCSI drivers, some error messages which should be output in single line are divided in multiple lines. When user tools handle the error messages, those divided messages will create some inconveniences. The reason why this problem is induced is structured printk for error messages. Structured printk can add device information for printk, and it is used in scmd_printk() and sd_printk(). The printk aims at output in atomic, so we cannot use those functions for connecting multiple messages like KERN_CONT. However, some error messages is implemented as follows: structured_printk(DEVICE INFORMATION:); printk(KERN_CONT, DETAIL INFORMATION\n); This implementation will be expected to output like DEVICE INFORMATION: DETAIL INFORMATION, but actually, this will be output as follows: DEVICE INFORMATION: DETAIL INFORMATION For instance, in a following pseudo SCSI error test, the device information and the detail information are divided: -- Pseudo SCSI error test for current kernel # modprobe scsi_debug # cd /sys/bus/pseudo/drivers/scsi_debug # echo 2 opts # dd if=/dev/sdb of=/dev/null 2 /dev/null -- Result for current kernel # dmesg [ 17.842110] sd 2:0:0:0: [sdb] Attached SCSI disk [ 18.859098] sd 2:0:0:0: [sdb] Unhandled sense code [ 18.859103] sd 2:0:0:0: [sdb] [ 18.859106] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 18.859108] sd 2:0:0:0: [sdb] [ 18.859110] Sense Key : Medium Error [current] [ 18.859114] Info fld=0x1234 [ 18.859116] sd 2:0:0:0: [sdb] [ 18.859119] Add. Sense: Unrecovered read error [ 18.859122] sd 2:0:0:0: [sdb] CDB: [ 18.859124] Read(10): 28 00 00 00 11 e0 00 01 00 00 In a SCSI device driver, sd_print_result() is implemented as follows: sd_print_result() { sd_printk(KERN_INFO, sdkp, ); scsi_show_result(result); } Here, first sd_printk() outputs sd 2:0:0:0: [sdb] , then scsi_show_sense_hdr() outputs Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE. sd_printk() does not include \n, but it forcibly starts a new line. Therefore, when the driver outputs error messages, those messages are divided. This patch makes those multiple line messages output in single line as follows: # dmesg [ 17.145085] sdb: unknown partition table [ 17.149096] sd 2:0:0:0: [sdb] Attached SCSI disk [ 18.166090] sd 2:0:0:0: [sdb] Unhandled sense code [ 18.166095] sd 2:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 18.166099] sd 2:0:0:0: [sdb] Sense Key : Medium Error [current] [ 18.166104] Info fld=0x1234 [ 18.166106] sd 2:0:0:0: [sdb] Add. Sense: Unrecovered read error [ 18.166111] sd 2:0:0:0: [sdb] CDB: Read(10): 28 00 00 00 11 e0 00 01 00 00 Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Hannes Reinecke h...@suse.de Cc: Kay Sievers k...@vrfy.org Cc: linux-ker...@vger.kernel.org Cc: linux-scsi@vger.kernel.org --- drivers/scsi/constants.c | 206 -- drivers/scsi/scsi.c | 28 -- drivers/scsi/sd.c| 19 +++- include/scsi/scsi_dbg.h | 23 - 4 files changed, 176 insertions(+), 100 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index d35a5d6..cb93435 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -256,8 +256,26 @@ static const char * get_sa_name(const struct value_name_pair * arr, return (k arr_sz) ? arr-name : NULL; } +/* Store a SCSI logging event to buf. */ +__printf(2, 3) +void scsi_log_add(struct scsi_log_line *log, const char *fmt, ...) +{ + va_list args; + int len; + + va_start(args, fmt); + len = vscnprintf(log-buf + log-offset, +SCSI_LOG_LINE_MAX - log-offset, fmt, args); + WARN_ONCE(!len, Cannot store the message '%s' in a local log buffer\n, + fmt); + log-offset += len; + va_end(args); +} +EXPORT_SYMBOL(scsi_log_add); + /* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */ -static void print_opcode_name(unsigned char * cdbp, int cdb_len) +static void print_opcode_name(unsigned char *cdbp, int cdb_len, + struct scsi_log_line *log) { int sa, len, cdb0; int fin_name = 0; @@ -268,20 +286,22 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len) case VARIABLE_LENGTH_CMD: len = scsi_varlen_cdb_length(cdbp); if (len 10) { - printk(short variable length command, - len=%d ext_len=%d, len, cdb_len); + scsi_log_add(log, +short variable length command, len=%d ext_len=%d, +len, cdb_len); break; } sa = (cdbp[8] 8) + cdbp[9]; name =
Re: [PATCH RESEND] scsi: Output error messages using structured printk in single line
Hi Hannes, Although I sent you a message 6 days ago to ask your work which is similar to my patch, I resend my patch because I'm considering this problem should be fixed as soon as possible. Thank you, Yoshihiro YUNOMAE (2014/02/27 13:17), Yoshihiro YUNOMAE wrote: Output error messages using structured printk in single line. In SCSI drivers, some error messages which should be output in single line are divided in multiple lines. When user tools handle the error messages, those divided messages will create some inconveniences. The reason why this problem is induced is structured printk for error messages. Structured printk can add device information for printk, and it is used in scmd_printk() and sd_printk(). The printk aims at output in atomic, so we cannot use those functions for connecting multiple messages like KERN_CONT. However, some error messages is implemented as follows: structured_printk(DEVICE INFORMATION:); printk(KERN_CONT, DETAIL INFORMATION\n); This implementation will be expected to output like DEVICE INFORMATION: DETAIL INFORMATION, but actually, this will be output as follows: DEVICE INFORMATION: DETAIL INFORMATION For instance, in a following pseudo SCSI error test, the device information and the detail information are divided: -- Pseudo SCSI error test for current kernel # modprobe scsi_debug # cd /sys/bus/pseudo/drivers/scsi_debug # echo 2 opts # dd if=/dev/sdb of=/dev/null 2 /dev/null -- Result for current kernel # dmesg [ 17.842110] sd 2:0:0:0: [sdb] Attached SCSI disk [ 18.859098] sd 2:0:0:0: [sdb] Unhandled sense code [ 18.859103] sd 2:0:0:0: [sdb] [ 18.859106] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 18.859108] sd 2:0:0:0: [sdb] [ 18.859110] Sense Key : Medium Error [current] [ 18.859114] Info fld=0x1234 [ 18.859116] sd 2:0:0:0: [sdb] [ 18.859119] Add. Sense: Unrecovered read error [ 18.859122] sd 2:0:0:0: [sdb] CDB: [ 18.859124] Read(10): 28 00 00 00 11 e0 00 01 00 00 In a SCSI device driver, sd_print_result() is implemented as follows: sd_print_result() { sd_printk(KERN_INFO, sdkp, ); scsi_show_result(result); } Here, first sd_printk() outputs sd 2:0:0:0: [sdb] , then scsi_show_sense_hdr() outputs Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE. sd_printk() does not include \n, but it forcibly starts a new line. Therefore, when the driver outputs error messages, those messages are divided. This patch makes those multiple line messages output in single line as follows: # dmesg [ 17.145085] sdb: unknown partition table [ 17.149096] sd 2:0:0:0: [sdb] Attached SCSI disk [ 18.166090] sd 2:0:0:0: [sdb] Unhandled sense code [ 18.166095] sd 2:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 18.166099] sd 2:0:0:0: [sdb] Sense Key : Medium Error [current] [ 18.166104] Info fld=0x1234 [ 18.166106] sd 2:0:0:0: [sdb] Add. Sense: Unrecovered read error [ 18.166111] sd 2:0:0:0: [sdb] CDB: Read(10): 28 00 00 00 11 e0 00 01 00 00 Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Hannes Reinecke h...@suse.de Cc: Kay Sievers k...@vrfy.org Cc: linux-ker...@vger.kernel.org Cc: linux-scsi@vger.kernel.org --- drivers/scsi/constants.c | 206 -- drivers/scsi/scsi.c | 28 -- drivers/scsi/sd.c| 19 +++- include/scsi/scsi_dbg.h | 23 - 4 files changed, 176 insertions(+), 100 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index d35a5d6..cb93435 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -256,8 +256,26 @@ static const char * get_sa_name(const struct value_name_pair * arr, return (k arr_sz) ? arr-name : NULL; } +/* Store a SCSI logging event to buf. */ +__printf(2, 3) +void scsi_log_add(struct scsi_log_line *log, const char *fmt, ...) +{ + va_list args; + int len; + + va_start(args, fmt); + len = vscnprintf(log-buf + log-offset, +SCSI_LOG_LINE_MAX - log-offset, fmt, args); + WARN_ONCE(!len, Cannot store the message '%s' in a local log buffer\n, + fmt); + log-offset += len; + va_end(args); +} +EXPORT_SYMBOL(scsi_log_add); + /* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */ -static void print_opcode_name(unsigned char * cdbp, int cdb_len) +static void print_opcode_name(unsigned char *cdbp, int cdb_len, + struct scsi_log_line *log) { int sa, len, cdb0; int fin_name = 0; @@ -268,20 +286,22 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len) case VARIABLE_LENGTH_CMD: len = scsi_varlen_cdb_length(cdbp); if (len 10) { - printk(short variable length command, - len=%d ext_len=%d, len, cdb_len); +
Re: [PATCH 00/16] sleep_on removal, second try
Arnd, It's been a while since the first submission of these patches, but a lot of them have made it into linux-next already, so here is the stuff that is not merged yet, hopefully addressing all the comments. Geert and Michael: the I was expecting the ataflop and atari_scsi patches to be merged already, based on earlier discussion. Can you apply them to the linux-m68k tree, or do you prefer them to go through the scsi and block maintainers? Not sure what we decided to do - I'd prefer to double-check the latest ones first, but I'd be OK with these to go via m68k. Maybe Geert waits for acks from linux-scsi and linux-block? (The rest of my patches to Atari SCSI still awaits comment there.) Geert? Regards, Michael Jens: I did not get any comments for the DAC960 and swim3 patches, I assume they are good to go in. Please merge. Hans and Mauro: As I commented on the old thread, I thought the four media patches were on their way. I have addressed the one comment that I missed earlier now, and used Hans' version for the two patches he changed. Please merge or let me know the status if you have already put them in some tree, but not yet into linux-next Greg or Andrew: The parport subsystem is orphaned unfortunately, can one of you pick up that patch? Davem: The two ATM patches got acks, but I did not hear back from Karsten regarding the ISDN patches. Can you pick up all six, or should we wait for comments about the ISDN patches? Arnd Cc: Andrew Morton a...@osdl.org Cc: David S. Miller da...@davemloft.net Cc: Geert Uytterhoeven ge...@linux-m68k.org Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Ingo Molnar mi...@kernel.org Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Jens Axboe ax...@kernel.dk Cc: Karsten Keil i...@linux-pingi.de Cc: Mauro Carvalho Chehab m.che...@samsung.com Cc: Michael Schmitz schm...@biophys.uni-duesseldorf.de Cc: Peter Zijlstra pet...@infradead.org Cc: linux-atm-gene...@lists.sourceforge.net Cc: linux-me...@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: net...@vger.kernel.org Arnd Bergmann (16): ataflop: fix sleep_on races scsi: atari_scsi: fix sleep_on race DAC960: remove sleep_on usage swim3: fix interruptible_sleep_on race [media] omap_vout: avoid sleep_on race [media] usbvision: drop unused define USBVISION_SAY_AND_WAIT [media] radio-cadet: avoid interruptible_sleep_on race [media] arv: fix sleep_on race parport: fix interruptible_sleep_on race atm: nicstar: remove interruptible_sleep_on_timeout atm: firestream: fix interruptible_sleep_on race isdn: pcbit: fix interruptible_sleep_on race isdn: hisax/elsa: fix sleep_on race in elsa FSM isdn: divert, hysdn: fix interruptible_sleep_on race isdn: fix multiple sleep_on races sched: remove sleep_on() and friends Documentation/DocBook/kernel-hacking.tmpl| 10 -- drivers/atm/firestream.c | 4 +-- drivers/atm/nicstar.c| 13 drivers/block/DAC960.c | 34 ++-- drivers/block/ataflop.c | 16 +- drivers/block/swim3.c| 18 ++- drivers/isdn/divert/divert_procfs.c | 7 +++-- drivers/isdn/hisax/elsa.c| 9 -- drivers/isdn/hisax/elsa_ser.c| 3 +- drivers/isdn/hysdn/hysdn_proclog.c | 7 +++-- drivers/isdn/i4l/isdn_common.c | 13 +--- drivers/isdn/pcbit/drv.c | 6 ++-- drivers/media/platform/arv.c | 6 ++-- drivers/media/platform/omap/omap_vout_vrfb.c | 3 +- drivers/media/radio/radio-cadet.c| 46 drivers/media/usb/usbvision/usbvision.h | 8 - drivers/parport/share.c | 3 +- drivers/scsi/atari_scsi.c| 12 ++-- include/linux/wait.h | 11 --- kernel/sched/core.c | 46 20 files changed, 113 insertions(+), 162 deletions(-) -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/16] scsi: atari_scsi: fix sleep_on race
Arnd Bergmann wrote: sleep_on is known broken and going away. The atari_scsi driver is one of two remaining users in the falcon_get_lock() function, which is a rather crazy piece of code. This does not attempt to fix the driver's locking scheme in general, but at least prevents falcon_get_lock from going to sleep when no other thread holds the same lock or tries to get it, and we no longer schedule with irqs disabled. Signed-off-by: Arnd Bergmann a...@arndb.de Cc: Michael Schmitz schmitz...@gmail.com Cc: Geert Uytterhoeven ge...@linux-m68k.org Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/atari_scsi.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index a3e6c8a..b33ce34 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c @@ -90,6 +90,7 @@ #include linux/init.h #include linux/nvram.h #include linux/bitops.h +#include linux/wait.h #include asm/setup.h #include asm/atarihw.h @@ -549,8 +550,10 @@ static void falcon_get_lock(void) local_irq_save(flags); - while (!in_irq() falcon_got_lock stdma_others_waiting()) - sleep_on(falcon_fairness_wait); + wait_event_cmd(falcon_fairness_wait, + !in_irq() falcon_got_lock stdma_others_waiting(), + local_irq_restore(flags), + local_irq_save(flags)); while (!falcon_got_lock) { if (in_irq()) @@ -562,7 +565,10 @@ static void falcon_get_lock(void) falcon_trying_lock = 0; wake_up(falcon_try_wait); } else { - sleep_on(falcon_try_wait); + wait_event_cmd(falcon_try_wait, + falcon_got_lock !falcon_trying_lock, + local_irq_restore(flags), + local_irq_save(flags)); } } Nack - the completion condition in the first hunk has its logic reversed. Try this instead (while() loops while condition true, do {} until () loops while condition false, no?) I'm 99% confident I had tested your current version of the patch before and found it still attempts to schedule while in interrupt. I can retest if you prefer, but that'll have to wait a few days. diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index a3e6c8a..cc1b013 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c @@ -90,6 +90,7 @@ #include linux/init.h #include linux/nvram.h #include linux/bitops.h +#include linux/wait.h #include asm/setup.h #include asm/atarihw.h @@ -549,8 +550,10 @@ static void falcon_get_lock(void) local_irq_save(flags); - while (!in_irq() falcon_got_lock stdma_others_waiting()) - sleep_on(falcon_fairness_wait); + wait_event_cmd(falcon_fairness_wait, + in_irq() || !falcon_got_lock || !stdma_others_waiting(), + local_irq_restore(flags), + local_irq_save(flags)); while (!falcon_got_lock) { if (in_irq()) @@ -562,7 +565,10 @@ static void falcon_get_lock(void) falcon_trying_lock = 0; wake_up(falcon_try_wait); } else { - sleep_on(falcon_try_wait); + wait_event_cmd(falcon_try_wait, + falcon_got_lock !falcon_trying_lock, + local_irq_restore(flags), + local_irq_save(flags)); } } Cheers, Michael -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html