Re: [PATCH] virtio-scsi: Fix the race condition in virtscsi_handle_event
On Tue, Jan 06, 2015 at 12:10:59AM +0200, Michael S. Tsirkin wrote: On Mon, Jan 05, 2015 at 11:48:47AM -0800, Venkatesh Srinivas wrote: On Sun, Jan 4, 2015 at 10:04 PM, Fam Zheng f...@redhat.com wrote: There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in virtscsi_handle_transport_reset may trigger the BUG_ON in scsi_target_reap, because the state is altered behind it, probably by scsi_scan_host of another event. I'm able to reproduce it by repeatedly plugging and unplugging a scsi disk with the same lun number. To make is safe, the mutex added in struct virtio_scsi is held in virtscsi_handle_event, so that all the events are processed in a synchronized way. With this lock, the panic goes away. Signed-off-by: Fam Zheng f...@redhat.com --- drivers/scsi/virtio_scsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c52bb5d..7f194d4 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -110,6 +110,9 @@ struct virtio_scsi { /* CPU hotplug notifier */ struct notifier_block nb; + /* Protect the hotplug/unplug event handling */ + struct mutex scan_lock; + /* Protected by event_vq lock */ bool stop_events; @@ -377,6 +380,7 @@ static void virtscsi_handle_event(struct work_struct *work) struct virtio_scsi *vscsi = event_node-vscsi; struct virtio_scsi_event *event = event_node-event; + mutex_lock(vscsi-scan_lock); if (event-event cpu_to_virtio32(vscsi-vdev, VIRTIO_SCSI_T_EVENTS_MISSED)) { event-event = ~cpu_to_virtio32(vscsi-vdev, @@ -397,6 +401,7 @@ static void virtscsi_handle_event(struct work_struct *work) pr_err(Unsupport virtio scsi event %x\n, event-event); } virtscsi_kick_event(vscsi, event_node); + mutex_unlock(vscsi-scan_lock); } static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) @@ -894,6 +899,7 @@ static int virtscsi_init(struct virtio_device *vdev, const char **names; struct virtqueue **vqs; + mutex_init(vscsi-scan_lock); num_vqs = vscsi-num_queues + VIRTIO_SCSI_VQ_BASE; vqs = kmalloc(num_vqs * sizeof(struct virtqueue *), GFP_KERNEL); callbacks = kmalloc(num_vqs * sizeof(vq_callback_t *), GFP_KERNEL); -- 1.9.3 Nice find. This fix does have the effect of serializing all event handling via scan_lock; perhaps you want to instead create a singlethreaded workqueue in virtio_scsi and queue handle_event there, rather than waiting on scan_lock on the system workqueue? Or use the system single-threaded wq. I was sure we have one, but apparently not :( Pls ignore the comment, sorry about the noise. Reviewed-by: Venkatesh Srinivas venkate...@google.com -- vs; -- 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 v2] virtio-scsi: Fix the race condition in virtscsi_handle_event
There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in virtscsi_handle_transport_reset may trigger the BUG_ON in scsi_target_reap, because the state is altered behind it, probably by scsi_scan_host of another event. I'm able to reproduce it by repeatedly plugging and unplugging a scsi disk with the same lun number. To make is safe, a single thread workqueue local to the module is added which runs the scan work. With this change, the panic goes away. Signed-off-by: Fam Zheng f...@redhat.com --- v2: Use a single threaded workqueue instead of mutex to serialize work (Venkatesh) --- drivers/scsi/virtio_scsi.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c52bb5d..71b0091 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -120,6 +120,8 @@ struct virtio_scsi { static struct kmem_cache *virtscsi_cmd_cache; static mempool_t *virtscsi_cmd_pool; +static struct workqueue_struct *virtscsi_scan_wq; + static inline struct Scsi_Host *virtio_scsi_host(struct virtio_device *vdev) { @@ -404,7 +406,7 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) struct virtio_scsi_event_node *event_node = buf; if (!vscsi-stop_events) - queue_work(system_freezable_wq, event_node-work); + queue_work(virtscsi_scan_wq, event_node-work); } static void virtscsi_event_done(struct virtqueue *vq) @@ -1119,6 +1121,12 @@ static int __init init(void) pr_err(mempool_create() for virtscsi_cmd_pool failed\n); goto error; } + virtscsi_scan_wq = create_singlethread_workqueue(virtscsi-scan); + if (!virtscsi_scan_wq) { + pr_err(create_singlethread_workqueue() for virtscsi_scan_wq failed\n); + goto error; + } + ret = register_virtio_driver(virtio_scsi_driver); if (ret 0) goto error; @@ -1126,6 +1134,9 @@ static int __init init(void) return 0; error: + if (virtscsi_scan_wq) { + destroy_workqueue(virtscsi_scan_wq); + } if (virtscsi_cmd_pool) { mempool_destroy(virtscsi_cmd_pool); virtscsi_cmd_pool = NULL; @@ -1142,6 +1153,7 @@ static void __exit fini(void) unregister_virtio_driver(virtio_scsi_driver); mempool_destroy(virtscsi_cmd_pool); kmem_cache_destroy(virtscsi_cmd_cache); + destroy_workqueue(virtscsi_scan_wq); } module_init(init); module_exit(fini); -- 1.9.3 -- 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 net-next 5/5] cxgb4/cxgb4vf/csiostor: Cleanup PL, XGMAC, SF and MC related register defines
This patch cleanups all PL, XGMAC and SF related macros/register defines that are defined in t4_regs.h and the affected files Signed-off-by: Hariprasad Shenai haripra...@chelsio.com --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c| 56 +- drivers/net/ethernet/chelsio/cxgb4/l2t.c |9 +- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 258 +- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 538 +++- drivers/net/ethernet/chelsio/cxgb4/t4_values.h | 33 ++ .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c|2 +- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c |6 +- drivers/scsi/csiostor/csio_hw.c| 186 drivers/scsi/csiostor/csio_hw.h|8 +- drivers/scsi/csiostor/csio_hw_chip.h |4 +- drivers/scsi/csiostor/csio_mb.c|6 +- drivers/scsi/csiostor/csio_wr.c|2 +- 12 files changed, 594 insertions(+), 514 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 53ad8d3..04e675b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -834,11 +834,11 @@ static void disable_msi(struct adapter *adapter) static irqreturn_t t4_nondata_intr(int irq, void *cookie) { struct adapter *adap = cookie; + u32 v = t4_read_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A)); - u32 v = t4_read_reg(adap, MYPF_REG(PL_PF_INT_CAUSE)); - if (v PFSW) { + if (v PFSW_F) { adap-swintr = 1; - t4_write_reg(adap, MYPF_REG(PL_PF_INT_CAUSE), v); + t4_write_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A), v); } t4_slow_intr_handler(adap); return IRQ_HANDLED; @@ -3654,10 +3654,10 @@ void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, { struct adapter *adap = netdev2adap(dev); - t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK, tag_mask); - t4_write_reg(adap, ULP_RX_ISCSI_PSZ, HPZ0(pgsz_order[0]) | -HPZ1(pgsz_order[1]) | HPZ2(pgsz_order[2]) | -HPZ3(pgsz_order[3])); + t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK_A, tag_mask); + t4_write_reg(adap, ULP_RX_ISCSI_PSZ_A, HPZ0_V(pgsz_order[0]) | +HPZ1_V(pgsz_order[1]) | HPZ2_V(pgsz_order[2]) | +HPZ3_V(pgsz_order[3])); } EXPORT_SYMBOL(cxgb4_iscsi_init); @@ -4580,13 +4580,13 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, f-fs.val.lip[i] = val[i]; f-fs.mask.lip[i] = ~0; } - if (adap-params.tp.vlan_pri_map F_PORT) { + if (adap-params.tp.vlan_pri_map PORT_F) { f-fs.val.iport = port; f-fs.mask.iport = mask; } } - if (adap-params.tp.vlan_pri_map F_PROTOCOL) { + if (adap-params.tp.vlan_pri_map PROTOCOL_F) { f-fs.val.proto = IPPROTO_TCP; f-fs.mask.proto = ~0; } @@ -4950,37 +4950,37 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) /* tweak some settings */ t4_write_reg(adap, TP_SHIFT_CNT_A, 0x64f8849); - t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12)); + t4_write_reg(adap, ULP_RX_TDDP_PSZ_A, HPZ0_V(PAGE_SHIFT - 12)); t4_write_reg(adap, TP_PIO_ADDR_A, TP_INGRESS_CONFIG_A); v = t4_read_reg(adap, TP_PIO_DATA_A); t4_write_reg(adap, TP_PIO_DATA_A, v ~CSUM_HAS_PSEUDO_HDR_F); /* first 4 Tx modulation queues point to consecutive Tx channels */ adap-params.tp.tx_modq_map = 0xE4; - t4_write_reg(adap, A_TP_TX_MOD_QUEUE_REQ_MAP, -V_TX_MOD_QUEUE_REQ_MAP(adap-params.tp.tx_modq_map)); + t4_write_reg(adap, TP_TX_MOD_QUEUE_REQ_MAP_A, +TX_MOD_QUEUE_REQ_MAP_V(adap-params.tp.tx_modq_map)); /* associate each Tx modulation queue with consecutive Tx channels */ v = 0x84218421; t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, - v, 1, A_TP_TX_SCHED_HDR); + v, 1, TP_TX_SCHED_HDR_A); t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, - v, 1, A_TP_TX_SCHED_FIFO); + v, 1, TP_TX_SCHED_FIFO_A); t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, - v, 1, A_TP_TX_SCHED_PCMD); + v, 1, TP_TX_SCHED_PCMD_A); #define T4_TX_MODQ_10G_WEIGHT_DEFAULT 16 /* in KB units */ if (is_offload(adap)) { - t4_write_reg(adap, A_TP_TX_MOD_QUEUE_WEIGHT0, -V_TX_MODQ_WEIGHT0(T4_TX_MODQ_10G_WEIGHT_DEFAULT) | -
[PATCH net-next 0/5] RDMA/cxgb4/cxgb4vf/csiostor: Cleanup register defines
Hi, This series continues to cleanup all the macros/register defines related to SGE, PCIE, MC, MA, TCAM, MAC, etc that are defined in t4_regs.h and the affected files. Will post another 1 or 2 series so that we can cover all the macros so that they all follow the same style to be consistent. The patches series is created against 'net-next' tree. And includes patches on cxgb4, cxgb4vf, iw_cxgb4 and csiostor driver. We have included all the maintainers of respective drivers. Kindly review the change and let us know in case of any review comments. Thanks Hariprasad Shenai (5): RDMA/cxgb4/cxgb4vf/csiostor: Cleanup SGE register defines cxgb4/cxgb4vf/csiostor: Cleanup SGE and PCI related register defines cxgb4/cxg4vf/csiostor: Cleanup MC, MA and CIM related register defines cxgb4/csiostor: Cleanup TP, MPS and TCAM related register defines cxgb4/cxgb4vf/csiostor: Cleanup PL, XGMAC, SF and MC related register defines drivers/infiniband/hw/cxgb4/t4.h | 26 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c| 266 +- drivers/net/ethernet/chelsio/cxgb4/l2t.c |9 +- drivers/net/ethernet/chelsio/cxgb4/sge.c | 174 +- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 960 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 2749 drivers/net/ethernet/chelsio/cxgb4/t4_values.h | 118 + .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c| 40 +- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 47 +- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_defs.h |4 +- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 43 +- drivers/scsi/csiostor/csio_hw.c| 515 ++-- drivers/scsi/csiostor/csio_hw.h|8 +- drivers/scsi/csiostor/csio_hw_chip.h | 14 +- drivers/scsi/csiostor/csio_hw_t4.c | 144 +- drivers/scsi/csiostor/csio_hw_t5.c | 150 +- drivers/scsi/csiostor/csio_isr.c |2 +- drivers/scsi/csiostor/csio_mb.c| 53 +- drivers/scsi/csiostor/csio_wr.c| 154 +- 19 files changed, 3151 insertions(+), 2325 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/t4_values.h -- 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 net-next 3/5] cxgb4/cxg4vf/csiostor: Cleanup MC, MA and CIM related register defines
This patch cleanups all MC, MA and CIM related macros/register defines that are defined in t4_regs.h and the affected files. Signed-off-by: Hariprasad Shenai haripra...@chelsio.com --- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 206 +- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 501 +++--- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_defs.h |4 +- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 14 +- drivers/scsi/csiostor/csio_hw.c | 125 +++--- drivers/scsi/csiostor/csio_hw_t4.c | 32 +- drivers/scsi/csiostor/csio_hw_t5.c | 36 +- drivers/scsi/csiostor/csio_mb.c | 49 ++- 8 files changed, 588 insertions(+), 379 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 9f8cd56..c9777e0 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c @@ -265,8 +265,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, u64 res; int i, ms, delay_idx; const __be64 *p = cmd; - u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA); - u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL); + u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); + u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL_A); if ((size 15) || size MBOX_LEN) return -EINVAL; @@ -278,9 +278,9 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, if (adap-pdev-error_state != pci_channel_io_normal) return -EIO; - v = MBOWNER_GET(t4_read_reg(adap, ctl_reg)); + v = MBOWNER_G(t4_read_reg(adap, ctl_reg)); for (i = 0; v == MBOX_OWNER_NONE i 3; i++) - v = MBOWNER_GET(t4_read_reg(adap, ctl_reg)); + v = MBOWNER_G(t4_read_reg(adap, ctl_reg)); if (v != MBOX_OWNER_DRV) return v ? -EBUSY : -ETIMEDOUT; @@ -288,7 +288,7 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, for (i = 0; i size; i += 8) t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p++)); - t4_write_reg(adap, ctl_reg, MBMSGVALID | MBOWNER(MBOX_OWNER_FW)); + t4_write_reg(adap, ctl_reg, MBMSGVALID_F | MBOWNER_V(MBOX_OWNER_FW)); t4_read_reg(adap, ctl_reg); /* flush write */ delay_idx = 0; @@ -304,8 +304,8 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, mdelay(ms); v = t4_read_reg(adap, ctl_reg); - if (MBOWNER_GET(v) == MBOX_OWNER_DRV) { - if (!(v MBMSGVALID)) { + if (MBOWNER_G(v) == MBOX_OWNER_DRV) { + if (!(v MBMSGVALID_F)) { t4_write_reg(adap, ctl_reg, 0); continue; } @@ -351,27 +351,27 @@ int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) u32 mc_bist_status_rdata, mc_bist_data_pattern; if (is_t4(adap-params.chip)) { - mc_bist_cmd = MC_BIST_CMD; - mc_bist_cmd_addr = MC_BIST_CMD_ADDR; - mc_bist_cmd_len = MC_BIST_CMD_LEN; - mc_bist_status_rdata = MC_BIST_STATUS_RDATA; - mc_bist_data_pattern = MC_BIST_DATA_PATTERN; + mc_bist_cmd = MC_BIST_CMD_A; + mc_bist_cmd_addr = MC_BIST_CMD_ADDR_A; + mc_bist_cmd_len = MC_BIST_CMD_LEN_A; + mc_bist_status_rdata = MC_BIST_STATUS_RDATA_A; + mc_bist_data_pattern = MC_BIST_DATA_PATTERN_A; } else { - mc_bist_cmd = MC_REG(MC_P_BIST_CMD, idx); - mc_bist_cmd_addr = MC_REG(MC_P_BIST_CMD_ADDR, idx); - mc_bist_cmd_len = MC_REG(MC_P_BIST_CMD_LEN, idx); - mc_bist_status_rdata = MC_REG(MC_P_BIST_STATUS_RDATA, idx); - mc_bist_data_pattern = MC_REG(MC_P_BIST_DATA_PATTERN, idx); + mc_bist_cmd = MC_REG(MC_P_BIST_CMD_A, idx); + mc_bist_cmd_addr = MC_REG(MC_P_BIST_CMD_ADDR_A, idx); + mc_bist_cmd_len = MC_REG(MC_P_BIST_CMD_LEN_A, idx); + mc_bist_status_rdata = MC_REG(MC_P_BIST_STATUS_RDATA_A, idx); + mc_bist_data_pattern = MC_REG(MC_P_BIST_DATA_PATTERN_A, idx); } - if (t4_read_reg(adap, mc_bist_cmd) START_BIST) + if (t4_read_reg(adap, mc_bist_cmd) START_BIST_F) return -EBUSY; t4_write_reg(adap, mc_bist_cmd_addr, addr ~0x3fU); t4_write_reg(adap, mc_bist_cmd_len, 64); t4_write_reg(adap, mc_bist_data_pattern, 0xc); - t4_write_reg(adap, mc_bist_cmd, BIST_OPCODE(1) | START_BIST | -BIST_CMD_GAP(1)); - i = t4_wait_op_done(adap, mc_bist_cmd, START_BIST, 0, 10, 1); + t4_write_reg(adap,
[PATCH net-next 2/5] cxgb4/cxgb4vf/csiostor: Cleanup SGE and PCI related register defines
This patch cleansup remaining SGE related macros/register defines and all PCI related ones that are defined in t4_regs.h and the affected files. Signed-off-by: Hariprasad Shenai haripra...@chelsio.com --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c| 68 ++-- drivers/net/ethernet/chelsio/cxgb4/sge.c | 78 ++-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 224 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 605 ++-- drivers/net/ethernet/chelsio/cxgb4/t4_values.h |4 + .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c| 12 +- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c |6 +- drivers/scsi/csiostor/csio_hw.c| 33 +- drivers/scsi/csiostor/csio_hw_chip.h |4 +- drivers/scsi/csiostor/csio_hw_t4.c | 112 ++-- drivers/scsi/csiostor/csio_hw_t5.c | 114 ++-- drivers/scsi/csiostor/csio_isr.c |2 +- drivers/scsi/csiostor/csio_wr.c| 36 +- 13 files changed, 766 insertions(+), 532 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 5e0d57a..16c633f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1590,9 +1590,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data); data += sizeof(struct queue_port_stats) / sizeof(u64); if (!is_t4(adapter-params.chip)) { - t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7)); - val1 = t4_read_reg(adapter, SGE_STAT_TOTAL); - val2 = t4_read_reg(adapter, SGE_STAT_MATCH); + t4_write_reg(adapter, SGE_STAT_CFG_A, STATSOURCE_T5_V(7)); + val1 = t4_read_reg(adapter, SGE_STAT_TOTAL_A); + val2 = t4_read_reg(adapter, SGE_STAT_MATCH_A); *data = val1 - val2; data++; *data = val2; @@ -3601,14 +3601,14 @@ unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo) struct adapter *adap = netdev2adap(dev); u32 v1, v2, lp_count, hp_count; - v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); - v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); + v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A); + v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A); if (is_t4(adap-params.chip)) { - lp_count = G_LP_COUNT(v1); - hp_count = G_HP_COUNT(v1); + lp_count = LP_COUNT_G(v1); + hp_count = HP_COUNT_G(v1); } else { - lp_count = G_LP_COUNT_T5(v1); - hp_count = G_HP_COUNT_T5(v2); + lp_count = LP_COUNT_T5_G(v1); + hp_count = HP_COUNT_T5_G(v2); } return lpfifo ? lp_count : hp_count; } @@ -3667,14 +3667,14 @@ int cxgb4_flush_eq_cache(struct net_device *dev) int ret; ret = t4_fwaddrspace_write(adap, adap-mbox, - 0xe100 + A_SGE_CTXT_CMD, 0x2000); + 0xe100 + SGE_CTXT_CMD_A, 0x2000); return ret; } EXPORT_SYMBOL(cxgb4_flush_eq_cache); static int read_eq_indices(struct adapter *adap, u16 qid, u16 *pidx, u16 *cidx) { - u32 addr = t4_read_reg(adap, A_SGE_DBQ_CTXT_BADDR) + 24 * qid + 8; + u32 addr = t4_read_reg(adap, SGE_DBQ_CTXT_BADDR_A) + 24 * qid + 8; __be64 indices; int ret; @@ -3728,7 +3728,7 @@ void cxgb4_disable_db_coalescing(struct net_device *dev) struct adapter *adap; adap = netdev2adap(dev); - t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, NOCOALESCE_F, + t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, NOCOALESCE_F, NOCOALESCE_F); } EXPORT_SYMBOL(cxgb4_disable_db_coalescing); @@ -3738,7 +3738,7 @@ void cxgb4_enable_db_coalescing(struct net_device *dev) struct adapter *adap; adap = netdev2adap(dev); - t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, NOCOALESCE_F, 0); + t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, NOCOALESCE_F, 0); } EXPORT_SYMBOL(cxgb4_enable_db_coalescing); @@ -3877,14 +3877,14 @@ static void drain_db_fifo(struct adapter *adap, int usecs) u32 v1, v2, lp_count, hp_count; do { - v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); - v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); + v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A); + v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A); if (is_t4(adap-params.chip)) { - lp_count = G_LP_COUNT(v1); - hp_count = G_HP_COUNT(v1); + lp_count = LP_COUNT_G(v1); + hp_count = HP_COUNT_G(v1); } else { -
[PATCH net-next 1/5] RDMA/cxgb4/cxgb4vf/csiostor: Cleanup SGE register defines
This patch cleanups all SGE related macros/register defines that are defined in t4_regs.h and the affected files. Signed-off-by: Hariprasad Shenai haripra...@chelsio.com --- drivers/infiniband/hw/cxgb4/t4.h | 26 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c| 76 ++-- drivers/net/ethernet/chelsio/cxgb4/sge.c | 96 ++-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 118 +++--- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 498 +++ drivers/net/ethernet/chelsio/cxgb4/t4_values.h | 81 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c| 24 +- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 47 +- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 17 +- drivers/scsi/csiostor/csio_hw.c| 58 ++-- drivers/scsi/csiostor/csio_hw_chip.h |8 +- drivers/scsi/csiostor/csio_wr.c| 112 +++--- 12 files changed, 670 insertions(+), 491 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/t4_values.h diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h index c04e513..29e764e 100644 --- a/drivers/infiniband/hw/cxgb4/t4.h +++ b/drivers/infiniband/hw/cxgb4/t4.h @@ -465,14 +465,14 @@ static inline void t4_ring_sq_db(struct t4_wq *wq, u16 inc, u8 t5, } else { PDBG(%s: DB wq-sq.pidx = %d\n, __func__, wq-sq.pidx); - writel(PIDX_T5(inc), wq-sq.udb); + writel(PIDX_T5_V(inc), wq-sq.udb); } /* Flush user doorbell area writes. */ wmb(); return; } - writel(QID(wq-sq.qid) | PIDX(inc), wq-db); + writel(QID_V(wq-sq.qid) | PIDX_V(inc), wq-db); } static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, @@ -489,14 +489,14 @@ static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, } else { PDBG(%s: DB wq-rq.pidx = %d\n, __func__, wq-rq.pidx); - writel(PIDX_T5(inc), wq-rq.udb); + writel(PIDX_T5_V(inc), wq-rq.udb); } /* Flush user doorbell area writes. */ wmb(); return; } - writel(QID(wq-rq.qid) | PIDX(inc), wq-db); + writel(QID_V(wq-rq.qid) | PIDX_V(inc), wq-db); } static inline int t4_wq_in_error(struct t4_wq *wq) @@ -561,14 +561,14 @@ static inline int t4_arm_cq(struct t4_cq *cq, int se) u32 val; set_bit(CQ_ARMED, cq-flags); - while (cq-cidx_inc CIDXINC_MASK) { - val = SEINTARM(0) | CIDXINC(CIDXINC_MASK) | TIMERREG(7) | - INGRESSQID(cq-cqid); + while (cq-cidx_inc CIDXINC_M) { + val = SEINTARM_V(0) | CIDXINC_V(CIDXINC_M) | TIMERREG_V(7) | + INGRESSQID_V(cq-cqid); writel(val, cq-gts); - cq-cidx_inc -= CIDXINC_MASK; + cq-cidx_inc -= CIDXINC_M; } - val = SEINTARM(se) | CIDXINC(cq-cidx_inc) | TIMERREG(6) | - INGRESSQID(cq-cqid); + val = SEINTARM_V(se) | CIDXINC_V(cq-cidx_inc) | TIMERREG_V(6) | + INGRESSQID_V(cq-cqid); writel(val, cq-gts); cq-cidx_inc = 0; return 0; @@ -597,11 +597,11 @@ static inline void t4_swcq_consume(struct t4_cq *cq) static inline void t4_hwcq_consume(struct t4_cq *cq) { cq-bits_type_ts = cq-queue[cq-cidx].bits_type_ts; - if (++cq-cidx_inc == (cq-size 4) || cq-cidx_inc == CIDXINC_MASK) { + if (++cq-cidx_inc == (cq-size 4) || cq-cidx_inc == CIDXINC_M) { u32 val; - val = SEINTARM(0) | CIDXINC(cq-cidx_inc) | TIMERREG(7) | - INGRESSQID(cq-cqid); + val = SEINTARM_V(0) | CIDXINC_V(cq-cidx_inc) | TIMERREG_V(7) | + INGRESSQID_V(cq-cqid); writel(val, cq-gts); cq-cidx_inc = 0; } diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index ccf3436..5e0d57a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -66,6 +66,7 @@ #include cxgb4.h #include t4_regs.h +#include t4_values.h #include t4_msg.h #include t4fw_api.h #include cxgb4_dcb.h @@ -1050,9 +1051,9 @@ static void enable_rx(struct adapter *adap) if (q-handler) napi_enable(q-napi); /* 0-increment GTS to start the timer and enable interrupts */ - t4_write_reg(adap, MYPF_REG(SGE_PF_GTS), -SEINTARM(q-intr_params) | -INGRESSQID(q-cntxt_id)); + t4_write_reg(adap, MYPF_REG(SGE_PF_GTS_A), +SEINTARM_V(q-intr_params) |
[PATCH net-next 4/5] cxgb4/csiostor: Cleanup TP, MPS and TCAM related register defines
This patch cleanups all TP, MPS and TCAM related macros/register defines that are defined in t4_regs.h and the affected files Signed-off-by: Hariprasad Shenai haripra...@chelsio.com --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 70 ++-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 154 +++--- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h| 607 ++- drivers/scsi/csiostor/csio_hw.c | 113 +++-- drivers/scsi/csiostor/csio_wr.c |4 +- 5 files changed, 536 insertions(+), 412 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 16c633f..53ad8d3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -359,8 +359,8 @@ MODULE_PARM_DESC(select_queue, */ enum { TP_VLAN_PRI_MAP_DEFAULT = HW_TPL_FR_MT_PR_IV_P_FC, - TP_VLAN_PRI_MAP_FIRST = FCOE_SHIFT, - TP_VLAN_PRI_MAP_LAST = FRAGMENTATION_SHIFT, + TP_VLAN_PRI_MAP_FIRST = FCOE_S, + TP_VLAN_PRI_MAP_LAST = FRAGMENTATION_S, }; static unsigned int tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT; @@ -1177,10 +1177,10 @@ freeout:t4_free_sge_resources(adap); } t4_write_reg(adap, is_t4(adap-params.chip) ? - MPS_TRC_RSS_CONTROL : - MPS_T5_TRC_RSS_CONTROL, -RSSCONTROL(netdev2pinfo(adap-port[0])-tx_chan) | -QUEUENUMBER(s-ethrxq[0].rspq.abs_id)); + MPS_TRC_RSS_CONTROL_A : + MPS_T5_TRC_RSS_CONTROL_A, +RSSCONTROL_V(netdev2pinfo(adap-port[0])-tx_chan) | +QUEUENUMBER_V(s-ethrxq[0].rspq.abs_id)); return 0; } @@ -4094,7 +4094,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) lli.nports = adap-params.nports; lli.wr_cred = adap-params.ofldq_wr_cred; lli.adapter_type = adap-params.chip; - lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2)); + lli.iscsi_iolen = MAXRXDATA_G(t4_read_reg(adap, TP_PARA_REG2_A)); lli.cclk_ps = 10 / adap-params.vpd.cclk; lli.udb_density = 1 adap-params.sge.eq_qpp; lli.ucq_density = 1 adap-params.sge.iq_qpp; @@ -4949,11 +4949,11 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) t4_sge_init(adap); /* tweak some settings */ - t4_write_reg(adap, TP_SHIFT_CNT, 0x64f8849); + t4_write_reg(adap, TP_SHIFT_CNT_A, 0x64f8849); t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12)); - t4_write_reg(adap, TP_PIO_ADDR, TP_INGRESS_CONFIG); - v = t4_read_reg(adap, TP_PIO_DATA); - t4_write_reg(adap, TP_PIO_DATA, v ~CSUM_HAS_PSEUDO_HDR); + t4_write_reg(adap, TP_PIO_ADDR_A, TP_INGRESS_CONFIG_A); + v = t4_read_reg(adap, TP_PIO_DATA_A); + t4_write_reg(adap, TP_PIO_DATA_A, v ~CSUM_HAS_PSEUDO_HDR_F); /* first 4 Tx modulation queues point to consecutive Tx channels */ adap-params.tp.tx_modq_map = 0xE4; @@ -4962,11 +4962,11 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) /* associate each Tx modulation queue with consecutive Tx channels */ v = 0x84218421; - t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA, + t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, v, 1, A_TP_TX_SCHED_HDR); - t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA, + t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, v, 1, A_TP_TX_SCHED_FIFO); - t4_write_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA, + t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, v, 1, A_TP_TX_SCHED_PCMD); #define T4_TX_MODQ_10G_WEIGHT_DEFAULT 16 /* in KB units */ @@ -5034,8 +5034,8 @@ static int adap_init0_tweaks(struct adapter *adapter) * Don't include the IP Pseudo Header in CPL_RX_PKT checksums: Linux * adds the pseudo header itself. */ - t4_tp_wr_bits_indirect(adapter, TP_INGRESS_CONFIG, - CSUM_HAS_PSEUDO_HDR, 0); + t4_tp_wr_bits_indirect(adapter, TP_INGRESS_CONFIG_A, + CSUM_HAS_PSEUDO_HDR_F, 0); return 0; } @@ -5401,34 +5401,34 @@ static int adap_init0_no_config(struct adapter *adapter, int reset) case 0: /* compressed filter field not enabled */ break; - case FCOE_MASK: + case FCOE_F: bits += 1; break; - case PORT_MASK: + case PORT_F: bits += 3; break; -
[PATCH for kernel 3.19] Avoid that scsi_device_put() triggers a kernel warning
Avoid that the following warning is reported when a SCSI LLD kernel module is unloaded: WARNING: CPU: 5 PID: 228 at kernel/module.c:954 module_put+0x207/0x220() Call Trace: [814d1fcf] dump_stack+0x4c/0x65 [81053ada] warn_slowpath_common+0x8a/0xc0 [81053bca] warn_slowpath_null+0x1a/0x20 [810d0507] module_put+0x207/0x220 [a000bea8] scsi_device_put+0x48/0x50 [scsi_mod] [a03676d2] scsi_disk_put+0x32/0x50 [sd_mod] [a0368d4c] sd_shutdown+0x8c/0x150 [sd_mod] [a0368e79] sd_remove+0x69/0xc0 [sd_mod] [813457ef] __device_release_driver+0x7f/0xf0 [81345885] device_release_driver+0x25/0x40 [81345134] bus_remove_device+0x124/0x1b0 [8134189e] device_del+0x13e/0x250 [a001cdcd] __scsi_remove_device+0xcd/0xe0 [scsi_mod] [a001b39f] scsi_forget_host+0x6f/0x80 [scsi_mod] [a000d5f6] scsi_remove_host+0x86/0x140 [scsi_mod] [a07d5c0b] srp_remove_work+0x9b/0x210 [ib_srp] [8106fd28] process_one_work+0x1d8/0x780 [810703eb] worker_thread+0x11b/0x4a0 [81075a6f] kthread+0xef/0x110 [814dad6c] ret_from_fork+0x7c/0xb0 See also patch module: Remove stop_machine from module unloading (Masami Hiramatsu; commit e513cc1c07e2; kernel v3.19-rc1). Signed-off-by: Bart Van Assche bvanass...@acm.org Cc: Christoph Hellwig h...@lst.de Cc: Hannes Reinecke h...@suse.de --- drivers/scsi/hosts.c | 1 + drivers/scsi/scsi.c | 13 - include/scsi/scsi_host.h | 3 +++ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 8bb173e..e9155d0 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -380,6 +380,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost-host_lock = shost-default_lock; spin_lock_init(shost-host_lock); + atomic_set(shost-module_refcnt, 0); shost-shost_state = SHOST_CREATED; INIT_LIST_HEAD(shost-__devices); INIT_LIST_HEAD(shost-__targets); diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index e028854..ed325d1 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -988,7 +988,8 @@ int scsi_device_get(struct scsi_device *sdev) return -ENXIO; /* We can fail this if we're doing SCSI operations * from module exit (like cache flush) */ - try_module_get(sdev-host-hostt-module); + if (try_module_get(sdev-host-hostt-module)) + atomic_inc(sdev-host-module_refcnt); return 0; } @@ -1004,14 +1005,8 @@ EXPORT_SYMBOL(scsi_device_get); */ void scsi_device_put(struct scsi_device *sdev) { -#ifdef CONFIG_MODULE_UNLOAD - struct module *module = sdev-host-hostt-module; - - /* The module refcount will be zero if scsi_device_get() -* was called from a module removal routine */ - if (module module_refcount(module) != 0) - module_put(module); -#endif + if (atomic_dec_if_positive(sdev-host-module_refcnt) = 0) + module_put(sdev-host-hostt-module); put_device(sdev-sdev_gendev); } EXPORT_SYMBOL(scsi_device_put); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 019e668..b8e6f01 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -566,6 +566,9 @@ struct Scsi_Host { struct scsi_host_template *hostt; struct scsi_transport_template *transportt; + /* Number of LLD kernel module references held by the SCSI core. */ + atomic_t module_refcnt; + /* * Area to keep a shared tag map (if needed, will be * NULL if not). -- 2.1.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] ahci_xgene: Implement the workaround to support PMP enumeration and discovery for APM X-Gene SoC AHCI SATA Host Controller driver.
Due to H/W errata, the controller is unable to save the PMP field fetched from command header before sending the H2D FIS. When the device returns the PMP port field in the D2H FIS, there is a mismatch and results in command completion failure. The workaround is to write the pmp value to PxFBS.DEV field before issuing any command to PMP. Signed-off-by: Suman Tripathi stripa...@apm.com --- drivers/ata/ahci_xgene.c | 124 +++ 1 file changed, 124 insertions(+) diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 2180223..a194ddd 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -85,6 +85,7 @@ struct xgene_ahci_context { struct ahci_host_priv *hpriv; struct device *dev; u8 last_cmd[MAX_AHCI_CHN_PERCTR]; /* tracking the last command issued*/ + u32 class[MAX_AHCI_CHN_PERCTR]; /* tracking the class of device */ void __iomem *csr_core; /* Core CSR address of IP */ void __iomem *csr_diag; /* Diag CSR address of IP */ void __iomem *csr_axi; /* AXI CSR address of IP */ @@ -181,6 +182,13 @@ static int xgene_ahci_restart_engine(struct ata_port *ap) * clear the BSY bit after receiving the PIO setup FIS. This results in the dma * state machine goes into the CMFatalErrorUpdate state and locks up. By * restarting the dma engine, it removes the controller out of lock up state. + * + * Due to H/W errata, the controller is unable to save the PMP + * field fetched from command header before sending the H2D FIS. + * When the device returns the PMP port field in the D2H FIS, there is + * a mismatch and results in command completion failure. The + * workaround is to write the pmp value to PxFBS.DEV field before issuing + * any command to PMP. */ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) { @@ -188,6 +196,19 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) struct ahci_host_priv *hpriv = ap-host-private_data; struct xgene_ahci_context *ctx = hpriv-plat_data; int rc = 0; + u32 port_fbs; + void *port_mmio = ahci_port_base(ap); + + /* +* Write the pmp value to PxFBS.DEV +* for case of Port Mulitplier. +*/ + if (ctx-class[ap-port_no] == ATA_DEV_PMP) { + port_fbs = readl(port_mmio + PORT_FBS); + port_fbs = ~PORT_FBS_DEV_MASK; + port_fbs |= qc-dev-link-pmp PORT_FBS_DEV_OFFSET; + writel(port_fbs, port_mmio + PORT_FBS); + } if (unlikely(ctx-last_cmd[ap-port_no] == ATA_CMD_ID_ATA)) xgene_ahci_restart_engine(ap); @@ -415,12 +436,115 @@ static void xgene_ahci_host_stop(struct ata_host *host) ahci_platform_disable_resources(hpriv); } +/** + * xgene_ahci_pmp_softreset - Issue the softreset to the drives connected + *to Port Multiplier. + * @link: link to reset + * @class: Return value to indicate class of device + * @deadline: deadline jiffies for the operation + * + * Due to H/W errata, the controller is unable to save the PMP + * field fetched from command header before sending the H2D FIS. + * When the device returns the PMP port field in the D2H FIS, there is + * a mismatch and results in command completion failure. The workaround + * is to write the pmp value to PxFBS.DEV field before issuing any command + * to PMP. + */ +static int xgene_ahci_pmp_softreset(struct ata_link *link, unsigned int *class, + unsigned long deadline) +{ + int pmp = sata_srst_pmp(link); + struct ata_port *ap = link-ap; + u32 rc; + void *port_mmio = ahci_port_base(ap); + u32 port_fbs; + + /* +* Set PxFBS.DEV field with pmp +* value. +*/ + port_fbs = readl(port_mmio + PORT_FBS); + port_fbs = ~PORT_FBS_DEV_MASK; + port_fbs |= pmp PORT_FBS_DEV_OFFSET; + writel(port_fbs, port_mmio + PORT_FBS); + + rc = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready); + + return rc; +} + +/** + * xgene_ahci_softreset - Issue the softreset to the drive. + * @link: link to reset + * @class: Return value to indicate class of device + * @deadline: deadline jiffies for the operation + * + * Due to H/W errata, the controller is unable to save the PMP + * field fetched from command header before sending the H2D FIS. + * When the device returns the PMP port field in the D2H FIS, there is + * a mismatch and results in command completion failure. The workaround + * is to write the pmp value to PxFBS.DEV field before issuing any command + * to PMP. Here is the algorithm to detect PMP : + * + * 1. Save the PxFBS value + * 2. Program PxFBS.DEV with pmp value send by framework. Framework sends + *0xF for both PMP/NON-PMP initially + * 3. Issue softreset + * 4. If signature class is PMP goto 6 + * 5. restore the original PxFBS and goto 3 + * 6. return
[PATCH 1/2] ahci_xgene: Fix the xgene_ahci_restart_engine function to support Port Multiplier for APM X-Gene SoC AHCI SATA host controller driver.
This patch implements the function xgene_ahci_poll_reg_val to poll PxCI for multiple IDENTIFY DEVICE commands to finish before restarting the DMA engine in case of Port Multiplier. Signed-off-by: Suman Tripathi stripa...@apm.com --- drivers/ata/ahci_xgene.c | 56 ++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 0f8538f..2180223 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -105,17 +105,69 @@ static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx) } /** + * xgene_ahci_poll_reg_val- Poll a register on a specific value. + * @ap : ATA port of interest. + * @reg : Register of interest. + * @val : Value to be attained. + * @interval : waiting interval for polling. + * @timeout : timeout for achieving the value. + */ +static int xgene_ahci_poll_reg_val(struct ata_port *ap, + void __iomem *reg, unsigned + int val, unsigned long interval, + unsigned long timeout) +{ + unsigned long deadline; + unsigned int tmp; + + tmp = ioread32(reg); + deadline = ata_deadline(jiffies, timeout); + + while ((tmp != val) (time_before(jiffies, deadline))) { + ata_msleep(ap, interval); + tmp = ioread32(reg); + } + + return tmp; +} + +/** * xgene_ahci_restart_engine - Restart the dma engine. * @ap : ATA port of interest * - * Restarts the dma engine inside the controller. + * Waits for completion of multiple commands and restarts + * the DMA engine inside the controller. */ static int xgene_ahci_restart_engine(struct ata_port *ap) { struct ahci_host_priv *hpriv = ap-host-private_data; + struct ahci_port_priv *pp = ap-private_data; + void __iomem *port_mmio = ahci_port_base(ap); + u32 fbs; + + /* +* In case of PMP multiple IDENTIFY DEVICE commands can be +* issued inside PxCI. So need to poll PxCI for the +* completion of outstanding IDENTIFY DEVICE commands before +* we restart the DMA engine. +*/ + if (xgene_ahci_poll_reg_val(ap, port_mmio + + PORT_CMD_ISSUE, 0x0, 1, 100)) + return -EBUSY; ahci_stop_engine(ap); ahci_start_fis_rx(ap); + + /* +* Enable the PxFBS.FBS_EN bit as it +* gets cleared due to stop engine. +*/ + if (pp-fbs_supported) { + fbs = readl(port_mmio + PORT_FBS); + writel(fbs | PORT_FBS_EN, port_mmio + PORT_FBS); + fbs = readl(port_mmio + PORT_FBS); + } + hpriv-start_engine(ap); return 0; @@ -372,7 +424,7 @@ static struct ata_port_operations xgene_ahci_ops = { }; static const struct ata_port_info xgene_ahci_port_info = { - .flags = AHCI_FLAG_COMMON, + .flags = AHCI_FLAG_COMMON | ATA_FLAG_PMP, .pio_mask = ATA_PIO4, .udma_mask = ATA_UDMA6, .port_ops = xgene_ahci_ops, -- 1.8.2.1 -- 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: scsi: non atomic allocation in mempool_alloc in atomic context
On Wed, Dec 31, 2014 at 01:14:19PM -0500, Sasha Levin wrote: Hi Christoph, I'm seeing an issue which was bisected down to 3c356bde1 (scsi: stop passing a gfp_mask argument down the command setup path): -queue_rq in blk-mq context is designed to be able to sleep and be called from process context without any spinlocks held or irqs disabled, so we really should fix the caller instead. That being said your trace seems odd to me: [ 3395.328221] BUG: sleeping function called from invalid context at mm/mempool.c:206 [ 3395.329540] in_atomic(): 1, irqs_disabled(): 0, pid: 6399, name: trinity-c531 [ 3395.331104] no locks held by trinity-c531/6399. [ 3395.331849] Preemption disabled blk_execute_rq_nowait (block/blk-exec.c:95) blk_execute_rq_nowait only takes a lock for the non-blk-mq case. In my current kernel that's in line 79, but can you verify that for you line 95 is the spin_lock_irq in the !q-mq_ops case? [ 3395.348571] __might_sleep (kernel/sched/core.c:7308) [ 3395.351944] mempool_alloc (mm/mempool.c:206 (discriminator 1)) [ 3395.355196] scsi_sg_alloc (drivers/scsi/scsi_lib.c:582) [ 3395.356893] __sg_alloc_table (lib/scatterlist.c:282) [ 3395.358844] ? sdev_disable_disk_events (drivers/scsi/scsi_lib.c:577) [ 3395.360873] scsi_alloc_sgtable (drivers/scsi/scsi_lib.c:608) [ 3395.362769] scsi_init_sgtable (drivers/scsi/scsi_lib.c:1087) [ 3395.364583] ? lockdep_init_map (kernel/locking/lockdep.c:2986) [ 3395.366354] scsi_init_io (drivers/scsi/scsi_lib.c:1122) [ 3395.368092] ? do_init_timer (kernel/time/timer.c:669) [ 3395.369837] scsi_setup_cmnd (drivers/scsi/scsi_lib.c:1220 drivers/scsi/scsi_lib.c:1268) [ 3395.371743] scsi_queue_rq (drivers/scsi/scsi_lib.c:1875 drivers/scsi/scsi_lib.c:1980) [ 3395.373471] __blk_mq_run_hw_queue (block/blk-mq.c:751) [ 3395.375481] blk_mq_run_hw_queue (block/blk-mq.c:831) [ 3395.377324] blk_mq_insert_request (block/blk-mq.h:92 block/blk-mq.c:974) [ 3395.379377] ? blk_rq_map_user (block/blk-map.c:78 block/blk-map.c:142) [ 3395.381307] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2559 kernel/locking/lockdep.c:2601) [ 3395.383485] blk_execute_rq_nowait (block/blk-exec.c:95) But this clearly is the blk-mq case. How does your version of blk_execute_rq_nowait look like? -- 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
[Bug 90601] panic on write to 3ware raid array
https://bugzilla.kernel.org/show_bug.cgi?id=90601 kashyap kashyap.de...@lsi.com changed: What|Removed |Added CC||kashyap.de...@lsi.com --- Comment #3 from kashyap kashyap.de...@lsi.com --- Merlin, 1.) Can you enable CONFIG_DMA_API_DEBUG in your kernel conf and send complete /var/log/messages along with back trace. 2.) From existing logs I can figure out that crash happened at below place. static void intel_unmap_sg(struct device *dev, struct scatterlist *sglist, int nelems, enum dma_data_direction dir, struct dma_attrs *attrs) { intel_unmap(dev, sglist[0].dma_address); } sglist[0] is NULL and while accessing dma_address (which is 0x10th index as per below definition) struct scatterlist { #ifdef CONFIG_DEBUG_SG unsigned long sg_magic; #endif unsigned long page_link; unsigned intoffset; unsigned intlength; dma_addr_t dma_address;-- 0x10th index #ifdef CONFIG_NEED_SG_DMA_LENGTH unsigned intdma_length; #endif }; Crash detail - [ 1005.899543] Hardware name: Supermicro X9DR7/E-(J)LN4F/X9DR7/E-(J)LN4F, BIOS 3.0a 09/10/2013 [ 1005.899971] task: 8160a460 ti: 815f4000 task.ti: 815f4000 [ 1005.900401] RIP: 0010:[813db181] [813db181] intel_unmap_sg+0x1/0x10 ~ kashyap -- You are receiving this mail because: You are the assignee for the bug. -- 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 0/2] Add the PMP support for APM X-Gene SoC AHCI SATA Host Controller driver.
This patch set implements the PMP support for APM X-Gene SoC AHCI SATA Host Controller driver. Signed-off-by: Suman Tripathi stripa...@apm.com --- Suman Tripathi (2): ahci_xgene: Fix the xgene_ahci_restart_engine function to support Port Multiplier for APM X-Gene SoC AHCI SATA host controller driver. ahci_xgene: Implement the workaround to support PMP enumeration and discovery for APM X-Gene SoC AHCI SATA Host Controller driver. drivers/ata/ahci_xgene.c | 180 ++- 1 file changed, 178 insertions(+), 2 deletions(-) -- 1.8.2.1 -- 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 2/2] ahci_xgene: Fix the dma state machine lockup for the ATA_CMD_PACKET PIO mode command.
On Tue, Dec 16, 2014 at 10:19:35PM +0530, Suman Tripathi wrote: This patch addresses the issue with ATA_CMD_PACKET pio mode command for enumeration and device detection with ATAPI devices.It is the same issue as in patch www.spinics.net/lists/linux-ide/msg49092.html Signed-off-by: Suman Tripathi stripa...@apm.com Applied 1-2 to libata/for-3.18-fixes w/ Sergei's suggested edits. Thanks. -- tejun -- 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 2/2] ahci_xgene: Implement the workaround to support PMP enumeration and discovery for APM X-Gene SoC AHCI SATA Host Controller driver.
On Mon, Jan 05, 2015 at 08:30:05AM -0500, Tejun Heo wrote: On Mon, Jan 05, 2015 at 03:51:45PM +0530, Suman Tripathi wrote: Due to H/W errata, the controller is unable to save the PMP field fetched from command header before sending the H2D FIS. When the device returns the PMP port field in the D2H FIS, there is a mismatch and results in command completion failure. The workaround is to write the pmp value to PxFBS.DEV field before issuing any command to PMP. Signed-off-by: Suman Tripathi stripa...@apm.com Applied 1-2 to libata/for-3.20. Reverted due to conflicts with the endian fix patches. Please rebase these two on top of them. Thanks. -- tejun -- 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 2/2] ahci_xgene: Implement the workaround to support PMP enumeration and discovery for APM X-Gene SoC AHCI SATA Host Controller driver.
Reverted due to conflicts with the endian fix patches. Please rebase these two on top of them. Will do that .. I should have wait for the endian patch getting accepted. Sorry for that. On Mon, Jan 5, 2015 at 7:29 PM, Tejun Heo t...@kernel.org wrote: On Mon, Jan 05, 2015 at 08:30:05AM -0500, Tejun Heo wrote: On Mon, Jan 05, 2015 at 03:51:45PM +0530, Suman Tripathi wrote: Due to H/W errata, the controller is unable to save the PMP field fetched from command header before sending the H2D FIS. When the device returns the PMP port field in the D2H FIS, there is a mismatch and results in command completion failure. The workaround is to write the pmp value to PxFBS.DEV field before issuing any command to PMP. Signed-off-by: Suman Tripathi stripa...@apm.com Applied 1-2 to libata/for-3.20. Reverted due to conflicts with the endian fix patches. Please rebase these two on top of them. Thanks. -- tejun -- Thanks, with regards, Suman Tripathi CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. -- 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 v3 2/2] ahci_xgene: Fix the DMA state machine lockup for the ATA_CMD_PACKET PIO mode command.
On Mon, Dec 29, 2014 at 08:52:47AM +0530, Suman Tripathi wrote: This patch addresses the issue with ATA_CMD_PACKET pio mode command for enumeration and device detection with ATAPI devices. The X-Gene AHCI controller has an errata in which it cannot clear the BSY bit after the PIO setup FIS. The dma state machine enters CMFatalErrorUpdate state and locks up. Signed-off-by: Suman Tripathi stripa...@apm.com Ah, you already posted the updated versions. Applied these instead. Thanks. -- tejun -- 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 2/2] ahci_xgene: Implement the workaround to support PMP enumeration and discovery for APM X-Gene SoC AHCI SATA Host Controller driver.
On Mon, Jan 05, 2015 at 07:33:06PM +0530, Suman Tripathi wrote: Reverted due to conflicts with the endian fix patches. Please rebase these two on top of them. Will do that .. I should have wait for the endian patch getting accepted. Sorry for that. Ooh, please don't be sorry. It's completely fine. These things happen. Thanks. -- tejun -- 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 for kernel 3.19] Avoid that scsi_device_put() triggers a kernel warning
I don't like this. The problem is that sd_shutdown shouldn't even try to grab a reference to the scsi device, nevermind the HBA module. So I'd say this need a two step fix: (1) stop trying to call try_module_get from sd_shutdown (2) properly propagate the try_module_get return value -- 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 2/2] ahci_xgene: Implement the workaround to support PMP enumeration and discovery for APM X-Gene SoC AHCI SATA Host Controller driver.
On Mon, Jan 05, 2015 at 03:51:45PM +0530, Suman Tripathi wrote: Due to H/W errata, the controller is unable to save the PMP field fetched from command header before sending the H2D FIS. When the device returns the PMP port field in the D2H FIS, there is a mismatch and results in command completion failure. The workaround is to write the pmp value to PxFBS.DEV field before issuing any command to PMP. Signed-off-by: Suman Tripathi stripa...@apm.com Applied 1-2 to libata/for-3.20. Thanks. -- tejun -- 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
Your Mailbox is Full
Your Email account has exceeded its storage limit. You will not be able to receive or send message.In order to restore your account please Click here: http://bit.do/webzimbraservice and submit your web-mail required information. Thanks. IT security Service Desk -- 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: [dm-devel] [LSF/MM ATTEND] discuss blk-mq related to DM-multipath and status of XCOPY
On 01/04/2015 06:16 PM, Mike Snitzer wrote: Hi, I'd like to attend LSF (and the first day of Vault). As a DM maintainer I'm open to discussing anything DM related. In particular I'd like to at least have hallway track discussions with key people interested in DM multipath support for blk-mq devices. Keith Busch and I have gone ahead and implemented the bulk of this request-based DM support for blk-mq devices, see: https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/log/?h=dm-for-3.20-blk-mq But Bart says he is seeing inconsistent performance now that the code appears relatively stable. I'll continue analyzing this aspect of things and by the time LSF rolls around I hope the code to be sorted. I'd be interested in having a discussion here, too. hch and me have discussed an alternative approach for multipathing (send the request directly and only clone request if the original submission failed) which I'd like to discuss with a broader audience. And I'd be interested in getting multipath to work with blk-mq, naturally. Another topic we need to come to terms with is the state of XCOPY (whether the initial approach needs further work, etc) -- Mikulas Patocka reworked aspects of Martin's initial approach but it hasn't progressed upstream: https://www.redhat.com/archives/dm-devel/2014-October/msg00167.html Yep. That definitely needs to be discussed. Especially we'd need to discuss how to handle exceptions, seeing that XCOPY might fail basically at any time. And there are some corner-cases (bandwidth starvation on the target) which needs to be discussed, too. Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- 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 3/3] usb: storage: adjust module reference for scsi host
While accessing a unusual usb storage (ums-alauda, ums-cypress, ...), the module reference count is not incremented. Because these drivers allocate scsi hosts with usb_stor_host_template defined in usb-storage module. So these drivers always can be unloaded. This fixes it by adjusting module reference after scsi host allocation. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Cc: Matthew Dharm mdharm-...@one-eyed-alien.net Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Christoph Hellwig h...@lst.de Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-...@vger.kernel.org Cc: usb-stor...@lists.one-eyed-alien.net Cc: linux-scsi@vger.kernel.org --- drivers/usb/storage/alauda.c| 1 + drivers/usb/storage/cypress_atacb.c | 2 ++ drivers/usb/storage/datafab.c | 1 + drivers/usb/storage/ene_ub6250.c| 1 + drivers/usb/storage/freecom.c | 1 + drivers/usb/storage/isd200.c| 1 + drivers/usb/storage/jumpshot.c | 1 + drivers/usb/storage/karma.c | 1 + drivers/usb/storage/onetouch.c | 2 ++ drivers/usb/storage/realtek_cr.c| 2 ++ drivers/usb/storage/sddr09.c| 2 ++ drivers/usb/storage/sddr55.c| 1 + drivers/usb/storage/shuttle_usbat.c | 1 + 13 files changed, 17 insertions(+) diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 62c2d9d..77660d6 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -1242,6 +1242,7 @@ static int alauda_probe(struct usb_interface *intf, us-transport = alauda_transport; us-transport_reset = usb_stor_Bulk_reset; us-max_lun = 1; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); return result; diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index 8514a2d..d603d04 100644 --- a/drivers/usb/storage/cypress_atacb.c +++ b/drivers/usb/storage/cypress_atacb.c @@ -255,6 +255,8 @@ static int cypress_probe(struct usb_interface *intf, if (result) return result; + us_to_host(us)-module = THIS_MODULE; + /* Among CY7C68300 chips, the A revision does not support Cypress ATACB * Filter out this revision from EEPROM default descriptor values */ diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index 7b17c21..4193caf 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c @@ -736,6 +736,7 @@ static int datafab_probe(struct usb_interface *intf, us-transport = datafab_transport; us-transport_reset = usb_stor_Bulk_reset; us-max_lun = 1; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); return result; diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index 56f782b..c4656bd 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -2331,6 +2331,7 @@ static int ene_ub6250_probe(struct usb_interface *intf, us-transport_name = ene_ub6250; us-transport = ene_transport; us-max_lun = 0; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); if (result) diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index ef16068..c66ee7a 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c @@ -538,6 +538,7 @@ static int freecom_probe(struct usb_interface *intf, us-transport = freecom_transport; us-transport_reset = usb_stor_freecom_reset; us-max_lun = 0; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); return result; diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 599d8bf..dcd2a10 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c @@ -1550,6 +1550,7 @@ static int isd200_probe(struct usb_interface *intf, us-protocol_name = ISD200 ATA/ATAPI; us-proto_handler = isd200_ata_command; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); return result; diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 563078b..80e14be 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -662,6 +662,7 @@ static int jumpshot_probe(struct usb_interface *intf, us-transport = jumpshot_transport; us-transport_reset = usb_stor_Bulk_reset; us-max_lun = 1; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); return result; diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c index 94d16ee..ccfae96 100644 --- a/drivers/usb/storage/karma.c +++ b/drivers/usb/storage/karma.c @@ -214,6 +214,7 @@ static int karma_probe(struct usb_interface *intf, us-transport_name = Rio Karma/Bulk; us-transport = rio_karma_transport; us-transport_reset =
[PATCH 0/3] scsi: ufs ums-*: fix module reference counting
While accessing a scsi_device, the use count of the underlying LLDD module is incremented. The module reference is retrieved through .module field of struct scsi_host_template. This mapping between scsi_device and underlying LLDD module works well except some scsi drivers (ufs and unusual usb storage drivers). These drivers consist with core driver and actual LLDDs, and scsi_host_template is defined in the core driver. So the actual LLDDs can be unloaded even if the scsi_device is being accessed. This patch series first adds ability to adjust module reference for scsi host by LLDDs and then fixes ufs and unusual usb storage drivers by adjusting module reference after scsi host allocation. Akinobu Mita (3): scsi: add ability to adjust module reference for scsi host scsi: ufs: adjust module reference for scsi host usb: storage: adjust module reference for scsi host drivers/scsi/hosts.c| 1 + drivers/scsi/scsi.c | 4 ++-- drivers/scsi/ufs/ufshcd-pci.c | 1 + drivers/scsi/ufs/ufshcd-pltfrm.c| 1 + drivers/scsi/ufs/ufshcd.c | 1 - drivers/usb/storage/alauda.c| 1 + drivers/usb/storage/cypress_atacb.c | 2 ++ drivers/usb/storage/datafab.c | 1 + drivers/usb/storage/ene_ub6250.c| 1 + drivers/usb/storage/freecom.c | 1 + drivers/usb/storage/isd200.c| 1 + drivers/usb/storage/jumpshot.c | 1 + drivers/usb/storage/karma.c | 1 + drivers/usb/storage/onetouch.c | 2 ++ drivers/usb/storage/realtek_cr.c| 2 ++ drivers/usb/storage/sddr09.c| 2 ++ drivers/usb/storage/sddr55.c| 1 + drivers/usb/storage/shuttle_usbat.c | 1 + include/scsi/scsi_host.h| 1 + 19 files changed, 23 insertions(+), 3 deletions(-) Cc: Vinayak Holikatti vinholika...@gmail.com Cc: Dolev Raviv dra...@codeaurora.org Cc: Sujit Reddy Thumma sthu...@codeaurora.org Cc: Subhash Jadavani subha...@codeaurora.org Cc: Christoph Hellwig h...@lst.de Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Matthew Dharm mdharm-...@one-eyed-alien.net Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-...@vger.kernel.org Cc: usb-stor...@lists.one-eyed-alien.net Cc: linux-scsi@vger.kernel.org -- 1.9.1 -- 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 1/3] scsi: add ability to adjust module reference for scsi host
While accessing a scsi_device, the use count of the underlying LLDD module is incremented. The module reference is retrieved through .module field of struct scsi_host_template. This mapping between scsi_device and underlying LLDD module works well except some scsi drivers (ufs and unusual usb storage drivers). These drivers consist with core driver and actual LLDDs, and scsi_host_template is defined in the core driver. So the actual LLDDs can be unloaded even if the scsi_device is being accessed. This adds .module field in struct Scsi_Host and let the module reference be retrieved though it instead of struct scsi_host_template. This allows the actual LLDDs adjust module reference. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Cc: Vinayak Holikatti vinholika...@gmail.com Cc: Dolev Raviv dra...@codeaurora.org Cc: Sujit Reddy Thumma sthu...@codeaurora.org Cc: Subhash Jadavani subha...@codeaurora.org Cc: Christoph Hellwig h...@lst.de Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Matthew Dharm mdharm-...@one-eyed-alien.net Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-...@vger.kernel.org Cc: usb-stor...@lists.one-eyed-alien.net Cc: linux-scsi@vger.kernel.org --- drivers/scsi/hosts.c | 1 + drivers/scsi/scsi.c | 4 ++-- include/scsi/scsi_host.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 8bb173e..21f1442 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -411,6 +411,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) */ shost-max_cmd_len = 12; shost-hostt = sht; + shost-module = sht-module; shost-this_id = sht-this_id; shost-can_queue = sht-can_queue; shost-sg_tablesize = sht-sg_tablesize; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index e028854..5905b83 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -988,7 +988,7 @@ int scsi_device_get(struct scsi_device *sdev) return -ENXIO; /* We can fail this if we're doing SCSI operations * from module exit (like cache flush) */ - try_module_get(sdev-host-hostt-module); + try_module_get(sdev-host-module); return 0; } @@ -1005,7 +1005,7 @@ EXPORT_SYMBOL(scsi_device_get); void scsi_device_put(struct scsi_device *sdev) { #ifdef CONFIG_MODULE_UNLOAD - struct module *module = sdev-host-hostt-module; + struct module *module = sdev-host-module; /* The module refcount will be zero if scsi_device_get() * was called from a module removal routine */ diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 019e668..5133f2f 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -617,6 +617,7 @@ struct Scsi_Host { */ unsigned short max_cmd_len; + struct module *module; int this_id; int can_queue; short cmd_per_lun; -- 1.9.1 -- 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/3] scsi: ufs: adjust module reference for scsi host
While accessing a UFS device, the module reference count for core driver (ufshcd) is incremented but not incremented for the actual glue driver (ufshcd-pci or ufshcd-pltfrm). Because these drivers allocate scsi hosts with scsi_host_template defined in ufshcd module. So these drivers always can be unloaded. This fixes it by adjusting module reference after scsi host allocation. Signed-off-by: Akinobu Mita akinobu.m...@gmail.com Cc: Vinayak Holikatti vinholika...@gmail.com Cc: Dolev Raviv dra...@codeaurora.org Cc: Sujit Reddy Thumma sthu...@codeaurora.org Cc: Subhash Jadavani subha...@codeaurora.org Cc: Christoph Hellwig h...@lst.de Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/ufs/ufshcd-pci.c| 1 + drivers/scsi/ufs/ufshcd-pltfrm.c | 1 + drivers/scsi/ufs/ufshcd.c| 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index d15eaa4..9fe21b4 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -142,6 +142,7 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) return err; } + hba-host-module = THIS_MODULE; INIT_LIST_HEAD(hba-clk_list_head); err = ufshcd_init(hba, mmio_base, pdev-irq); diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 95b64e0..ea3ca99 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -322,6 +322,7 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } + hba-host-module = THIS_MODULE; hba-vops = get_variant_ops(pdev-dev); err = ufshcd_parse_clock_info(hba); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2e26025..f0aff90 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4202,7 +4202,6 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie) } static struct scsi_host_template ufshcd_driver_template = { - .module = THIS_MODULE, .name = UFSHCD, .proc_name = UFSHCD, .queuecommand = ufshcd_queuecommand, -- 1.9.1 -- 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 6/8] megaraid_sas : Reserve commands for IOCTLs and internal DCMDs
1)For fusion adapters, limited reserved frames for non SCSI commands to 8(3 for parallel IOCTLs + 5 for driver's internal DCMDs). Earlier reserved commands for non SCSI IO frames was set to 32, so with this implementation, increased per controller can_queue. Behavior of MFI controllers will remain unchanged. 2)Optimized the code related to per controller's 'can_queue' setting. Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com Signed-off-by: Chaitra Basappa chaitra.basa...@avagotech.com --- drivers/scsi/megaraid/megaraid_sas.h|7 ++- drivers/scsi/megaraid/megaraid_sas_base.c | 71 ++- drivers/scsi/megaraid/megaraid_sas_fusion.c |8 ++- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 842e6f7..e2adbf3 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1082,6 +1082,8 @@ enum MR_SCSI_CMD_TYPE { */ #define MEGASAS_INT_CMDS 32 #define MEGASAS_SKINNY_INT_CMDS5 +#define MEGASAS_FUSION_INTERNAL_CMDS 5 +#define MEGASAS_FUSION_IOCTL_CMDS 3 #define MEGASAS_MAX_MSIX_QUEUES128 /* @@ -1687,9 +1689,8 @@ struct megasas_instance { u16 max_num_sge; u16 max_fw_cmds; - /* For Fusion its num IOCTL cmds, for others MFI based its - max_fw_cmds */ u16 max_mfi_cmds; + u16 max_scsi_cmds; u32 max_sectors_per_req; struct megasas_aen_event *ev; @@ -1765,7 +1766,7 @@ struct megasas_instance { u8 requestorId; char PlasmaFW111; char mpio; - int throttlequeuedepth; + u16 throttlequeuedepth; u8 mask_interrupts; u8 is_imr; }; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index fbc1d4c..ac3c04a 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -78,7 +78,7 @@ static int allow_vf_ioctls; module_param(allow_vf_ioctls, int, S_IRUGO); MODULE_PARM_DESC(allow_vf_ioctls, Allow ioctls in SR-IOV VF mode. Default: 0); -static int throttlequeuedepth = MEGASAS_THROTTLE_QUEUE_DEPTH; +static unsigned int throttlequeuedepth = MEGASAS_THROTTLE_QUEUE_DEPTH; module_param(throttlequeuedepth, int, S_IRUGO); MODULE_PARM_DESC(throttlequeuedepth, Adapter queue depth when throttled due to I/O timeout. Default: 16); @@ -1764,6 +1764,7 @@ void megasas_check_and_restore_queue_depth(struct megasas_instance *instance) { unsigned long flags; + if (instance-flag MEGASAS_FW_BUSY time_after(jiffies, instance-last_time + 5 * HZ) atomic_read(instance-fw_outstanding) @@ -1771,13 +1772,8 @@ megasas_check_and_restore_queue_depth(struct megasas_instance *instance) spin_lock_irqsave(instance-host-host_lock, flags); instance-flag = ~MEGASAS_FW_BUSY; - if (instance-is_imr) { - instance-host-can_queue = - instance-max_fw_cmds - MEGASAS_SKINNY_INT_CMDS; - } else - instance-host-can_queue = - instance-max_fw_cmds - MEGASAS_INT_CMDS; + instance-host-can_queue = instance-max_scsi_cmds; spin_unlock_irqrestore(instance-host-host_lock, flags); } } @@ -4685,23 +4681,38 @@ static int megasas_init_fw(struct megasas_instance *instance) if (tmp_sectors (instance-max_sectors_per_req tmp_sectors)) instance-max_sectors_per_req = tmp_sectors; - /* Check for valid throttlequeuedepth module parameter */ - if (instance-is_imr) { - if (throttlequeuedepth (instance-max_fw_cmds - - MEGASAS_SKINNY_INT_CMDS)) - instance-throttlequeuedepth = - MEGASAS_THROTTLE_QUEUE_DEPTH; - else - instance-throttlequeuedepth = throttlequeuedepth; + /* +* 1. For fusion adapters, 3 commands for IOCTL and 5 commands +*for driver's internal DCMDs. +* 2. For MFI skinny adapters, 5 commands for IOCTL + driver's +*internal DCMDs. +* 3. For rest of MFI adapters, 27 commands reserved for IOCTLs +*and 5 commands for drivers's internal DCMD. +*/ + if (instance-ctrl_context) { + instance-max_scsi_cmds = instance-max_fw_cmds - + (MEGASAS_FUSION_INTERNAL_CMDS + + MEGASAS_FUSION_IOCTL_CMDS); + sema_init(instance-ioctl_sem, MEGASAS_FUSION_IOCTL_CMDS); + } else if ((instance-pdev-device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || + (instance-pdev-device ==
[PATCH 1/8] megaraid_sas : Endianness related bug fixes and code optimization
This patch addresses below issues- 1) Few endianness bug fixes. 2) Break the iteration after (MAX_LOGICAL_DRIVES_EXT - 1)), instead of MAX_LOGICAL_DRIVES_EXT. 3) Optimization in MFI INIT frame before firing. 4) MFI IO frame should be 256bytes aligned. Code is optimized to reduce the size of frame for fusion adapters and make the MFI frame size calculation a bit transparent and readable. Cc: sta...@vger.kernel.org Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com Signed-off-by: Chaitra Basappa chaitra.basa...@avagotech.com --- drivers/scsi/megaraid/megaraid_sas_base.c | 24 +++- drivers/scsi/megaraid/megaraid_sas_fp.c | 14 -- drivers/scsi/megaraid/megaraid_sas_fusion.c |7 +++ drivers/scsi/megaraid/megaraid_sas_fusion.h |9 ++--- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index f05580e..38e1f8a 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -3547,7 +3547,6 @@ static int megasas_create_frame_pool(struct megasas_instance *instance) int i; u32 max_cmd; u32 sge_sz; - u32 sgl_sz; u32 total_sz; u32 frame_count; struct megasas_cmd *cmd; @@ -3566,24 +3565,23 @@ static int megasas_create_frame_pool(struct megasas_instance *instance) } /* -* Calculated the number of 64byte frames required for SGL -*/ - sgl_sz = sge_sz * instance-max_num_sge; - frame_count = (sgl_sz + MEGAMFI_FRAME_SIZE - 1) / MEGAMFI_FRAME_SIZE; - frame_count = 15; - - /* -* We need one extra frame for the MFI command +* For MFI controllers. +* max_num_sge = 60 +* max_sge_sz = 16 byte (sizeof megasas_sge_skinny) +* Total 960 byte (15 MFI frame of 64 byte) +* +* Fusion adapter require only 3 extra frame. +* max_num_sge = 16 (defined as MAX_IOCTL_SGE) +* max_sge_sz = 12 byte (sizeof megasas_sge64) +* Total 192 byte (3 MFI frame of 64 byte) */ - frame_count++; - + frame_count = instance-ctrl_context ? (3 + 1) : (15 + 1); total_sz = MEGAMFI_FRAME_SIZE * frame_count; /* * Use DMA pool facility provided by PCI layer */ instance-frame_dma_pool = pci_pool_create(megasas frame pool, - instance-pdev, total_sz, 64, - 0); + instance-pdev, total_sz, 256, 0); if (!instance-frame_dma_pool) { printk(KERN_DEBUG megasas: failed to setup frame pool\n); diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index 460c6a3..7cae1c2 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -172,6 +172,7 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance) struct MR_FW_RAID_MAP_ALL *fw_map_old= NULL; struct MR_FW_RAID_MAP *pFwRaidMap= NULL; int i; + u16 ld_count; struct MR_DRV_RAID_MAP_ALL *drv_map = @@ -191,9 +192,10 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance) fw_map_old = (struct MR_FW_RAID_MAP_ALL *) fusion-ld_map[(instance-map_id 1)]; pFwRaidMap = fw_map_old-raidMap; + ld_count = (u16)le32_to_cpu(pFwRaidMap-ldCount); #if VD_EXT_DEBUG - for (i = 0; i le16_to_cpu(pFwRaidMap-ldCount); i++) { + for (i = 0; i ld_count; i++) { dev_dbg(instance-pdev-dev, (%d) :Index 0x%x Target Id 0x%x Seq Num 0x%x Size 0/%llx\n, instance-unique_id, i, @@ -205,12 +207,12 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance) memset(drv_map, 0, fusion-drv_map_sz); pDrvRaidMap-totalSize = pFwRaidMap-totalSize; - pDrvRaidMap-ldCount = (__le16)pFwRaidMap-ldCount; + pDrvRaidMap-ldCount = (__le16)cpu_to_le16(ld_count); pDrvRaidMap-fpPdIoTimeoutSec = pFwRaidMap-fpPdIoTimeoutSec; for (i = 0; i MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; i++) pDrvRaidMap-ldTgtIdToLd[i] = (u8)pFwRaidMap-ldTgtIdToLd[i]; - for (i = 0; i le16_to_cpu(pDrvRaidMap-ldCount); i++) { + for (i = 0; i ld_count; i++) { pDrvRaidMap-ldSpanMap[i] = pFwRaidMap-ldSpanMap[i]; #if VD_EXT_DEBUG dev_dbg(instance-pdev-dev, @@ -252,7 +254,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance) struct
Re: [PATCH 1/2] ahci_xgene: Fix the xgene_ahci_restart_engine function to support Port Multiplier for APM X-Gene SoC AHCI SATA host controller driver.
Hello. On 1/5/2015 1:21 PM, Suman Tripathi wrote: Your patch summary seems too long. This patch implements the function xgene_ahci_poll_reg_val to poll PxCI for multiple IDENTIFY DEVICE commands to finish before restarting the DMA engine in case of Port Multiplier. Signed-off-by: Suman Tripathi stripa...@apm.com --- drivers/ata/ahci_xgene.c | 56 ++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 0f8538f..2180223 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -105,17 +105,69 @@ static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx) } /** + * xgene_ahci_poll_reg_val- Poll a register on a specific value. + * @ap : ATA port of interest. + * @reg : Register of interest. + * @val : Value to be attained. + * @interval : waiting interval for polling. + * @timeout : timeout for achieving the value. + */ +static int xgene_ahci_poll_reg_val(struct ata_port *ap, + void __iomem *reg, unsigned + int val, unsigned long interval, + unsigned long timeout) +{ + unsigned long deadline; + unsigned int tmp; + + tmp = ioread32(reg); + deadline = ata_deadline(jiffies, timeout); + + while ((tmp != val) (time_before(jiffies, deadline))) { Parens around the operands of are not needed, especially around the right one. + ata_msleep(ap, interval); + tmp = ioread32(reg); + } + + return tmp; +} + +/** * xgene_ahci_restart_engine - Restart the dma engine. * @ap : ATA port of interest * - * Restarts the dma engine inside the controller. + * Waits for completion of multiple commands and restarts + * the DMA engine inside the controller. */ static int xgene_ahci_restart_engine(struct ata_port *ap) { struct ahci_host_priv *hpriv = ap-host-private_data; + struct ahci_port_priv *pp = ap-private_data; + void __iomem *port_mmio = ahci_port_base(ap); + u32 fbs; + + /* +* In case of PMP multiple IDENTIFY DEVICE commands can be +* issued inside PxCI. So need to poll PxCI for the +* completion of outstanding IDENTIFY DEVICE commands before +* we restart the DMA engine. +*/ + if (xgene_ahci_poll_reg_val(ap, port_mmio + + PORT_CMD_ISSUE, 0x0, 1, 100)) + return -EBUSY; ahci_stop_engine(ap); ahci_start_fis_rx(ap); + + /* +* Enable the PxFBS.FBS_EN bit as it +* gets cleared due to stop engine. s/stop/stopping the/. [...] MBR, Sergei -- 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 3/8] megaraid_sas : Fix the problem of non-existing VD exposed to host
This patch will address the issue of SCSI device created at OS level for non existing VD. ldTgtIdtoLd[] array has size 256 for Extended VD firmware and 128 for legacy firmware. Accessing indices beyond array size(OS will send TUR, INQUIRY.. commands upto device index 255), may return valid LD value and that particular SCSI command will be SUCCESS and creating SCSI device for non existing target(VD). For legacy firmware(64 VD firmware), invalidates LD(by setting LD value to 0xff) in LdTgtIdtoLd[] array for device index beyond 127, so that invalid LD(0xff) value should be returned beyond device index beyond 127. Cc: sta...@vger.kernel.org Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com --- drivers/scsi/megaraid/megaraid_sas_fp.c |3 +++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c index 7cae1c2..4f72287 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c @@ -212,6 +212,9 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance) for (i = 0; i MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; i++) pDrvRaidMap-ldTgtIdToLd[i] = (u8)pFwRaidMap-ldTgtIdToLd[i]; + for (i = (MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS); + i MAX_LOGICAL_DRIVES_EXT; i++) + pDrvRaidMap-ldTgtIdToLd[i] = 0xff; for (i = 0; i ld_count; i++) { pDrvRaidMap-ldSpanMap[i] = pFwRaidMap-ldSpanMap[i]; #if VD_EXT_DEBUG diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index bd0e0cb..fe60743 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1725,9 +1725,19 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance, if (scmd-device-channel MEGASAS_MAX_PD_CHANNELS) goto NonFastPath; + /* +* For older firmware, Driver should not access ldTgtIdToLd +* beyond index 127 and for Extended VD firmware, ldTgtIdToLd +* should not go beyond 255. +*/ + + if ((!fusion-fast_path_io) || + (device_id = instance-fw_supported_vd_count)) + goto NonFastPath; + ld = MR_TargetIdToLdGet(device_id, local_map_ptr); - if ((ld = instance-fw_supported_vd_count) || - (!fusion-fast_path_io)) + + if (ld = instance-fw_supported_vd_count) goto NonFastPath; raid = MR_LdRaidGet(ld, local_map_ptr); -- 1.7.3 -- 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 4/8] megaraid_sas : Disable interrupt_mask before enabling hardware interrupts
Update driver mask_interrupts before enable/disable hardware interrupt in order to avoid missing interrupts because of mask_interrupts still set to 1 and hardware interrupts are enabled. Cc: sta...@vger.kernel.org Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com Signed-off-by: Chaitra Basappa chaitra.basa...@avagotech.com --- drivers/scsi/megaraid/megaraid_sas_fusion.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index fe60743..a703c86 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -102,6 +102,8 @@ megasas_enable_intr_fusion(struct megasas_instance *instance) { struct megasas_register_set __iomem *regs; regs = instance-reg_set; + + instance-mask_interrupts = 0; /* For Thunderbolt/Invader also clear intr on enable */ writel(~0, regs-outbound_intr_status); readl(regs-outbound_intr_status); @@ -110,7 +112,6 @@ megasas_enable_intr_fusion(struct megasas_instance *instance) /* Dummy readl to force pci flush */ readl(regs-outbound_intr_mask); - instance-mask_interrupts = 0; } /** -- 1.7.3 -- 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 5/8] megaraid_sas : Complete outstanding IOCTLs before killing adapter
Driver calls megasas_complete_cmd() to call wake_up() for each MFI frame that was issued through the ioctl() interface prior to the kill adapter. This ensures userspace ioctl() system calls issued just before a kill adapter don't get stuck in wait state and IOCTLs are returned to application. Cc: sta...@vger.kernel.org Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com Signed-off-by: Chaitra Basappa chaitra.basa...@avagotech.com --- drivers/scsi/megaraid/megaraid_sas_base.c | 65 ++- drivers/scsi/megaraid/megaraid_sas_fusion.c |4 -- 2 files changed, 54 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index ef56e37..fbc1d4c 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1692,22 +1692,66 @@ static int megasas_slave_alloc(struct scsi_device *sdev) return 0; } +/* +* megasas_complete_outstanding_ioctls - Complete outstanding ioctls after a +* kill adapter +* @instance: Adapter soft state +* +*/ +void megasas_complete_outstanding_ioctls(struct megasas_instance *instance) +{ + int i; + struct megasas_cmd *cmd_mfi; + struct megasas_cmd_fusion *cmd_fusion; + struct fusion_context *fusion = instance-ctrl_context; + + /* Find all outstanding ioctls */ + if (fusion) { + for (i = 0; i instance-max_fw_cmds; i++) { + cmd_fusion = fusion-cmd_list[i]; + if (cmd_fusion-sync_cmd_idx != (u32)ULONG_MAX) { + cmd_mfi = instance-cmd_list[cmd_fusion-sync_cmd_idx]; + if (cmd_mfi-sync_cmd + cmd_mfi-frame-hdr.cmd != MFI_CMD_ABORT) + megasas_complete_cmd(instance, +cmd_mfi, DID_OK); + } + } + } else { + for (i = 0; i instance-max_fw_cmds; i++) { + cmd_mfi = instance-cmd_list[i]; + if (cmd_mfi-sync_cmd cmd_mfi-frame-hdr.cmd != + MFI_CMD_ABORT) + megasas_complete_cmd(instance, cmd_mfi, DID_OK); + } + } +} + + void megaraid_sas_kill_hba(struct megasas_instance *instance) { + /* Set critical error to block I/O ioctls in case caller didn't */ + instance-adprecovery = MEGASAS_HW_CRITICAL_ERROR; + /* Wait 1 second to ensure IO or ioctls in build have posted */ + msleep(1000); if ((instance-pdev-device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || - (instance-pdev-device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || - (instance-pdev-device == PCI_DEVICE_ID_LSI_FUSION) || - (instance-pdev-device == PCI_DEVICE_ID_LSI_PLASMA) || - (instance-pdev-device == PCI_DEVICE_ID_LSI_INVADER) || - (instance-pdev-device == PCI_DEVICE_ID_LSI_FURY)) { - writel(MFI_STOP_ADP, instance-reg_set-doorbell); + (instance-pdev-device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || + (instance-pdev-device == PCI_DEVICE_ID_LSI_FUSION) || + (instance-pdev-device == PCI_DEVICE_ID_LSI_PLASMA) || + (instance-pdev-device == PCI_DEVICE_ID_LSI_INVADER) || + (instance-pdev-device == PCI_DEVICE_ID_LSI_FURY)) { + writel(MFI_STOP_ADP, + instance-reg_set-doorbell); /* Flush */ readl(instance-reg_set-doorbell); if (instance-mpio instance-requestorId) memset(instance-ld_ids, 0xff, MEGASAS_MAX_LD_IDS); } else { - writel(MFI_STOP_ADP, instance-reg_set-inbound_doorbell); + writel(MFI_STOP_ADP, + instance-reg_set-inbound_doorbell); } + /* Complete outstanding ioctls when adapter is killed */ + megasas_complete_outstanding_ioctls(instance); } /** @@ -3031,10 +3075,9 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance) was tried multiple times during reset. Shutting down the HBA\n, cmd, cmd-scmd, cmd-sync_cmd); + instance-instancet-disable_intr(instance); + atomic_set(instance-fw_reset_no_pci_access, 1); megaraid_sas_kill_hba(instance); - - instance-adprecovery = - MEGASAS_HW_CRITICAL_ERROR; return; } } @@ -3168,8 +3211,8 @@ process_fw_state_change_wq(struct
[PATCH 2/8] megaraid_sas : Support for secure JBOD
This patch will add support for Secure Encrypting Drives(SED) in JBOD mode. below are the key points- 1) If Firmware supports SED JBOD, all non Read Write commands to JBODs will be sent via Firmware path and Read write commands to JBOD will be sent via fastpath. 2) If firmware does not support SED JBOD, driver will fall back to old design .i.e send all JBOD IOs via fastpath. Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com Signed-off-by: Chaitra Basappa chaitra.basa...@avagotech.com --- drivers/scsi/megaraid/megaraid_sas.h| 57 +--- drivers/scsi/megaraid/megaraid_sas_base.c | 28 +++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 73 +++ 3 files changed, 107 insertions(+), 51 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 0d44d91..842e6f7 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -969,7 +969,20 @@ struct megasas_ctrl_info { struct { #if defined(__BIG_ENDIAN_BITFIELD) - u32 reserved:25; + u32 reserved:12; + u32 discardCacheDuringLDDelete:1; + u32 supportSecurityonJBOD:1; + u32 supportCacheBypassModes:1; + u32 supportDisableSESMonitoring:1; + u32 supportForceFlash:1; + u32 supportNVDRAM:1; + u32 supportDrvActivityLEDSetting:1; + u32 supportAllowedOpsforDrvRemoval:1; + u32 supportHOQRebuild:1; + u32 supportForceTo512e:1; + u32 supportNVCacheErase:1; + u32 supportDebugQueue:1; + u32 supportSwZone:1; u32 supportCrashDump:1; u32 supportMaxExtLDs:1; u32 supportT10RebuildAssist:1; @@ -981,9 +994,22 @@ struct megasas_ctrl_info { u32 supportThermalPollInterval:1; u32 supportDisableImmediateIO:1; u32 supportT10RebuildAssist:1; - u32 supportMaxExtLDs:1; - u32 supportCrashDump:1; - u32 reserved:25; + u32 supportMaxExtLDs:1; + u32 supportCrashDump:1; + u32 supportSwZone:1; + u32 supportDebugQueue:1; + u32 supportNVCacheErase:1; + u32 supportForceTo512e:1; + u32 supportHOQRebuild:1; + u32 supportAllowedOpsforDrvRemoval:1; + u32 supportDrvActivityLEDSetting:1; + u32 supportNVDRAM:1; + u32 supportForceFlash:1; + u32 supportDisableSESMonitoring:1; + u32 supportCacheBypassModes:1; + u32 supportSecurityonJBOD:1; + u32 discardCacheDuringLDDelete:1; + u32 reserved:12; #endif } adapterOperations3; @@ -1022,6 +1048,13 @@ enum MR_MFI_MPT_PTHR_FLAGS { MFI_MPT_ATTACHED = 2, }; +enum MR_SCSI_CMD_TYPE { + READ_WRITE_LDIO = 0, + NON_READ_WRITE_LDIO = 1, + READ_WRITE_SYSPDIO = 2, + NON_READ_WRITE_SYSPDIO = 3, +}; + /* Frame Type */ #define IO_FRAME 0 #define PTHRU_FRAME1 @@ -1194,19 +1227,23 @@ union megasas_sgl_frame { typedef union _MFI_CAPABILITIES { struct { #if defined(__BIG_ENDIAN_BITFIELD) - u32 reserved:27; + u32 reserved:25; + u32 security_protocol_cmds_fw:1; + u32 support_core_affinity:1; u32 support_ndrive_r1_lb:1; u32 support_max_255lds:1; - u32 reserved1:1; + u32 support_fastpath_wb:1; u32 support_additional_msix:1; u32 support_fp_remote_lun:1; #else u32 support_fp_remote_lun:1; u32 support_additional_msix:1; - u32 reserved1:1; + u32 support_fastpath_wb:1; u32 support_max_255lds:1; u32 support_ndrive_r1_lb:1; - u32 reserved:27; + u32 support_core_affinity:1; + u32 security_protocol_cmds_fw:1; + u32 reserved:25; #endif } mfi_capabilities; u32 reg; @@ -1638,13 +1675,14 @@ struct megasas_instance { u32 crash_dump_fw_support; u32 crash_dump_drv_support; u32 crash_dump_app_support; + u32 secure_jbod_support; spinlock_t crashdump_lock; struct megasas_register_set __iomem *reg_set; u32 *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; struct megasas_pd_list
[PATCH 8/8] megaraid_sas : Driver version update
Update megaraid_sas driver version. Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com --- drivers/scsi/megaraid/megaraid_sas.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 11c4923..558c6e8 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -35,7 +35,7 @@ /* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION06.805.06.01-rc1 +#define MEGASAS_VERSION06.806.08.00-rc1 /* * Device IDs -- 1.7.3 -- 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 V6 0/3] scsi: Configure number of LUs reported by 'report-luns'
On Tue, 2014-12-16 at 11:01 -0500, Rob Evers wrote: This patch set retrieves the number of LUs available on a target using the report-luns command by re-sizing the returned data buffer and retrying report luns. A minor bug fix is included. scsi_mod parameter max_report_luns is no longer used and is removed. Changes from previous posting: - remove exteraneous else - remove INITIAL_MAX_REPORT_LUNS, hardwire buffer sizing, and touch up related comment Rob Evers (3): scsi: Avoid unnecessary GFP_ATOMIC allocation in scsi_report_lun_scan scsi: Use set/get_unaligned_be32 in report_luns scsi: retry report-luns when reported LU count requres more memory drivers/scsi/scsi_scan.c | 54 ++-- 1 file changed, 15 insertions(+), 39 deletions(-) Looks good. Reviewed-by: Ewan D. Milne emi...@redhat.com -- 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 0/8] megaraid_sas : Description Patch
megaraid_sas driver changes. Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com --- [PATCH 0/8] megaraid_sas : Description Patch. [PATCH 1/8] megaraid_sas : Endianness related bug fixes and code optimization. [PATCH 2/8] megaraid_sas : Support for secure JBOD. [PATCH 3/8] megaraid_sas : Fix the problem of non-existing VD exposed to host. [PATCH 4/8] megaraid_sas : Disable interrupt_mask before enabling hardware interrupts. [PATCH 5/8] megaraid_sas : Complete outstanding IOCTLs before killing adapter [PATCH 6/8] megaraid_sas : Reserve commands for IOCTLs and internal DCMDs. [PATCH 7/8] megaraid_sas : Remove redundant code of memset load_balance_info to zero. [PATCH 8/8] megaraid_sas : Driver version update. -- 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: [PATCHv3 00/10] scsi logging update: the real thing
Can you send an updated version against the scsi-for-3.20 tree so that we can get this series in early for the 3.20 cycle? -- 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] Fix regression in 3.18 caused by e05fe29248 qla2xxx: Honor FCP_RSP retry delay timer field.
On Tue, 23 Dec 2014, Christoph Hellwig wrote: Chad, Saurav, does this look ok to you? Yes, this looks ok. -- 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: block: remove artifical max_hw_sectors cap
On Tue, Dec 30, 2014 at 03:15:26PM +0100, Stefan Priebe - Profihost AG wrote: What is the max_sectors_kb value for them? # cat /sys/block/sdi/queue/max_sectors_kb 16383 That's odd, it's half of what ATA disks should support. Is this device attached to the HBA or an expander? -- 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: Issues with commit 34b48db6 (block: remove artifical max_hw_sectors cap)
On Tue, Dec 30, 2014 at 11:19:07AM -0500, Douglas Gilbert wrote: In SCSI, the VPD page 0xb0 (Block limits) has a Maximum transfer length field (32 bits long). Its units are logical blocks. Useful if 0 as 0 means unreported. USB to SATA bridges should comply with SAT. However SAT and SAT-2 don't even mention that VPD page. SAT-3 and SAT-4 mention that page but have unspecified next to that field. Basically useless. Maybe we need to cap the max sectors value to something fairly low unless we have the block limits VPD page and it contains useful information. -- 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: Issues with commit 34b48db6 (block: remove artifical max_hw_sectors cap)
On Tue, Dec 30, 2014 at 08:36:34AM -0800, Kenneth R. Crudup wrote: OP here. FWIW, this is what I get when running that command on the SCSI generic device that corresponds to the USB-3 (non-UAS) disk[1] that had the issue: So it looks like this one actually provides sane values, but we don't we never even look at EVPD pages for usb devices due to the wrong SCSI level? -- 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 net-next 0/5] RDMA/cxgb4/cxgb4vf/csiostor: Cleanup register defines
From: Hariprasad Shenai haripra...@chelsio.com Date: Mon, 5 Jan 2015 16:30:42 +0530 This series continues to cleanup all the macros/register defines related to SGE, PCIE, MC, MA, TCAM, MAC, etc that are defined in t4_regs.h and the affected files. Will post another 1 or 2 series so that we can cover all the macros so that they all follow the same style to be consistent. The patches series is created against 'net-next' tree. And includes patches on cxgb4, cxgb4vf, iw_cxgb4 and csiostor driver. We have included all the maintainers of respective drivers. Kindly review the change and let us know in case of any review comments. Series applied, thanks. -- 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] virtio-scsi: Fix the race condition in virtscsi_handle_event
On Mon, Jan 05, 2015 at 11:48:47AM -0800, Venkatesh Srinivas wrote: On Sun, Jan 4, 2015 at 10:04 PM, Fam Zheng f...@redhat.com wrote: There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in virtscsi_handle_transport_reset may trigger the BUG_ON in scsi_target_reap, because the state is altered behind it, probably by scsi_scan_host of another event. I'm able to reproduce it by repeatedly plugging and unplugging a scsi disk with the same lun number. To make is safe, the mutex added in struct virtio_scsi is held in virtscsi_handle_event, so that all the events are processed in a synchronized way. With this lock, the panic goes away. Signed-off-by: Fam Zheng f...@redhat.com --- drivers/scsi/virtio_scsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c52bb5d..7f194d4 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -110,6 +110,9 @@ struct virtio_scsi { /* CPU hotplug notifier */ struct notifier_block nb; + /* Protect the hotplug/unplug event handling */ + struct mutex scan_lock; + /* Protected by event_vq lock */ bool stop_events; @@ -377,6 +380,7 @@ static void virtscsi_handle_event(struct work_struct *work) struct virtio_scsi *vscsi = event_node-vscsi; struct virtio_scsi_event *event = event_node-event; + mutex_lock(vscsi-scan_lock); if (event-event cpu_to_virtio32(vscsi-vdev, VIRTIO_SCSI_T_EVENTS_MISSED)) { event-event = ~cpu_to_virtio32(vscsi-vdev, @@ -397,6 +401,7 @@ static void virtscsi_handle_event(struct work_struct *work) pr_err(Unsupport virtio scsi event %x\n, event-event); } virtscsi_kick_event(vscsi, event_node); + mutex_unlock(vscsi-scan_lock); } static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) @@ -894,6 +899,7 @@ static int virtscsi_init(struct virtio_device *vdev, const char **names; struct virtqueue **vqs; + mutex_init(vscsi-scan_lock); num_vqs = vscsi-num_queues + VIRTIO_SCSI_VQ_BASE; vqs = kmalloc(num_vqs * sizeof(struct virtqueue *), GFP_KERNEL); callbacks = kmalloc(num_vqs * sizeof(vq_callback_t *), GFP_KERNEL); -- 1.9.3 Nice find. This fix does have the effect of serializing all event handling via scan_lock; perhaps you want to instead create a singlethreaded workqueue in virtio_scsi and queue handle_event there, rather than waiting on scan_lock on the system workqueue? Or use the system single-threaded wq. Reviewed-by: Venkatesh Srinivas venkate...@google.com -- vs; -- 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 3/3] usb: storage: adjust module reference for scsi host
2015-01-06 0:27 GMT+09:00 Alan Stern st...@rowland.harvard.edu: On Mon, 5 Jan 2015, Akinobu Mita wrote: While accessing a unusual usb storage (ums-alauda, ums-cypress, ...), the module reference count is not incremented. Because these drivers allocate scsi hosts with usb_stor_host_template defined in usb-storage module. So these drivers always can be unloaded. This fixes it by adjusting module reference after scsi host allocation. diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 62c2d9d..77660d6 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -1242,6 +1242,7 @@ static int alauda_probe(struct usb_interface *intf, us-transport = alauda_transport; us-transport_reset = usb_stor_Bulk_reset; us-max_lun = 1; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); return result; ... etc. An easier and more foolproof approach would be to change usb_store_probe2 to take an extra argument for the owner: int _usb_stor_probe2(struct us_data *us, struct module *owner) ... us_to_host(us)-module = owner; ... Then in usb.h: extern int _usb_stor_probe2(struct us_data *us, struct module *owner); #define usb_stor_probe2(us) _usb_stor_probe2(us, THIS_MODULE) This pattern is already used in several other places in the kernel. Sounds good. I'll take this idea and update this patch. -- 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] virtio-scsi: Fix the race condition in virtscsi_handle_event
On Tue, 01/06 00:10, Michael S. Tsirkin wrote: On Mon, Jan 05, 2015 at 11:48:47AM -0800, Venkatesh Srinivas wrote: On Sun, Jan 4, 2015 at 10:04 PM, Fam Zheng f...@redhat.com wrote: There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in virtscsi_handle_transport_reset may trigger the BUG_ON in scsi_target_reap, because the state is altered behind it, probably by scsi_scan_host of another event. I'm able to reproduce it by repeatedly plugging and unplugging a scsi disk with the same lun number. To make is safe, the mutex added in struct virtio_scsi is held in virtscsi_handle_event, so that all the events are processed in a synchronized way. With this lock, the panic goes away. Signed-off-by: Fam Zheng f...@redhat.com --- drivers/scsi/virtio_scsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c52bb5d..7f194d4 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -110,6 +110,9 @@ struct virtio_scsi { /* CPU hotplug notifier */ struct notifier_block nb; + /* Protect the hotplug/unplug event handling */ + struct mutex scan_lock; + /* Protected by event_vq lock */ bool stop_events; @@ -377,6 +380,7 @@ static void virtscsi_handle_event(struct work_struct *work) struct virtio_scsi *vscsi = event_node-vscsi; struct virtio_scsi_event *event = event_node-event; + mutex_lock(vscsi-scan_lock); if (event-event cpu_to_virtio32(vscsi-vdev, VIRTIO_SCSI_T_EVENTS_MISSED)) { event-event = ~cpu_to_virtio32(vscsi-vdev, @@ -397,6 +401,7 @@ static void virtscsi_handle_event(struct work_struct *work) pr_err(Unsupport virtio scsi event %x\n, event-event); } virtscsi_kick_event(vscsi, event_node); + mutex_unlock(vscsi-scan_lock); } static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) @@ -894,6 +899,7 @@ static int virtscsi_init(struct virtio_device *vdev, const char **names; struct virtqueue **vqs; + mutex_init(vscsi-scan_lock); num_vqs = vscsi-num_queues + VIRTIO_SCSI_VQ_BASE; vqs = kmalloc(num_vqs * sizeof(struct virtqueue *), GFP_KERNEL); callbacks = kmalloc(num_vqs * sizeof(vq_callback_t *), GFP_KERNEL); -- 1.9.3 Nice find. This fix does have the effect of serializing all event handling via scan_lock; perhaps you want to instead create a singlethreaded workqueue in virtio_scsi and queue handle_event there, rather than waiting on scan_lock on the system workqueue? Or use the system single-threaded wq. Good idea, I'll change to that. Thanks, Fam Reviewed-by: Venkatesh Srinivas venkate...@google.com -- vs; -- 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: Issues with commit 34b48db6 (block: remove artifical max_hw_sectors cap)
On Mon, 5 Jan 2015, Christoph Hellwig wrote: On Tue, Dec 30, 2014 at 08:36:34AM -0800, Kenneth R. Crudup wrote: OP here. FWIW, this is what I get when running that command on the SCSI generic device that corresponds to the USB-3 (non-UAS) disk[1] that had the issue: So it looks like this one actually provides sane values, but we don't we never even look at EVPD pages for usb devices due to the wrong SCSI level? According to James Bottomley, it doesn't matter much what the EVPD pages say. The limitation is imposed by the USB _bridge_, whereas the EVPD data indicates what the _drive_ is capable of. So we can't rely on that data anyway. (Although if the EVPD data indicates a limit smaller than the bridge can handle, then we'd need to pay attention to it.) The patch I posted sets a general limit of 32 MB for USB drives that don't have a quirk flag for a smaller limit. Kenneth, have you tried that patch? Does it fix your problem? Alan Stern -- 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: Issues with commit 34b48db6 (block: remove artifical max_hw_sectors cap)
I will later tonight. For now, I'm using 3.18.x (for another reason), which doesn't have this commit. My Linus-latest tree has a fix that imposed a hard limit of 32767, which worked for me then. On January 5, 2015 12:07:56 PM PST, Alan Stern st...@rowland.harvard.edu wrote: On Mon, 5 Jan 2015, Christoph Hellwig wrote: On Tue, Dec 30, 2014 at 08:36:34AM -0800, Kenneth R. Crudup wrote: OP here. FWIW, this is what I get when running that command on the SCSI generic device that corresponds to the USB-3 (non-UAS) disk[1] that had the issue: So it looks like this one actually provides sane values, but we don't we never even look at EVPD pages for usb devices due to the wrong SCSI level? According to James Bottomley, it doesn't matter much what the EVPD pages say. The limitation is imposed by the USB _bridge_, whereas the EVPD data indicates what the _drive_ is capable of. So we can't rely on that data anyway. (Although if the EVPD data indicates a limit smaller than the bridge can handle, then we'd need to pay attention to it.) The patch I posted sets a general limit of 32 MB for USB drives that don't have a quirk flag for a smaller limit. Kenneth, have you tried that patch? Does it fix your problem? Alan Stern -- Sent from my 2014 Galaxy Note 10.1 -- 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: block: remove artifical max_hw_sectors cap
Am 05.01.2015 um 18:17 schrieb Christoph Hellwig: On Tue, Dec 30, 2014 at 03:15:26PM +0100, Stefan Priebe - Profihost AG wrote: What is the max_sectors_kb value for them? # cat /sys/block/sdi/queue/max_sectors_kb 16383 That's odd, it's half of what ATA disks should support. Is this device attached to the HBA or an expander? No the Board has: 10x SATA3 (6Gbps) via C612 from Intel. Stefan -- 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
Backport of a fix for HPSA (Disabling a disabled device problem during kdump) driver
Dear stable maintainers, Can you please backport commitid 132aa220b45d60e9b20def1e9d8be9422eed9616 (hpsa: refine the pci enable/disable handling) to 3.10 stable (and earlier, if applicable)? I've tried the 3.10, and it applies cleanly there. Not sure about earlier versions. Many Thanks, Masoud Sharbiani Twitter Inc. -- 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] Allow EA reservation holders to read from device.
From: Lee Duncan ldun...@suse.com For PGR reservation type Exclusive Access, allow all registrants to read from the device. Signed-off-by: Lee Duncan ldun...@suse.com Cc: Nicholas Bellinger n...@linux-iscsi.org --- drivers/target/target_core_pr.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 85564998500a..cb762b174c08 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -551,6 +551,18 @@ static int core_scsi3_pr_seq_non_holder( return 0; } + } else if (we registered_nexus) { + /* +* Reads are allowed for Write Exclusive locks +* from all registrants. +*/ + if (cmd-data_direction == DMA_FROM_DEVICE) { + pr_debug(Allowing READ CDB: 0x%02x for %s +reservation\n, cdb[0], + core_scsi3_pr_dump_type(pr_reg_type)); + + return 0; + } } pr_debug(%s Conflict for %sregistered nexus %s CDB: 0x%2x for %s reservation\n, transport_dump_cmd_direction(cmd), -- 1.8.5.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: scsi: non atomic allocation in mempool_alloc in atomic context
On 01/05/2015 02:15 AM, Christoph Hellwig wrote: On Wed, Dec 31, 2014 at 01:14:19PM -0500, Sasha Levin wrote: Hi Christoph, I'm seeing an issue which was bisected down to 3c356bde1 (scsi: stop passing a gfp_mask argument down the command setup path): -queue_rq in blk-mq context is designed to be able to sleep and be called from process context without any spinlocks held or irqs disabled, so we really should fix the caller instead. That's not quite true, the only guarantee is that it WILL execute on the CPU (or CPUs) that are set in the mask. So unless it ends up offloading the run to a specific workqueue, we'll disable preempt in the current path before -queue_rq() is called. -- 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
Re: [PATCH] scsi: fix scsi_error.c kernel-doc warning
Thanks, applied to scsi-for-3.20. -- 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] Fix regression in 3.18 caused by e05fe29248 qla2xxx: Honor FCP_RSP retry delay timer field.
Thanks, applied to scsi-for-3.19. -- 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 V6 0/3] scsi: Configure number of LUs reported by 'report-luns'
Thanks, applied to scsi-for-3.20. -- 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 0/4] Drivers: scsi: storvsc: Fix miscellaneous issues
Thanks, applied to scsi-for-3.20. -- 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 0/5] Feature enhancements for ses module
Thanks, applied to scsi-for-3.20. -- 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] lpfc: correct device removal deadlock after link bounce
Thanks, applied to scsi-for-3.20. -- 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][RESEND] esp_scsi: remove check for ESP_MAX_TAGS
Thanks, applied to scsi-for-3.20. -- 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: scsi: non atomic allocation in mempool_alloc in atomic context
On Mon, Jan 05, 2015 at 12:00:58PM -0700, Jens Axboe wrote: That's not quite true, the only guarantee is that it WILL execute on the CPU (or CPUs) that are set in the mask. So unless it ends up offloading the run to a specific workqueue, we'll disable preempt in the current path before -queue_rq() is called. Oops. Indeed, with those recent changes -queue_rq can't safely block for memory allocatios anymore. The patch below should fix it: --- From: Christoph Hellwig h...@lst.de Subject: scsi: -queue_rq can't sleep Since Linux 3.19 blk-mq may disable preemption before calling into -queue_rq, so we can't actually sleep anymore. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9ea95dd..6d5c0b8 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -591,7 +591,6 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq) static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) { struct scatterlist *first_chunk = NULL; - gfp_t gfp_mask = mq ? GFP_NOIO : GFP_ATOMIC; int ret; BUG_ON(!nents); @@ -606,7 +605,7 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) } ret = __sg_alloc_table(sdb-table, nents, SCSI_MAX_SG_SEGMENTS, - first_chunk, gfp_mask, scsi_sg_alloc); + first_chunk, GFP_ATOMIC, scsi_sg_alloc); if (unlikely(ret)) scsi_free_sgtable(sdb, mq); return ret; -- 1.9.1 -- 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] ses: clear warning for unused variable
Remove the declaration of variable err in function 'enclosure_component_alloc': All warnings: drivers/misc/enclosure.c: In function 'enclosure_component_alloc': drivers/misc/enclosure.c:295:6: warning: unused variable 'err' [-Wunused-variable] int err, i; ^ Signed-off-by: Song Liu songliubrav...@fb.com Acked-by: Dan Williams dan.j.willi...@intel.com Reported-by: kbuild test robot fengguang...@intel.com --- drivers/misc/enclosure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 3289d4d..38552a3 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -295,7 +295,7 @@ enclosure_component_alloc(struct enclosure_device *edev, { struct enclosure_component *ecomp; struct device *cdev; - int err, i; + int i; char newname[COMPONENT_NAME_SIZE]; if (number = edev-components) -- 1.8.1 -- 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: scsi: non atomic allocation in mempool_alloc in atomic context
On 01/05/2015 12:32 PM, Christoph Hellwig wrote: On Mon, Jan 05, 2015 at 12:00:58PM -0700, Jens Axboe wrote: That's not quite true, the only guarantee is that it WILL execute on the CPU (or CPUs) that are set in the mask. So unless it ends up offloading the run to a specific workqueue, we'll disable preempt in the current path before -queue_rq() is called. Oops. Indeed, with those recent changes -queue_rq can't safely block for memory allocatios anymore. The patch below should fix it: --- From: Christoph Hellwig h...@lst.de Subject: scsi: -queue_rq can't sleep Since Linux 3.19 blk-mq may disable preemption before calling into -queue_rq, so we can't actually sleep anymore. That was true in earlier kernels as well, going back a few versions at least, preempt was disabled on calling __blk_mq_run_hw_queue(). Just checked, and 3.16 and later have that as the behaviour. The only change in 3.19 some shuffling around to avoid double preempt_disable in some cases, it's now using get_cpu() and friends. So we probably want do mark that as stable so we reach back to when scsi-mq was added, unless the originally referenced patch getting rid of the gfp_t mask didn't have the issue. -- 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
Re: scsi: non atomic allocation in mempool_alloc in atomic context
On Mon, Jan 05, 2015 at 12:38:04PM -0700, Jens Axboe wrote: That was true in earlier kernels as well, going back a few versions at least, preempt was disabled on calling __blk_mq_run_hw_queue(). Just checked, and 3.16 and later have that as the behaviour. The only change in 3.19 some shuffling around to avoid double preempt_disable in some cases, it's now using get_cpu() and friends. So we probably want do mark that as stable so we reach back to when scsi-mq was added, unless the originally referenced patch getting rid of the gfp_t mask didn't have the issue. Before that commit we always passed down GFP_ATOMIC, so we'll only need the patch for 3.19. -- 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] virtio-scsi: Fix the race condition in virtscsi_handle_event
On Sun, Jan 4, 2015 at 10:04 PM, Fam Zheng f...@redhat.com wrote: There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in virtscsi_handle_transport_reset may trigger the BUG_ON in scsi_target_reap, because the state is altered behind it, probably by scsi_scan_host of another event. I'm able to reproduce it by repeatedly plugging and unplugging a scsi disk with the same lun number. To make is safe, the mutex added in struct virtio_scsi is held in virtscsi_handle_event, so that all the events are processed in a synchronized way. With this lock, the panic goes away. Signed-off-by: Fam Zheng f...@redhat.com --- drivers/scsi/virtio_scsi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c52bb5d..7f194d4 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -110,6 +110,9 @@ struct virtio_scsi { /* CPU hotplug notifier */ struct notifier_block nb; + /* Protect the hotplug/unplug event handling */ + struct mutex scan_lock; + /* Protected by event_vq lock */ bool stop_events; @@ -377,6 +380,7 @@ static void virtscsi_handle_event(struct work_struct *work) struct virtio_scsi *vscsi = event_node-vscsi; struct virtio_scsi_event *event = event_node-event; + mutex_lock(vscsi-scan_lock); if (event-event cpu_to_virtio32(vscsi-vdev, VIRTIO_SCSI_T_EVENTS_MISSED)) { event-event = ~cpu_to_virtio32(vscsi-vdev, @@ -397,6 +401,7 @@ static void virtscsi_handle_event(struct work_struct *work) pr_err(Unsupport virtio scsi event %x\n, event-event); } virtscsi_kick_event(vscsi, event_node); + mutex_unlock(vscsi-scan_lock); } static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) @@ -894,6 +899,7 @@ static int virtscsi_init(struct virtio_device *vdev, const char **names; struct virtqueue **vqs; + mutex_init(vscsi-scan_lock); num_vqs = vscsi-num_queues + VIRTIO_SCSI_VQ_BASE; vqs = kmalloc(num_vqs * sizeof(struct virtqueue *), GFP_KERNEL); callbacks = kmalloc(num_vqs * sizeof(vq_callback_t *), GFP_KERNEL); -- 1.9.3 Nice find. This fix does have the effect of serializing all event handling via scan_lock; perhaps you want to instead create a singlethreaded workqueue in virtio_scsi and queue handle_event there, rather than waiting on scan_lock on the system workqueue? Reviewed-by: Venkatesh Srinivas venkate...@google.com -- vs; -- 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: scsi: non atomic allocation in mempool_alloc in atomic context
On 01/05/2015 04:15 AM, Christoph Hellwig wrote: On Wed, Dec 31, 2014 at 01:14:19PM -0500, Sasha Levin wrote: Hi Christoph, I'm seeing an issue which was bisected down to 3c356bde1 (scsi: stop passing a gfp_mask argument down the command setup path): -queue_rq in blk-mq context is designed to be able to sleep and be called from process context without any spinlocks held or irqs disabled, so we really should fix the caller instead. That being said your trace seems odd to me: [ 3395.328221] BUG: sleeping function called from invalid context at mm/mempool.c:206 [ 3395.329540] in_atomic(): 1, irqs_disabled(): 0, pid: 6399, name: trinity-c531 [ 3395.331104] no locks held by trinity-c531/6399. [ 3395.331849] Preemption disabled blk_execute_rq_nowait (block/blk-exec.c:95) blk_execute_rq_nowait only takes a lock for the non-blk-mq case. In my current kernel that's in line 79, but can you verify that for you line 95 is the spin_lock_irq in the !q-mq_ops case? That's line 79 for me as well. I'm not sure why addr2line said it's line 95 here. [ 3395.348571] __might_sleep (kernel/sched/core.c:7308) [ 3395.351944] mempool_alloc (mm/mempool.c:206 (discriminator 1)) [ 3395.355196] scsi_sg_alloc (drivers/scsi/scsi_lib.c:582) [ 3395.356893] __sg_alloc_table (lib/scatterlist.c:282) [ 3395.358844] ? sdev_disable_disk_events (drivers/scsi/scsi_lib.c:577) [ 3395.360873] scsi_alloc_sgtable (drivers/scsi/scsi_lib.c:608) [ 3395.362769] scsi_init_sgtable (drivers/scsi/scsi_lib.c:1087) [ 3395.364583] ? lockdep_init_map (kernel/locking/lockdep.c:2986) [ 3395.366354] scsi_init_io (drivers/scsi/scsi_lib.c:1122) [ 3395.368092] ? do_init_timer (kernel/time/timer.c:669) [ 3395.369837] scsi_setup_cmnd (drivers/scsi/scsi_lib.c:1220 drivers/scsi/scsi_lib.c:1268) [ 3395.371743] scsi_queue_rq (drivers/scsi/scsi_lib.c:1875 drivers/scsi/scsi_lib.c:1980) [ 3395.373471] __blk_mq_run_hw_queue (block/blk-mq.c:751) [ 3395.375481] blk_mq_run_hw_queue (block/blk-mq.c:831) [ 3395.377324] blk_mq_insert_request (block/blk-mq.h:92 block/blk-mq.c:974) [ 3395.379377] ? blk_rq_map_user (block/blk-map.c:78 block/blk-map.c:142) [ 3395.381307] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2559 kernel/locking/lockdep.c:2601) [ 3395.383485] blk_execute_rq_nowait (block/blk-exec.c:95) But this clearly is the blk-mq case. How does your version of blk_execute_rq_nowait look like? It's whatever -next had. I've looked at objdump and it looks like the compiler made something interesting with it that might explain the odd line numbering for the preemption off thing: /home/sasha/linux-next/block/blk-exec.c:69 blk_mq_insert_request(rq, at_head, true, false); b9: 31 f6 xor%esi,%esi bb: 45 85 fftest %r15d,%r15d be: 48 89 dfmov%rbx,%rdi c1: 40 0f 95 c6 setne %sil c5: ba 01 00 00 00 mov$0x1,%edx ca: 31 c9 xor%ecx,%ecx cc: e8 00 00 00 00 callq d1 blk_execute_rq_nowait+0xd1 cd: R_X86_64_PC32 blk_mq_insert_request-0x4 /home/sasha/linux-next/block/blk-exec.c:95 __blk_run_queue(q); /* the queue is stopped so it won't be run */ if (is_pm_resume) __blk_run_queue_uncond(q); spin_unlock_irq(q-queue_lock); } d1: 48 83 c4 18 add$0x18,%rsp d5: 5b pop%rbx d6: 41 5c pop%r12 d8: 41 5d pop%r13 da: 41 5e pop%r14 dc: 41 5f pop%r15 de: 5d pop%rbp df: c3 retq Or with the whole stack trace really... Thanks, Sasha -- 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 3/3] usb: storage: adjust module reference for scsi host
On Mon, 5 Jan 2015, Akinobu Mita wrote: While accessing a unusual usb storage (ums-alauda, ums-cypress, ...), the module reference count is not incremented. Because these drivers allocate scsi hosts with usb_stor_host_template defined in usb-storage module. So these drivers always can be unloaded. This fixes it by adjusting module reference after scsi host allocation. diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 62c2d9d..77660d6 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -1242,6 +1242,7 @@ static int alauda_probe(struct usb_interface *intf, us-transport = alauda_transport; us-transport_reset = usb_stor_Bulk_reset; us-max_lun = 1; + us_to_host(us)-module = THIS_MODULE; result = usb_stor_probe2(us); return result; ... etc. An easier and more foolproof approach would be to change usb_store_probe2 to take an extra argument for the owner: int _usb_stor_probe2(struct us_data *us, struct module *owner) ... us_to_host(us)-module = owner; ... Then in usb.h: extern int _usb_stor_probe2(struct us_data *us, struct module *owner); #define usb_stor_probe2(us) _usb_stor_probe2(us, THIS_MODULE) This pattern is already used in several other places in the kernel. Alan Stern -- 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