Re: [PATCH v3 6/6] qla2xxx: Fix Target mode handling with Multiqueue changes.

2016-12-04 Thread Hannes Reinecke
On 12/02/2016 10:44 PM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> - Fix race condition between dpc_thread accessing Multiqueue resources
>   and qla2x00_remove_one thread trying to free resource.
> - Fix out of order free for Multiqueue resources. Also, Multiqueue
>   interrupts needs a workqueue. Interrupt needed to stop before
>   the wq can be destroyed.
> 
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_def.h |  3 ++-
>  drivers/scsi/qla2xxx/qla_isr.c | 20 +++--
>  drivers/scsi/qla2xxx/qla_mq.c  |  2 +-
>  drivers/scsi/qla2xxx/qla_os.c  | 51 
> +++---
>  4 files changed, 49 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
> index 607d539..e613535 100644
> --- a/drivers/scsi/qla2xxx/qla_def.h
> +++ b/drivers/scsi/qla2xxx/qla_def.h
> @@ -2734,7 +2734,8 @@ struct isp_operations {
>  
>  #define QLA_MSIX_DEFAULT 0x00
>  #define QLA_MSIX_RSP_Q   0x01
> -#define QLA_MSIX_QPAIR_MULTIQ_RSP_Q  0x02
> +#define QLA_ATIO_VECTOR  0x02
> +#define QLA_MSIX_QPAIR_MULTIQ_RSP_Q  0x03
>  
>  #define QLA_MIDX_DEFAULT 0
>  #define QLA_MIDX_RSP_Q   1
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index 14f27a7..03384cf 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -2976,6 +2976,7 @@ struct qla_init_msix_entry {
>  static struct qla_init_msix_entry msix_entries[] = {
>   { "qla2xxx (default)", qla24xx_msix_default },
>   { "qla2xxx (rsp_q)", qla24xx_msix_rsp_q },
> + { "qla2xxx (atio_q)", qla83xx_msix_atio_q },
>   { "qla2xxx (qpair_multiq)", qla2xxx_msix_rsp_q },
>  };
>  
> @@ -2984,17 +2985,10 @@ struct qla_init_msix_entry {
>   { "qla2xxx (rsp_q)", qla82xx_msix_rsp_q },
>  };
>  
> -static struct qla_init_msix_entry qla83xx_msix_entries[] = {
> - { "qla2xxx (default)", qla24xx_msix_default },
> - { "qla2xxx (rsp_q)", qla24xx_msix_rsp_q },
> - { "qla2xxx (atio_q)", qla83xx_msix_atio_q },
> -};
> -
>  static int
>  qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
>  {
>  #define MIN_MSIX_COUNT   2
> -#define ATIO_VECTOR  2
>   int i, ret;
>   struct qla_msix_entry *qentry;
>   scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
> @@ -3051,7 +3045,7 @@ struct qla_init_msix_entry {
>   }
>  
>   /* Enable MSI-X vectors for the base queue */
> - for (i = 0; i < 2; i++) {
> + for (i = 0; i < (QLA_MSIX_RSP_Q + 1); i++) {
>   qentry = >msix_entries[i];
>   qentry->handle = rsp;
>   rsp->msix = qentry;
> @@ -3068,6 +3062,7 @@ struct qla_init_msix_entry {
>   if (ret)
>   goto msix_register_fail;
>   qentry->have_irq = 1;
> + qentry->in_use = 1;
>  
>   /* Register for CPU affinity notification. */
>   irq_set_affinity_notifier(qentry->vector, >irq_notify);
> @@ -3087,14 +3082,15 @@ struct qla_init_msix_entry {
>* queue.
>*/
>   if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) {
> - qentry = >msix_entries[ATIO_VECTOR];
> + qentry = >msix_entries[QLA_ATIO_VECTOR];
>   rsp->msix = qentry;
>   qentry->handle = rsp;
>   scnprintf(qentry->name, sizeof(qentry->name),
> - qla83xx_msix_entries[ATIO_VECTOR].name);
> + msix_entries[QLA_ATIO_VECTOR].name);
> + qentry->in_use = 1;
>   ret = request_irq(qentry->vector,
> - qla83xx_msix_entries[ATIO_VECTOR].handler,
> - 0, qla83xx_msix_entries[ATIO_VECTOR].name, rsp);
> + msix_entries[QLA_ATIO_VECTOR].handler,
> + 0, msix_entries[QLA_ATIO_VECTOR].name, rsp);
>   qentry->have_irq = 1;
>   }
>  
> diff --git a/drivers/scsi/qla2xxx/qla_mq.c b/drivers/scsi/qla2xxx/qla_mq.c
> index a64b7b0..5543b4c 100644
> --- a/drivers/scsi/qla2xxx/qla_mq.c
> +++ b/drivers/scsi/qla2xxx/qla_mq.c
> @@ -118,7 +118,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct 
> scsi_qla_host *vha, int qos, int v
>   qpair->vp_idx = vp_idx;
>  
>   for (i = 0; i < ha->msix_count; i++) {
> - msix = >msix_entries[i + 2];
> + msix = >msix_entries[i];
>   if (msix->in_use)
>   continue;
>   qpair->msix = msix;
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 3371b3f..91d8e7a 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -434,24 +434,41 @@ static void qla2x00_free_queues(struct qla_hw_data *ha)
>   struct req_que *req;
>

Re: [PATCH v3 4/6] qla2xxx: Add multiple queue pair functionality.

2016-12-04 Thread Hannes Reinecke
On 12/02/2016 10:44 PM, Himanshu Madhani wrote:
> From: Michael Hernandez 
> 
> Replaced existing multiple queue functionality with framework
> that allows for the creation of pairs of request and response queues,
> either at start of day or dynamically.
> 
> Signed-off-by: Sawan Chandak 
> Signed-off-by: Michael Hernandez 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/Makefile |   3 +-
>  drivers/scsi/qla2xxx/qla_attr.c   |  36 ++--
>  drivers/scsi/qla2xxx/qla_bottom.c | 398 
> ++
>  drivers/scsi/qla2xxx/qla_dbg.c|   4 +-
>  drivers/scsi/qla2xxx/qla_def.h| 105 --
>  drivers/scsi/qla2xxx/qla_gbl.h|  32 ++-
>  drivers/scsi/qla2xxx/qla_init.c   |  14 +-
>  drivers/scsi/qla2xxx/qla_inline.h |  30 +++
>  drivers/scsi/qla2xxx/qla_iocb.c   |  56 ++
>  drivers/scsi/qla2xxx/qla_isr.c| 101 +-
>  drivers/scsi/qla2xxx/qla_mbx.c|  33 ++--
>  drivers/scsi/qla2xxx/qla_mid.c| 116 +--
>  drivers/scsi/qla2xxx/qla_mq.c | 236 ++
>  drivers/scsi/qla2xxx/qla_os.c | 237 +++
>  drivers/scsi/qla2xxx/qla_top.c|  95 +
>  15 files changed, 1153 insertions(+), 343 deletions(-)
>  create mode 100644 drivers/scsi/qla2xxx/qla_bottom.c
>  create mode 100644 drivers/scsi/qla2xxx/qla_mq.c
>  create mode 100644 drivers/scsi/qla2xxx/qla_top.c
> 
> diff --git a/drivers/scsi/qla2xxx/Makefile b/drivers/scsi/qla2xxx/Makefile
> index 44def6b..ca04260 100644
> --- a/drivers/scsi/qla2xxx/Makefile
> +++ b/drivers/scsi/qla2xxx/Makefile
> @@ -1,6 +1,7 @@
>  qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
>   qla_dbg.o qla_sup.o qla_attr.o qla_mid.o qla_dfs.o qla_bsg.o \
> - qla_nx.o qla_mr.o qla_nx2.o qla_target.o qla_tmpl.o
> + qla_nx.o qla_mr.o qla_nx2.o qla_target.o qla_tmpl.o qla_mq.o \
> + qla_top.o qla_bottom.o
>  
>  obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o
>  obj-$(CONFIG_TCM_QLA2XXX) += tcm_qla2xxx.o
> diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
> index fe7469c..47eb4d5 100644
> --- a/drivers/scsi/qla2xxx/qla_attr.c
> +++ b/drivers/scsi/qla2xxx/qla_attr.c
> @@ -1988,9 +1988,9 @@ struct device_attribute *qla2x00_host_attrs[] = {
>   scsi_qla_host_t *base_vha = shost_priv(fc_vport->shost);
>   scsi_qla_host_t *vha = NULL;
>   struct qla_hw_data *ha = base_vha->hw;
> - uint16_t options = 0;
>   int cnt;
>   struct req_que *req = ha->req_q_map[0];
> + struct qla_qpair *qpair;
>  
>   ret = qla24xx_vport_create_req_sanity_check(fc_vport);
>   if (ret) {
> @@ -2075,15 +2075,9 @@ struct device_attribute *qla2x00_host_attrs[] = {
>   qlt_vport_create(vha, ha);
>   qla24xx_vport_disable(fc_vport, disable);
>  
> - if (ha->flags.cpu_affinity_enabled) {
> - req = ha->req_q_map[1];
> - ql_dbg(ql_dbg_multiq, vha, 0xc000,
> - "Request queue %p attached with "
> - "VP[%d], cpu affinity =%d\n",
> - req, vha->vp_idx, ha->flags.cpu_affinity_enabled);
> - goto vport_queue;
> - } else if (ql2xmaxqueues == 1 || !ha->npiv_info)
> + if (!ql2xmqsupport || !ha->npiv_info)
>   goto vport_queue;
> +
>   /* Create a request queue in QoS mode for the vport */
>   for (cnt = 0; cnt < ha->nvram_npiv_size; cnt++) {
>   if (memcmp(ha->npiv_info[cnt].port_name, vha->port_name, 8) == 0
> @@ -2095,20 +2089,20 @@ struct device_attribute *qla2x00_host_attrs[] = {
>   }
>  
>   if (qos) {
> - ret = qla25xx_create_req_que(ha, options, vha->vp_idx, 0, 0,
> - qos);
> - if (!ret)
> + qpair = qla2xxx_create_qpair(vha, qos, vha->vp_idx);
> + if (!qpair)
>   ql_log(ql_log_warn, vha, 0x7084,
> - "Can't create request queue for VP[%d]\n",
> + "Can't create qpair for VP[%d]\n",
>   vha->vp_idx);
>   else {
>   ql_dbg(ql_dbg_multiq, vha, 0xc001,
> - "Request Que:%d Q0s: %d) created for VP[%d]\n",
> - ret, qos, vha->vp_idx);
> + "Queue pair: %d Qos: %d) created for VP[%d]\n",
> + qpair->id, qos, vha->vp_idx);
>   ql_dbg(ql_dbg_user, vha, 0x7085,
> - "Request Que:%d Q0s: %d) created for VP[%d]\n",
> - ret, qos, vha->vp_idx);
> - req = ha->req_q_map[ret];
> + "Queue Pair: %d Qos: %d) created for VP[%d]\n",
> + qpair->id, qos, vha->vp_idx);
> + req = qpair->req;
> + 

Re: [PATCH v3 5/6] qla2xxx: Add Block Multi Queue functionality.

2016-12-04 Thread Hannes Reinecke
On 12/02/2016 10:44 PM, Himanshu Madhani wrote:
> From: Michael Hernandez 
> 
> Tell the SCSI layer how many hardware queues we have based on the number
> of max queue pairs created. The number of max queue pairs created will
> depend on number of MSI-X vector count.
> 
> This feature can be turned on via CONFIG_SCSI_MQ_DEFAULT or passing
> scsi_mod.use_blk_mq=Y as a parameter to the kernel
> 
> Queue pair creation depend on module parameter "ql2xmqsupport", which
> need to be enabled to create queue pair.
> 
> Signed-off-by: Sawan Chandak 
> Signed-off-by: Michael Hernandez 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 37 -
>  1 file changed, 32 insertions(+), 5 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (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 1/2 v2] scsi: be2iscsi: set errno on error path

2016-12-04 Thread Pan Bian
Variable ret is reset in the loop, and its value will be 0 during the 
after repeat of the loop. Then, if pci_alloc_consistent() returns NULL, 
the return value is 0. 0 means no error, which may make it impossible 
for the callers of beiscsi_create_cqs() to detect the memory allocation 
error. This patch fixes the bug, assigning "-ENOMEM" to ret on the path 
that the call to pci_alloc_consistent() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188941

Signed-off-by: Pan Bian 
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d9239c2..b6c5791 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3113,8 +3113,10 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
cq_vaddress = pci_alloc_consistent(phba->pcidev,
   num_cq_pages * PAGE_SIZE,
   );
-   if (!cq_vaddress)
+   if (!cq_vaddress) {
+   ret = -ENOMEM;
goto create_cq_error;
+   }
 
ret = be_fill_queue(cq, phba->params.num_cq_entries,
sizeof(struct sol_cqe), cq_vaddress);
-- 
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/2 v2] scsi: be2iscsi: set errno on error path

2016-12-04 Thread Pan Bian
Variable ret is reset in the loop, and its value will be 0 during the
after repeat of the loop. Then, if pci_alloc_consistent() returns NULL, 
the return value is 0. 0 means no error, which may make it impossible 
for the callers of beiscsi_create_eqs() to detect the memory allocation 
error. This patch fixes the bug, assigning "-ENOMEM" to ret on the path 
that the call to pci_alloc_consistent() fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188951

Signed-off-by: Pan Bian 
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index b6c5791..b5112d6 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3049,8 +3049,10 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
eq_vaddress = pci_alloc_consistent(phba->pcidev,
   num_eq_pages * PAGE_SIZE,
   );
-   if (!eq_vaddress)
+   if (!eq_vaddress) {
+   ret = -ENOMEM;
goto create_eq_error;
+   }
 
mem->va = eq_vaddress;
ret = be_fill_queue(eq, phba->params.num_eq_entries,
-- 
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


Re: [PATCH v3 3/6] qla2xxx: Utilize pci_alloc_irq_vectors/pci_free_irq_vectors calls.

2016-12-04 Thread Hannes Reinecke
On 12/02/2016 10:44 PM, Himanshu Madhani wrote:
> From: Michael Hernandez 
> 
> Replaces the old pci_enable_msi[x]* and pci_disable_msi[x] calls.
> 
> Signed-off-by: Michael Hernandez 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_def.h |  1 +
>  drivers/scsi/qla2xxx/qla_isr.c | 81 
> +++---
>  2 files changed, 30 insertions(+), 52 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
> index 9a6ddcb..53021b5 100644
> --- a/drivers/scsi/qla2xxx/qla_def.h
> +++ b/drivers/scsi/qla2xxx/qla_def.h
> @@ -2748,6 +2748,7 @@ struct qla_msix_entry {
>   uint32_t vector;
>   uint16_t entry;
>   struct rsp_que *rsp;
> + void *handle;
>   struct irq_affinity_notify irq_notify;
>   int cpuid;
>  };
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index 19f1848..16e7601 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -3025,52 +3025,17 @@ struct qla_init_msix_entry {
>   { "qla2xxx (atio_q)", qla83xx_msix_atio_q },
>  };
>  
> -static void
> -qla24xx_disable_msix(struct qla_hw_data *ha)
> -{
> - int i;
> - struct qla_msix_entry *qentry;
> - scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
> -
> - for (i = 0; i < ha->msix_count; i++) {
> - qentry = >msix_entries[i];
> - if (qentry->have_irq) {
> - /* un-register irq cpu affinity notification */
> - irq_set_affinity_notifier(qentry->vector, NULL);
> - free_irq(qentry->vector, qentry->rsp);
> - }
> - }
> - pci_disable_msix(ha->pdev);
> - kfree(ha->msix_entries);
> - ha->msix_entries = NULL;
> - ha->flags.msix_enabled = 0;
> - ql_dbg(ql_dbg_init, vha, 0x0042,
> - "Disabled the MSI.\n");
> -}
> -
>  static int
>  qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
>  {
>  #define MIN_MSIX_COUNT   2
>  #define ATIO_VECTOR  2
>   int i, ret;
> - struct msix_entry *entries;
>   struct qla_msix_entry *qentry;
>   scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
>  
> - entries = kzalloc(sizeof(struct msix_entry) * ha->msix_count,
> - GFP_KERNEL);
> - if (!entries) {
> - ql_log(ql_log_warn, vha, 0x00bc,
> - "Failed to allocate memory for msix_entry.\n");
> - return -ENOMEM;
> - }
> -
> - for (i = 0; i < ha->msix_count; i++)
> - entries[i].entry = i;
> -
> - ret = pci_enable_msix_range(ha->pdev,
> - entries, MIN_MSIX_COUNT, ha->msix_count);
> + ret = pci_alloc_irq_vectors(ha->pdev,
> + MIN_MSIX_COUNT, ha->msix_count, PCI_IRQ_MSIX|PCI_IRQ_AFFINITY);
>   if (ret < 0) {
>   ql_log(ql_log_fatal, vha, 0x00c7,
>   "MSI-X: Failed to enable support, "
> @@ -3097,10 +3062,10 @@ struct qla_init_msix_entry {
>  
>   for (i = 0; i < ha->msix_count; i++) {
>   qentry = >msix_entries[i];
> - qentry->vector = entries[i].vector;
> - qentry->entry = entries[i].entry;
> + qentry->vector = pci_irq_vector(ha->pdev, i);
> + qentry->entry = i;
>   qentry->have_irq = 0;
> - qentry->rsp = NULL;
> + qentry->handle = NULL;
>   qentry->irq_notify.notify  = qla_irq_affinity_notify;
>   qentry->irq_notify.release = qla_irq_affinity_release;
>   qentry->cpuid = -1;
> @@ -3109,7 +3074,7 @@ struct qla_init_msix_entry {
>   /* Enable MSI-X vectors for the base queue */
>   for (i = 0; i < 2; i++) {
>   qentry = >msix_entries[i];
> - qentry->rsp = rsp;
> + qentry->handle = rsp;
>   rsp->msix = qentry;
>   if (IS_P3P_TYPE(ha))
>   ret = request_irq(qentry->vector,
> @@ -3142,7 +3107,7 @@ struct qla_init_msix_entry {
>*/
>   if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) {
>   qentry = >msix_entries[ATIO_VECTOR];
> - qentry->rsp = rsp;
> + qentry->handle = rsp;
>   rsp->msix = qentry;
>   ret = request_irq(qentry->vector,
>   qla83xx_msix_entries[ATIO_VECTOR].handler,
> @@ -3155,7 +3120,7 @@ struct qla_init_msix_entry {
>   ql_log(ql_log_fatal, vha, 0x00cb,
>   "MSI-X: unable to register handler -- %x/%d.\n",
>   qentry->vector, ret);
> - qla24xx_disable_msix(ha);
> + qla2x00_free_irqs(vha);
>   ha->mqenable = 0;
>   goto msix_out;
>   }
> @@ -3177,7 +3142,6 @@ struct qla_init_msix_entry {
>   ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues);
>  
>  msix_out:
> -

scsi: Adding lock to protect variables of bit-field in struct scsi_device

2016-12-04 Thread jiangyiwen
Hi guys,

I'm sorry if someone else has already asked the same question before,
but here's what we are facing with scsi mid-level.

Variables of bit-field in struct scsi_device are not protected by
lock, such as no_report_opcodes, is_visible and so on. I guess
everyone think these variable can't be accessed by multi-processes,
but unfortunately, I came across one problem as follows:

Assuming there is a process A which is executing the operation of
adding device, so it will call scsi_sysfs_add_sdev, and eventually
it will start an async kworker B to execute sd_probe_async.
In this way, process A will set "sdev->is_visible = 1" in the function
of scsi_sysfs_add_sdev, in the meantime, aysnc kworker B may set
"sdev->no_report_opcodes = 1" in the function of sd_read_write_same.
Neither of the variables are protected by any lock, setting the value
of no_report_opcodes may change value of is_visible from 1 to 0, which
alters the bit field unexpectedly. Did I miss anything?

So I'd like to know whether these variable of bit-field should
be protected by lock or not.

Please advise. Thanks in advance!

Best regards,
Yiwen

--
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: mvsas: Replace pci_pool_alloc by pci_pool_zalloc

2016-12-04 Thread Souptick Joarder
Hi Martin,

Any comment on this patch?

On Thu, Dec 1, 2016 at 11:34 AM, Souptick Joarder  wrote:
> On Mon, Nov 28, 2016 at 4:56 PM, Souptick Joarder  
> wrote:
>> Inside mvs_task_prep(), pci_pool_alloc() followed by memset will be
>> replaced by pci_pool_zalloc()
>>
>> Signed-off-by: Souptick joarder 
>> ---
>>  drivers/scsi/mvsas/mv_sas.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
>> index 86eb199..681e5f7 100644
>> --- a/drivers/scsi/mvsas/mv_sas.c
>> +++ b/drivers/scsi/mvsas/mv_sas.c
>> @@ -790,10 +790,9 @@ static int mvs_task_prep(struct sas_task *task, struct 
>> mvs_info *mvi, int is_tmf
>> slot->n_elem = n_elem;
>> slot->slot_tag = tag;
>>
>> -   slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, 
>> >buf_dma);
>> +   slot->buf = pci_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, 
>> >buf_dma);
>> if (!slot->buf)
>> goto err_out_tag;
>> -   memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>>
>> tei.task = task;
>> tei.hdr = >slot[tag];
>> --
>> 1.9.1
>
> Any Comment on this patch?
>>

Regards
Souptick
--
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/4] g_NCR5380: Check for chip presence before calling NCR5380_init()

2016-12-04 Thread Finn Thain
From: Ondrej Zary 

Write and read back mode register to check that a chip is really there.
If no card is present, reads result in 0xff.

Signed-off-by: Ondrej Zary 
Signed-off-by: Finn Thain 
---
 drivers/scsi/g_NCR5380.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index de5147a..76e3745 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -248,6 +248,13 @@ static int generic_NCR5380_init_one(struct 
scsi_host_template *tpnt,
}
}
 
+   /* Check for vacant slot */
+   NCR5380_write(MODE_REG, 0);
+   if (NCR5380_read(MODE_REG) != 0) {
+   ret = -ENODEV;
+   goto out_unregister;
+   }
+
ret = NCR5380_init(instance, flags | FLAG_LATE_DMA_SETUP);
if (ret)
goto out_unregister;
-- 
2.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/4] g_NCR5380: Autoprobe board IRQ by default

2016-12-04 Thread Finn Thain
Automatically probe the board irq when no irq parameter is provided,
to simulate PnP. The old default behaviour was to disable the irq.

Update driver documentation accordingly and add some printk messages
to make this behaviour visible.

Signed-off-by: Finn Thain 
---
 Documentation/scsi/g_NCR5380.txt | 46 
 drivers/scsi/g_NCR5380.c | 30 +++---
 2 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/Documentation/scsi/g_NCR5380.txt b/Documentation/scsi/g_NCR5380.txt
index e2c1879..37b1967 100644
--- a/Documentation/scsi/g_NCR5380.txt
+++ b/Documentation/scsi/g_NCR5380.txt
@@ -6,17 +6,15 @@ NCR53c400 extensions (c) 1994,1995,1996 Kevin Lentin
 This file documents the NCR53c400 extensions by Kevin Lentin and some
 enhancements to the NCR5380 core.
 
-This driver supports both NCR5380 and NCR53c400 cards in port or memory
-mapped modes. Currently this driver can only support one of those mapping
-modes at a time but it does support both of these chips at the same time.
-The next release of this driver will support port & memory mapped cards at
-the same time. It should be able to handle multiple different cards in the
-same machine.
+This driver supports NCR5380 and NCR53c400 and compatible cards in port or
+memory mapped modes.
 
-The drivers/scsi/Makefile has an override in it for the most common
-NCR53c400 card, the Trantor T130B in its default configuration:
-   Port: 0x350
-   IRQ : 5
+Use of an interrupt is recommended, if supported by the board, as this will
+allow targets to disconnect and thereby improve SCSI bus utilization.
+
+If the irq parameter is 254 or is omitted entirely, the driver will probe
+for the correct IRQ line automatically. If the irq parameter is 0 or 255
+then no IRQ will be used.
 
 The NCR53c400 does not support DMA but it does have Pseudo-DMA which is
 supported by the driver.
@@ -47,22 +45,24 @@ These old-style parameters can support only one card:
   dtc_3181e=1  to set up for a Domex Technology Corp 3181E board
   hp_c2502=1   to set up for a Hewlett Packard C2502 board
 
-e.g.
-OLD: modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1
-NEW: modprobe g_NCR5380 irq=5 base=0x350 card=0
-  for a port mapped NCR5380 board or
-
-OLD: modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
-NEW: modprobe g_NCR5380 irq=255 base=0xc8000 card=1
-  for a memory mapped NCR53C400 board with interrupts disabled or
+E.g. Trantor T130B in its default configuration:
+modprobe g_NCR5380 irq=5 base=0x350 card=1
+or alternatively, using the old syntax,
+modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_53c400=1
 
-NEW: modprobe g_NCR5380 irq=0,7 base=0x240,0x300 card=3,4
-  for two cards: DTC3181 (in non-PnP mode) at 0x240 with no IRQ
- and HP C2502 at 0x300 with IRQ 7
+E.g. a port mapped NCR5380 board, driver to probe for IRQ:
+modprobe g_NCR5380 base=0x350 card=0
+or alternatively,
+modprobe g_NCR5380 ncr_addr=0x350 ncr_5380=1
 
-(255 should be specified for no or DMA interrupt, 254 to autoprobe for an 
- IRQ line if overridden on the command line.)
+E.g. a memory mapped NCR53C400 board with no IRQ:
+modprobe g_NCR5380 irq=255 base=0xc8000 card=1
+or alternatively,
+modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
 
+E.g. two cards, DTC3181 (in non-PnP mode) at 0x240 with no IRQ
+and HP C2502 at 0x300 with IRQ 7:
+modprobe g_NCR5380 irq=0,7 base=0x240,0x300 card=3,4
 
 Kevin Lentin
 k.len...@cs.monash.edu.au
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 58a0b82..6f9665d 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -37,7 +37,7 @@
 #define MAX_CARDS 8
 
 /* old-style parameters for compatibility */
-static int ncr_irq;
+static int ncr_irq = -1;
 static int ncr_addr;
 static int ncr_5380;
 static int ncr_53c400;
@@ -52,9 +52,9 @@ module_param(ncr_53c400a, int, 0);
 module_param(dtc_3181e, int, 0);
 module_param(hp_c2502, int, 0);
 
-static int irq[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+static int irq[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 module_param_array(irq, int, NULL, 0);
-MODULE_PARM_DESC(irq, "IRQ number(s)");
+MODULE_PARM_DESC(irq, "IRQ number(s) (0=none, 254=auto [default])");
 
 static int base[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
 module_param_array(base, int, NULL, 0);
@@ -344,6 +344,8 @@ static int generic_NCR5380_init_one(struct 
scsi_host_template *tpnt,
/* Compatibility with documented NCR5380 kernel parameters */
if (irq == 255 || irq == 0)
irq = NO_IRQ;
+   else if (irq == -1)
+   irq = IRQ_AUTO;
 
if (board == BOARD_HP_C2502) {
int *irq_table = hp_c2502_irqs;
@@ -370,24 +372,28 @@ static int generic_NCR5380_init_one(struct 
scsi_host_template *tpnt,
magic_configure(port_idx, board_irq, magic);
}
 
-   if (irq == IRQ_AUTO)
+   if (irq == IRQ_AUTO) {
instance->irq = 

[PATCH 3/4] g_NCR5380: Fix automatic IRQ on HP C2502 cards

2016-12-04 Thread Finn Thain
When IRQ_AUTO is used, the interrupt for HP C2502 cards gets disabled.
Fix this by programming the card for a suitable free irq. The code for
the free irq search comes from ALSA.

Also allow IRQ 9 to work (it aliases to IRQ 2 on the card), as per
Ondrej Zary's patch.

Suggested-by: Ondrej Zary 
Signed-off-by: Finn Thain 
---
 drivers/scsi/g_NCR5380.c | 70 +++-
 1 file changed, 57 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 6d245a7..58a0b82 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -131,14 +131,33 @@ static void magic_configure(int idx, u8 irq, u8 magic[])
outb(magic[3], 0x379);
outb(magic[4], 0x379);
 
-   /* allowed IRQs for HP C2502 */
-   if (irq != 2 && irq != 3 && irq != 4 && irq != 5 && irq != 7)
-   irq = 0;
+   if (irq == 9)
+   irq = 2;
+
if (idx >= 0 && idx <= 7)
cfg = 0x80 | idx | (irq << 4);
outb(cfg, 0x379);
 }
 
+static irqreturn_t legacy_empty_irq_handler(int irq, void *dev_id)
+{
+   return IRQ_HANDLED;
+}
+
+static int legacy_find_free_irq(int *irq_table)
+{
+   while (*irq_table != -1) {
+   if (!request_irq(*irq_table, legacy_empty_irq_handler,
+IRQF_PROBE_SHARED, "Test IRQ",
+(void *)irq_table)) {
+   free_irq(*irq_table, (void *) irq_table);
+   return *irq_table;
+   }
+   irq_table++;
+   }
+   return -1;
+}
+
 static unsigned int ncr_53c400a_ports[] = {
0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
 };
@@ -151,6 +170,9 @@ static u8 ncr_53c400a_magic[] = {   /* 53C400A & DTC436 */
 static u8 hp_c2502_magic[] = { /* HP C2502 */
0x0f, 0x22, 0xf0, 0x20, 0x80
 };
+static int hp_c2502_irqs[] = {
+   9, 5, 7, 3, 4, -1
+};
 
 static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
struct device *pdev, int base, int irq, int board)
@@ -319,19 +341,41 @@ static int generic_NCR5380_init_one(struct 
scsi_host_template *tpnt,
 
NCR5380_maybe_reset_bus(instance);
 
-   if (irq != IRQ_AUTO)
-   instance->irq = irq;
-   else
-   instance->irq = g_NCR5380_probe_irq(instance);
-
/* Compatibility with documented NCR5380 kernel parameters */
-   if (instance->irq == 255)
-   instance->irq = NO_IRQ;
+   if (irq == 255 || irq == 0)
+   irq = NO_IRQ;
+
+   if (board == BOARD_HP_C2502) {
+   int *irq_table = hp_c2502_irqs;
+   int board_irq = -1;
+
+   switch (irq) {
+   case NO_IRQ:
+   board_irq = 0;
+   break;
+   case IRQ_AUTO:
+   board_irq = legacy_find_free_irq(irq_table);
+   break;
+   default:
+   while (*irq_table != -1)
+   if (*irq_table++ == irq)
+   board_irq = irq;
+   }
+
+   if (board_irq <= 0) {
+   board_irq = 0;
+   irq = NO_IRQ;
+   }
+
+   magic_configure(port_idx, board_irq, magic);
+   }
+
+   if (irq == IRQ_AUTO)
+   instance->irq = g_NCR5380_probe_irq(instance);
+   else
+   instance->irq = irq;
 
if (instance->irq != NO_IRQ) {
-   /* set IRQ for HP C2502 */
-   if (board == BOARD_HP_C2502)
-   magic_configure(port_idx, instance->irq, magic);
if (request_irq(instance->irq, generic_NCR5380_intr,
0, "NCR5380", instance)) {
printk(KERN_WARNING "scsi%d : IRQ%d not free, 
interrupts disabled\n", instance->host_no, instance->irq);
-- 
2.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 2/4] g_NCR5380: Use probe_irq_*() for IRQ probing

2016-12-04 Thread Finn Thain
From: Ondrej Zary 

Use standard probe_irq_on() and probe_irq_off() functions instead of
own implementation.
This prevents warning messages like this in the kernel log:
genirq: Flags mismatch irq 1.  (NCR-probe) vs. 0080 (i8042)

Move the IRQ trigger code from NCR5380 to g_NCR5380 where it is used.

Also clear interrupt flag before and after the probe.

Signed-off-by: Ondrej Zary 
Signed-off-by: Finn Thain 
---
 drivers/scsi/NCR5380.c   | 77 +---
 drivers/scsi/NCR5380.h   | 11 ---
 drivers/scsi/g_NCR5380.c | 52 +++-
 drivers/scsi/g_NCR5380.h |  2 ++
 4 files changed, 54 insertions(+), 88 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index d849ffa..4f5ca79 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -97,9 +97,6 @@
  * and macros and include this file in your driver.
  *
  * These macros control options :
- * AUTOPROBE_IRQ - if defined, the NCR5380_probe_irq() function will be
- * defined.
- *
  * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
  * for commands that return with a CHECK CONDITION status.
  *
@@ -127,9 +124,7 @@
  * NCR5380_dma_residual   - residual byte count
  *
  * The generic driver is initialized by calling NCR5380_init(instance),
- * after setting the appropriate host specific fields and ID.  If the
- * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance,
- * possible) function may be used.
+ * after setting the appropriate host specific fields and ID.
  */
 
 #ifndef NCR5380_io_delay
@@ -351,76 +346,6 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
 }
 #endif
 
-
-static int probe_irq;
-
-/**
- * probe_intr  -   helper for IRQ autoprobe
- * @irq: interrupt number
- * @dev_id: unused
- * @regs: unused
- *
- * Set a flag to indicate the IRQ in question was received. This is
- * used by the IRQ probe code.
- */
-
-static irqreturn_t probe_intr(int irq, void *dev_id)
-{
-   probe_irq = irq;
-   return IRQ_HANDLED;
-}
-
-/**
- * NCR5380_probe_irq   -   find the IRQ of an NCR5380
- * @instance: NCR5380 controller
- * @possible: bitmask of ISA IRQ lines
- *
- * Autoprobe for the IRQ line used by the NCR5380 by triggering an IRQ
- * and then looking to see what interrupt actually turned up.
- */
-
-static int __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance,
-   int possible)
-{
-   struct NCR5380_hostdata *hostdata = shost_priv(instance);
-   unsigned long timeout;
-   int trying_irqs, i, mask;
-
-   for (trying_irqs = 0, i = 1, mask = 2; i < 16; ++i, mask <<= 1)
-   if ((mask & possible) && (request_irq(i, _intr, 0, 
"NCR-probe", NULL) == 0))
-   trying_irqs |= mask;
-
-   timeout = jiffies + msecs_to_jiffies(250);
-   probe_irq = NO_IRQ;
-
-   /*
-* A interrupt is triggered whenever BSY = false, SEL = true
-* and a bit set in the SELECT_ENABLE_REG is asserted on the
-* SCSI bus.
-*
-* Note that the bus is only driven when the phase control signals
-* (I/O, C/D, and MSG) match those in the TCR, so we must reset that
-* to zero.
-*/
-
-   NCR5380_write(TARGET_COMMAND_REG, 0);
-   NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-   NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | 
ICR_ASSERT_SEL);
-
-   while (probe_irq == NO_IRQ && time_before(jiffies, timeout))
-   schedule_timeout_uninterruptible(1);
-
-   NCR5380_write(SELECT_ENABLE_REG, 0);
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-
-   for (i = 1, mask = 2; i < 16; ++i, mask <<= 1)
-   if (trying_irqs & mask)
-   free_irq(i, NULL);
-
-   return probe_irq;
-}
-
 /**
  * NCR58380_info - report driver and host information
  * @instance: relevant scsi host instance
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 3c6ce54..51a3567 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -199,16 +199,6 @@
 
 #define PHASE_SR_TO_TCR(phase) ((phase) >> 2)
 
-/*
- * These are "special" values for the irq and dma_channel fields of the 
- * Scsi_Host structure
- */
-
-#define DMA_NONE   255
-#define IRQ_AUTO   254
-#define DMA_AUTO   254
-#define PORT_AUTO  0x  /* autoprobe io port for 53c400a */
-
 #ifndef NO_IRQ
 #define NO_IRQ 0
 #endif
@@ -290,7 +280,6 @@ static void NCR5380_print(struct Scsi_Host *instance);
 #define NCR5380_dprint_phase(flg, arg) do {} while (0)
 #endif
 
-static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible);
 static int NCR5380_init(struct Scsi_Host *instance, int flags);
 static int NCR5380_maybe_reset_bus(struct 

[PATCH 0/4] g_NCR5380: Bug fix and some enhancements

2016-12-04 Thread Finn Thain
This patch series is based on the one submitted recently by Ondrej Zary.

This version has a different irq probing fix for HP C2502 boards and
a more comprehensive patch to change the default irq parameter.

It needs testing on actual ISA hardware.


Finn Thain (4):
  g_NCR5380: Check for chip presence before calling NCR5380_init()
  g_NCR5380: Use probe_irq_*() for IRQ probing
  g_NCR5380: Fix automatic IRQ on HP C2502 cards
  g_NCR5380: Autoprobe board IRQ by default

 Documentation/scsi/g_NCR5380.txt |  46 ++--
 drivers/scsi/NCR5380.c   |  77 +---
 drivers/scsi/NCR5380.h   |  11 ---
 drivers/scsi/g_NCR5380.c | 153 +--
 drivers/scsi/g_NCR5380.h |   2 +
 5 files changed, 156 insertions(+), 133 deletions(-)

-- 
2.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 2/2] scsi: be2iscsi: set errno on error path

2016-12-04 Thread Jitendra Bhivare
> -Original Message-
> From: Pan Bian [mailto:bianpan201...@163.com]
> Sent: Sunday, December 04, 2016 10:53 AM
> To: Subbu Seetharaman; Ketan Mukadam; Jitendra Bhivare; James E.J.
> Bottomley; Martin K. Petersen; linux-scsi@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org; Pan Bian
> Subject: [PATCH 2/2] scsi: be2iscsi: set errno on error path
>
> From: Pan Bian 
>
> Variable ret is reset in the loop, and its value will be 0 during the
second and
> after repeat of the loop. If pci_alloc_consistent() returns a NULL
pointer then, it
> will leaves with return value 0. 0 means no error, which is contrary to
the fact.
> This patches fixes the bug, explicitly assigning "-ENOMEM" to return
variable ret
> on the path that the call to
> pci_alloc_consistent() fails.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188951
>
> Signed-off-by: Pan Bian 
> ---
>  drivers/scsi/be2iscsi/be_main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/be2iscsi/be_main.c
b/drivers/scsi/be2iscsi/be_main.c
> index b6c5791..b5112d6 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -3049,8 +3049,10 @@ static int beiscsi_create_eqs(struct beiscsi_hba
> *phba,
>   eq_vaddress = pci_alloc_consistent(phba->pcidev,
>  num_eq_pages *
PAGE_SIZE,
>  );
> - if (!eq_vaddress)
> + if (!eq_vaddress) {
> + ret = -ENOMEM;
>   goto create_eq_error;
> + }
>
>   mem->va = eq_vaddress;
>   ret = be_fill_queue(eq, phba->params.num_eq_entries,
> --
> 1.9.1
>
[JB] Thanks.

Reviewed-by: Jitendra Bhivare 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/2] scsi: be2iscsi: set errno on error path

2016-12-04 Thread Jitendra Bhivare
> -Original Message-
> From: Pan Bian [mailto:bianpan201...@163.com]
> Sent: Sunday, December 04, 2016 10:52 AM
> To: Subbu Seetharaman; Ketan Mukadam; Jitendra Bhivare; James E.J.
> Bottomley; Martin K. Petersen; linux-scsi@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org; Pan Bian
> Subject: [PATCH 1/2] scsi: be2iscsi: set errno on error path
>
> From: Pan Bian 
>
> Variable ret is reset in the loop, and its value will be 0 during the
second and
> after repeat of the loop. If pci_alloc_consistent() returns a NULL
pointer then, it
> will leaves with return value 0. 0 means no error, which is contrary to
the fact.
> This patches fixes the bug, explicitly assigning "-ENOMEM" to return
variable ret
> on the path that the call to
> pci_alloc_consistent() fails.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188941
>
> Signed-off-by: Pan Bian 
> ---
>  drivers/scsi/be2iscsi/be_main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/be2iscsi/be_main.c
b/drivers/scsi/be2iscsi/be_main.c
> index d9239c2..b6c5791 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -3113,8 +3113,10 @@ static int beiscsi_create_cqs(struct beiscsi_hba
> *phba,
>   cq_vaddress = pci_alloc_consistent(phba->pcidev,
>  num_cq_pages *
PAGE_SIZE,
>  );
> - if (!cq_vaddress)
> + if (!cq_vaddress) {
> + ret = -ENOMEM;
>   goto create_cq_error;
> + }
>
>   ret = be_fill_queue(cq, phba->params.num_cq_entries,
>   sizeof(struct sol_cqe), cq_vaddress);
> --
> 1.9.1

[JB] Thanks.

Reviewed-by: Jitendra Bhivare 
--
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 151631] "Synchronizing SCSI cache" fails during(and delays) reboot/shutdown

2016-12-04 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=151631

--- Comment #8 from Daniele Viganò  ---
@Rich, have a look at https://bugzilla.kernel.org/show_bug.cgi?id=187061

Bug has been resolved it 4.9-rc7.

-- 
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


[Bug 151631] "Synchronizing SCSI cache" fails during(and delays) reboot/shutdown

2016-12-04 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=151631

Rich  changed:

   What|Removed |Added

 CC||f...@bitservices.org.uk

--- Comment #7 from Rich  ---
Very similar (if not same) problem happening on my works PC - a Dell Precision
T1700. I will try and get a screenshot and add it to this thread.

The problem began with Kernel 4.8.6 and is still present (currently running
Kernel 4.8.11).

Very annoying on shutdown. I have absolutely no idea if the disks' cache is
actually flushing or not - so data integrity is a concern. Its a magnetic disk
and I have been running fsck on it regularly (no issues found as of yet) and
been avoiding shutting the PC down.

Point of this comment: Its still an issue on some PCs. Anyone else finding the
same?

-- 
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