Re: [PATCH-v2 11/12] xen-scsiback: Convert to percpu_ida tag allocation

2016-01-26 Thread Juergen Gross
On 25/01/16 09:11, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger 
> 
> Cc: Juergen Gross 
> Cc: Hannes Reinecke 
> Cc: David Vrabel 
> Signed-off-by: Nicholas Bellinger 
> ---
>  drivers/xen/xen-scsiback.c | 163 
> -
>  1 file changed, 87 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
> index 594f8a7..640fb22 100644
> --- a/drivers/xen/xen-scsiback.c
> +++ b/drivers/xen/xen-scsiback.c
> @@ -190,7 +190,6 @@ module_param_named(max_buffer_pages, 
> scsiback_max_buffer_pages, int, 0644);
>  MODULE_PARM_DESC(max_buffer_pages,
>  "Maximum number of free pages to keep in backend buffer");
>  
> -static struct kmem_cache *scsiback_cachep;
>  static DEFINE_SPINLOCK(free_pages_lock);
>  static int free_pages_num;
>  static LIST_HEAD(scsiback_free_pages);
> @@ -322,7 +321,8 @@ static void scsiback_free_translation_entry(struct kref 
> *kref)
>  }
>  
>  static void scsiback_do_resp_with_sense(char *sense_buffer, int32_t result,
> - uint32_t resid, struct vscsibk_pend *pending_req)
> + uint32_t resid, struct vscsibk_pend *pending_req,
> + uint16_t rqid)
>  {
>   struct vscsiif_response *ring_res;
>   struct vscsibk_info *info = pending_req->info;

pending_req might be NULL now, so this will panic the system.


Juergen

> @@ -337,7 +337,7 @@ static void scsiback_do_resp_with_sense(char 
> *sense_buffer, int32_t result,
>   info->ring.rsp_prod_pvt++;
>  
>   ring_res->rslt   = result;
> - ring_res->rqid   = pending_req->rqid;
> + ring_res->rqid   = rqid;
>  
>   if (sense_buffer != NULL &&
>   scsi_normalize_sense(sense_buffer, VSCSIIF_SENSE_BUFFERSIZE,
> @@ -358,7 +358,7 @@ static void scsiback_do_resp_with_sense(char 
> *sense_buffer, int32_t result,
>   if (notify)
>   notify_remote_via_irq(info->irq);
>  
> - if (pending_req->v2p)
> + if (pending_req && pending_req->v2p)
>   kref_put(&pending_req->v2p->kref,
>scsiback_free_translation_entry);
>  }
> @@ -378,7 +378,8 @@ static void scsiback_cmd_done(struct vscsibk_pend 
> *pending_req)
>   scsiback_print_status(sense_buffer, errors, pending_req);
>  
>   scsiback_fast_flush_area(pending_req);
> - scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req);
> + scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req,
> + pending_req->rqid);
>   scsiback_put(info);
>  }
>  
> @@ -616,15 +617,15 @@ static void scsiback_device_action(struct vscsibk_pend 
> *pending_req,
>   err = (se_cmd->se_tmr_req->response == TMR_FUNCTION_COMPLETE) ?
>   SUCCESS : FAILED;
>  
> -out:
> - if (tmr) {
> - transport_generic_free_cmd(&pending_req->se_cmd, 1);
> + scsiback_do_resp_with_sense(NULL, err, 0, pending_req,
> + pending_req->rqid);
> + transport_generic_free_cmd(&pending_req->se_cmd, 1);
> + return;
> +err:
> + if (tmr)
>   kfree(tmr);
> - }
> -
> - scsiback_do_resp_with_sense(NULL, err, 0, pending_req);
> -
> - kmem_cache_free(scsiback_cachep, pending_req);
> + scsiback_do_resp_with_sense(NULL, err, 0, pending_req,
> + pending_req->rqid);
>  }
>  
>  /*
> @@ -653,15 +654,53 @@ out:
>   return entry;
>  }
>  
> -static int prepare_pending_reqs(struct vscsibk_info *info,
> - struct vscsiif_request *ring_req,
> - struct vscsibk_pend *pending_req)
> +static struct vscsibk_pend *scsiback_get_pend_req(struct vscsiif_back_ring 
> *ring,
> + struct v2p_entry *v2p)
> +{
> + struct scsiback_tpg *tpg = v2p->tpg;
> + struct scsiback_nexus *nexus = tpg->tpg_nexus;
> + struct se_session *se_sess = nexus->tvn_se_sess;
> + struct vscsibk_pend *req;
> + int tag, i;
> +
> + tag = percpu_ida_alloc(&se_sess->sess_tag_pool, TASK_RUNNING);
> + if (tag < 0) {
> + pr_err("Unable to obtain tag for vscsiif_request\n");
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + req = &((struct vscsibk_pend *)se_sess->sess_cmd_map)[tag];
> + memset(req, 0, sizeof(*req));
> + req->se_cmd.map_tag = tag;
> +
> + for (i = 0; i < VSCSI_MAX_GRANTS; i++)
> + req->grant_handles[i] = SCSIBACK_INVALID_HANDLE;
> +
> + return req;
> +}
> +
> +static struct vscsibk_pend *prepare_pending_reqs(struct vscsibk_info *info,
> + struct vscsiif_back_ring *ring,
> + struct vscsiif_request *ring_req)
>  {
> + struct vscsibk_pend *pending_req;
>   struct v2p_entry *v2p;
>   struct ids_tuple vir;
>  
> - pending_req->rqid   = ring_req->rqid;
> - pending_req->info   = info;
> + /* request range check from fr

Re: [PATCH-v2 02/12] target: Convert demo-mode only drivers to target_alloc_session

2016-01-26 Thread Juergen Gross
On 25/01/16 09:10, Nicholas A. Bellinger wrote:
> From: Christoph Hellwig 
> 
> Cc: Christoph Hellwig 
> Cc: Hannes Reinecke 
> Cc: Chris Boot 
> Cc: Sebastian Andrzej Siewior 
> Cc: Andrzej Pietrasiewicz 
> Cc: Juergen Gross 
> Signed-off-by: Nicholas Bellinger 
> ---
>  drivers/target/loopback/tcm_loop.c  | 35 +
>  drivers/target/sbp/sbp_target.c | 33 ++--
>  drivers/usb/gadget/function/f_tcm.c | 45 ++--
>  drivers/xen/xen-scsiback.c  | 51 
> ++---
>  4 files changed, 42 insertions(+), 122 deletions(-)

Regarding drivers/xen/xen-scsiback.c:
Acked-by: Juergen Gross 

> 
> diff --git a/drivers/target/loopback/tcm_loop.c 
> b/drivers/target/loopback/tcm_loop.c
> index d41a5c3..0216c75 100644
> --- a/drivers/target/loopback/tcm_loop.c
> +++ b/drivers/target/loopback/tcm_loop.c
> @@ -806,54 +806,33 @@ static int tcm_loop_make_nexus(
>   struct tcm_loop_tpg *tl_tpg,
>   const char *name)
>  {
> - struct se_portal_group *se_tpg;
>   struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
>   struct tcm_loop_nexus *tl_nexus;
> - int ret = -ENOMEM;
>  
>   if (tl_tpg->tl_nexus) {
>   pr_debug("tl_tpg->tl_nexus already exists\n");
>   return -EEXIST;
>   }
> - se_tpg = &tl_tpg->tl_se_tpg;
>  
>   tl_nexus = kzalloc(sizeof(struct tcm_loop_nexus), GFP_KERNEL);
>   if (!tl_nexus) {
>   pr_err("Unable to allocate struct tcm_loop_nexus\n");
>   return -ENOMEM;
>   }
> - /*
> -  * Initialize the struct se_session pointer
> -  */
> - tl_nexus->se_sess = transport_init_session(
> - TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS);
> +
> + tl_nexus->se_sess = target_alloc_session(&tl_tpg->tl_se_tpg, 0, 0,
> + TARGET_PROT_DIN_PASS | 
> TARGET_PROT_DOUT_PASS,
> + name, tl_nexus, NULL);
>   if (IS_ERR(tl_nexus->se_sess)) {
> - ret = PTR_ERR(tl_nexus->se_sess);
> - goto out;
> - }
> - /*
> -  * Since we are running in 'demo mode' this call with generate a
> -  * struct se_node_acl for the tcm_loop struct se_portal_group with the 
> SCSI
> -  * Initiator port name of the passed configfs group 'name'.
> -  */
> - tl_nexus->se_sess->se_node_acl = core_tpg_check_initiator_node_acl(
> - se_tpg, (unsigned char *)name);
> - if (!tl_nexus->se_sess->se_node_acl) {
> - transport_free_session(tl_nexus->se_sess);
> - goto out;
> + kfree(tl_nexus);
> + return PTR_ERR(tl_nexus->se_sess);
>   }
> - /* Now, register the I_T Nexus as active. */
> - transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl,
> - tl_nexus->se_sess, tl_nexus);
> +
>   tl_tpg->tl_nexus = tl_nexus;
>   pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated"
>   " %s Initiator Port: %s\n", tcm_loop_dump_proto_id(tl_hba),
>   name);
>   return 0;
> -
> -out:
> - kfree(tl_nexus);
> - return ret;
>  }
>  
>  static int tcm_loop_drop_nexus(
> diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
> index 3072f1a..ddd3398 100644
> --- a/drivers/target/sbp/sbp_target.c
> +++ b/drivers/target/sbp/sbp_target.c
> @@ -196,45 +196,28 @@ static struct sbp_session *sbp_session_create(
>   struct sbp_session *sess;
>   int ret;
>   char guid_str[17];
> - struct se_node_acl *se_nacl;
> +
> + snprintf(guid_str, sizeof(guid_str), "%016llx", guid);
>  
>   sess = kmalloc(sizeof(*sess), GFP_KERNEL);
>   if (!sess) {
>   pr_err("failed to allocate session descriptor\n");
>   return ERR_PTR(-ENOMEM);
>   }
> + spin_lock_init(&sess->lock);
> + INIT_LIST_HEAD(&sess->login_list);
> + INIT_DELAYED_WORK(&sess->maint_work, session_maintenance_work);
> + sess->guid = guid;
>  
> - sess->se_sess = transport_init_session(TARGET_PROT_NORMAL);
> + sess->se_sess = target_alloc_session(&tpg->se_tpg, 0, 0, 
> TARGET_PROT_NORMAL,
> +  guid_str, sess, NULL);
>   if (IS_ERR(sess->se_sess)) {
>   pr_err("failed to init se_session\n");
> -
>   ret = PTR_ERR(sess->se_sess);
>   kfree(sess);
>   return ERR_PTR(ret);
>   }
>  
> - snprintf(guid_str, sizeof(guid_str), "%016llx", guid);
> -
> - se_nacl = core_tpg_check_initiator_node_acl(&tpg->se_tpg, guid_str);
> - if (!se_nacl) {
> - pr_warn("Node ACL not found for %s\n", guid_str);
> -
> - transport_free_session(sess->se_sess);
> - kfree(sess);
> -
> - return ERR_PTR(-EPERM);
> - }
> -
> - sess->se_sess->se_node_acl = se_nacl;
> -
> - spin_lock_init(&sess

Re: [PATCH-v2 12/12] xen-scsiback: Convert to TARGET_SCF_ACK_KREF I/O krefs

2016-01-26 Thread Juergen Gross
On 25/01/16 09:11, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger 
> 
> Cc: Juergen Gross 
> Cc: Hannes Reinecke 
> Cc: David Vrabel 
> Signed-off-by: Nicholas Bellinger 
> ---
>  drivers/xen/xen-scsiback.c | 53 
> +++---
>  1 file changed, 26 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
> index 640fb22..a10e5f1 100644
> --- a/drivers/xen/xen-scsiback.c
> +++ b/drivers/xen/xen-scsiback.c
> @@ -381,6 +381,12 @@ static void scsiback_cmd_done(struct vscsibk_pend 
> *pending_req)
>   scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req,
>   pending_req->rqid);
>   scsiback_put(info);
> + /*
> +  * Drop the extra KREF_ACK reference taken by 
> target_submit_cmd_map_sgls()
> +  * ahead of scsiback_check_stop_free() ->  transport_generic_free_cmd()
> +  * final se_cmd->cmd_kref put.
> +  */
> + target_put_sess_cmd(&pending_req->se_cmd);
>  }
>  
>  static void scsiback_cmd_exec(struct vscsibk_pend *pending_req)
> @@ -398,7 +404,7 @@ static void scsiback_cmd_exec(struct vscsibk_pend 
> *pending_req)
>   rc = target_submit_cmd_map_sgls(se_cmd, sess, pending_req->cmnd,
>   pending_req->sense_buffer, pending_req->v2p->lun,
>   pending_req->data_len, 0,
> - pending_req->sc_data_direction, 0,
> + pending_req->sc_data_direction, TARGET_SCF_ACK_KREF,
>   pending_req->sgl, pending_req->n_sg,
>   NULL, 0, NULL, 0);
>   if (rc < 0) {
> @@ -587,31 +593,28 @@ static void scsiback_disconnect(struct vscsibk_info 
> *info)
>  static void scsiback_device_action(struct vscsibk_pend *pending_req,
>   enum tcm_tmreq_table act, int tag)
>  {
> - int rc, err = FAILED;
>   struct scsiback_tpg *tpg = pending_req->v2p->tpg;
> + struct scsiback_nexus *nexus = tpg->tpg_nexus;
>   struct se_cmd *se_cmd = &pending_req->se_cmd;
>   struct scsiback_tmr *tmr;
> + u64 unpacked_lun = pending_req->v2p->lun;
> + int rc, err = FAILED;
>  
>   tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL);
> - if (!tmr)
> - goto out;
> + if (!tmr) {
> + target_put_sess_cmd(se_cmd);
> + goto err;

Sure? I think this should still be "goto out;"?

> + }
>  
>   init_waitqueue_head(&tmr->tmr_wait);
>  
> - transport_init_se_cmd(se_cmd, tpg->se_tpg.se_tpg_tfo,
> - tpg->tpg_nexus->tvn_se_sess, 0, DMA_NONE, TCM_SIMPLE_TAG,
> - &pending_req->sense_buffer[0]);
> -
> - rc = core_tmr_alloc_req(se_cmd, tmr, act, GFP_KERNEL);
> - if (rc < 0)
> - goto out;
> -
> - se_cmd->se_tmr_req->ref_task_tag = tag;
> + rc = target_submit_tmr(&pending_req->se_cmd, nexus->tvn_se_sess,
> +&pending_req->sense_buffer[0],
> +unpacked_lun, tmr, act, GFP_KERNEL,
> +tag, TARGET_SCF_ACK_KREF);
> + if (rc)
> + goto err;

Again.


Juergen

>  
> - if (transport_lookup_tmr_lun(se_cmd, pending_req->v2p->lun) < 0)
> - goto out;
> -
> - transport_generic_handle_tmr(se_cmd);
>   wait_event(tmr->tmr_wait, atomic_read(&tmr->tmr_complete));
>  
>   err = (se_cmd->se_tmr_req->response == TMR_FUNCTION_COMPLETE) ?
> @@ -1368,16 +1371,7 @@ static u32 scsiback_tpg_get_inst_index(struct 
> se_portal_group *se_tpg)
>  
>  static int scsiback_check_stop_free(struct se_cmd *se_cmd)
>  {
> - /*
> -  * Do not release struct se_cmd's containing a valid TMR pointer.
> -  * These will be released directly in scsiback_device_action()
> -  * with transport_generic_free_cmd().
> -  */
> - if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)
> - return 0;
> -
> - transport_generic_free_cmd(se_cmd, 0);
> - return 1;
> + return transport_generic_free_cmd(se_cmd, 0);
>  }
>  
>  static void scsiback_release_cmd(struct se_cmd *se_cmd)
> @@ -1385,6 +1379,11 @@ static void scsiback_release_cmd(struct se_cmd *se_cmd)
>   struct se_session *se_sess = se_cmd->se_sess;
>   struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
>  
> + if (se_tmr && se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) {
> + struct scsiback_tmr *tmr = se_tmr->fabric_tmr_ptr;
> + kfree(tmr);
> + }
> +
>   percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
>  }
>  
> 

--
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 03/22] scsi: Fix dependencies for !HAS_IOMEM and !HAS_DMA archs

2016-01-26 Thread John Garry

On 25/01/2016 22:24, Richard Weinberger wrote:

Not every arch has io or DMA memory.
So, unbreak the build by fixing the dependencies.

Signed-off-by: Richard Weinberger 
---
  drivers/scsi/hisi_sas/Kconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig
index 37a0c71..f9157f4 100644
--- a/drivers/scsi/hisi_sas/Kconfig
+++ b/drivers/scsi/hisi_sas/Kconfig
@@ -2,5 +2,6 @@ config SCSI_HISI_SAS
tristate "HiSilicon SAS"
select SCSI_SAS_LIBSAS
select BLK_DEV_INTEGRITY
+   depends on HAS_IOMEM && HAS_DMA
help
This driver supports HiSilicon's SAS HBA



I think that there is already a fix for depencencies from Geert:
http://git.kernel.org/cgit/linux/kernel/git/jejb/scsi.git/log/?h=fixes

Cheers,
John

--
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 03/22] scsi: Fix dependencies for !HAS_IOMEM and !HAS_DMA archs

2016-01-26 Thread Richard Weinberger
Am 26.01.2016 um 11:15 schrieb John Garry:
> On 25/01/2016 22:24, Richard Weinberger wrote:
>> Not every arch has io or DMA memory.
>> So, unbreak the build by fixing the dependencies.
>>
>> Signed-off-by: Richard Weinberger 
>> ---
>>   drivers/scsi/hisi_sas/Kconfig | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig
>> index 37a0c71..f9157f4 100644
>> --- a/drivers/scsi/hisi_sas/Kconfig
>> +++ b/drivers/scsi/hisi_sas/Kconfig
>> @@ -2,5 +2,6 @@ config SCSI_HISI_SAS
>>   tristate "HiSilicon SAS"
>>   select SCSI_SAS_LIBSAS
>>   select BLK_DEV_INTEGRITY
>> +depends on HAS_IOMEM && HAS_DMA
>>   help
>>   This driver supports HiSilicon's SAS HBA
>>
> 
> I think that there is already a fix for depencencies from Geert:
> http://git.kernel.org/cgit/linux/kernel/git/jejb/scsi.git/log/?h=fixes

Hmm, right. But we still need HAS_IOMEM too.

Thanks,
//richard
--
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 03/22] scsi: Fix dependencies for !HAS_IOMEM and !HAS_DMA archs

2016-01-26 Thread John Garry

On 26/01/2016 10:31, Richard Weinberger wrote:

Am 26.01.2016 um 11:15 schrieb John Garry:

On 25/01/2016 22:24, Richard Weinberger wrote:

Not every arch has io or DMA memory.
So, unbreak the build by fixing the dependencies.

Signed-off-by: Richard Weinberger 
---
   drivers/scsi/hisi_sas/Kconfig | 1 +
   1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig
index 37a0c71..f9157f4 100644
--- a/drivers/scsi/hisi_sas/Kconfig
+++ b/drivers/scsi/hisi_sas/Kconfig
@@ -2,5 +2,6 @@ config SCSI_HISI_SAS
   tristate "HiSilicon SAS"
   select SCSI_SAS_LIBSAS
   select BLK_DEV_INTEGRITY
+depends on HAS_IOMEM && HAS_DMA
   help
   This driver supports HiSilicon's SAS HBA



I think that there is already a fix for depencencies from Geert:
http://git.kernel.org/cgit/linux/kernel/git/jejb/scsi.git/log/?h=fixes


Hmm, right. But we still need HAS_IOMEM too.

Thanks,
//richard
--
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



We can just add HAS_IOMEM dependency on the scsi fixes branch, ok?

Cheers,
John

--
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 v4 34/78] atari_NCR5380: Use arbitration timeout

2016-01-26 Thread Geert Uytterhoeven
Hi Finn,

On Tue, Jan 26, 2016 at 1:18 AM, Finn Thain  wrote:
> On Mon, 25 Jan 2016, Geert Uytterhoeven wrote:
>> > In principle I think that Linux drivers should not carry workarounds
>> > for emulators.
>>
>> Please consider ARAnyM is the current m68k workhorse, so it would be
>> nice to handle this someway.
>
> AFAICT atari_scsi on aranym never did anything useful. Those aranym users
> who need to run Linux 4.5 can set CONFIG_ATARI_SCSI=n or blacklist the
> atari_scsi module (up until aranym can be patched).

FTR. adding "initcall_blacklist=atari_scsi_driver_init" to the kernel command
line makes it boot again.

>> Alternatively, we need to fix ARAnyM,
>
> I'll look into writing a patch for the emulator after I've finished
> testing the exception handling fixes for the driver.

Thank you!

>> or can make the creation of the atari_scsi platform device conditional
>> on not running under ARAnyM.
>
> Fixing the emulator is the only sensible approach. If S operating systems
> have to carry workarounds for B emulator bugs, the cost is (at least)
> proportional to S * B.

Sure.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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] hisi_sas: add dependency for HAS_IOMEM

2016-01-26 Thread John Garry
Not every arch has io, so fix build by adding
necessary dependency.

Signed-off-by: John Garry 
Suggested-by: Richard Weinberger 

diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig
index b676618..d1dd161 100644
--- a/drivers/scsi/hisi_sas/Kconfig
+++ b/drivers/scsi/hisi_sas/Kconfig
@@ -1,6 +1,6 @@
 config SCSI_HISI_SAS
tristate "HiSilicon SAS"
-   depends on HAS_DMA
+   depends on HAS_DMA && HAS_IOMEM
depends on ARM64 || COMPILE_TEST
select SCSI_SAS_LIBSAS
select BLK_DEV_INTEGRITY
-- 
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] mptlan: add checks for dma mapping errors

2016-01-26 Thread Tomas Henzl
On 25.1.2016 19:02, Alexey Khoroshilov wrote:
> mpt_lan_sdu_send() and mpt_lan_post_receive_buckets() do not check
> if mapping dma memory succeed.
> The patch adds the checks and failure handling.
>
> v3: Fix resource deallocation (reported by Tomas Henzl).
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov 
> ---
>  drivers/message/fusion/mptlan.c | 16 
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
> index cbe96072a6cc..e9b83fc7be35 100644
> --- a/drivers/message/fusion/mptlan.c
> +++ b/drivers/message/fusion/mptlan.c
> @@ -734,6 +734,13 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device 
> *dev)
>  
>  dma = pci_map_single(mpt_dev->pcidev, skb->data, skb->len,
>PCI_DMA_TODEVICE);
> + if (pci_dma_mapping_error(mpt_dev->pcidev, dma)) {
> + mpt_put_msg_frame(LanCtx, mpt_dev, mf);

I think I was wrong here, the 'mpt_put_msg_frame' is not the correct function
for freeing the mpt request frame, this one actually talks to the hw.

Other than that - previous patch for this driver came in in 2010
 - six years ago and the driver seems unmaintained now.
I'm not sure if we should fix hw we can't test and when there is not
an user bug report. This example nicely shows how easy it is to add new bugs
even when a fix looks trivial.
-tm

> + netif_stop_queue(dev);
> +
> + printk (KERN_ERR "%s: dma mapping failed\n", __func__);
> + return NETDEV_TX_BUSY;
> + }
>  
>   priv->SendCtl[ctx].skb = skb;
>   priv->SendCtl[ctx].dma = dma;
> @@ -1232,6 +1239,15 @@ mpt_lan_post_receive_buckets(struct mpt_lan_priv *priv)
>  
>   dma = pci_map_single(mpt_dev->pcidev, skb->data,
>len, PCI_DMA_FROMDEVICE);
> + if (pci_dma_mapping_error(mpt_dev->pcidev, 
> dma)) {
> + printk (KERN_WARNING
> + MYNAM "/%s: dma mapping 
> failed\n",
> + __func__);
> + dev_kfree_skb(skb);
> + 
> priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx;
> + 
> spin_unlock_irqrestore(&priv->rxfidx_lock, flags);
> + break;
> + }
>  
>   priv->RcvCtl[ctx].skb = skb;
>   priv->RcvCtl[ctx].dma = dma;

--
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-v2 1/3] target: Fix LUN_RESET active I/O handling for ACK_KREF

2016-01-26 Thread Christoph Hellwig
> +static bool __target_check_io_state(struct se_cmd *se_cmd)
> +{
> + struct se_session *sess = se_cmd->se_sess;
> +
> + assert_spin_locked(&se_session->sess_cmd_lock);
> + WARN_ON_ONCE(!irqs_disabled());

Btw, I looked a the code and can't really see what sess_cmd_lock is
supposed to protect here.

> + sess = cmd->se_sess;
> + if (WARN_ON_ONCE(!sess))
> + continue;
> +
> + spin_lock(&sess->sess_cmd_lock);
> + rc = __target_check_io_state(cmd);
> + spin_unlock(&sess->sess_cmd_lock);
> + if (!rc) {
> + printk("LUN_RESET I/O: non-zero 
> kref_get_unless_zero\n");
> + continue;
> + }

And thus why we care about taking it here.
--
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-v2 2/3] target: Fix LUN_RESET active TMR descriptor handling

2016-01-26 Thread Christoph Hellwig
> + sess = cmd->se_sess;
> + if (WARN_ON_ONCE(!sess))
> + continue;
> +
> + spin_lock(&sess->sess_cmd_lock);
>   spin_lock(&cmd->t_state_lock);
>   if (!(cmd->transport_state & CMD_T_ACTIVE)) {
>   spin_unlock(&cmd->t_state_lock);
> + spin_unlock(&sess->sess_cmd_lock);
>   continue;
>   }
>   if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) {
>   spin_unlock(&cmd->t_state_lock);
> + spin_unlock(&sess->sess_cmd_lock);
>   continue;
>   }
> + cmd->transport_state |= CMD_T_ABORTED;
>   spin_unlock(&cmd->t_state_lock);
>  
> + rc = kref_get_unless_zero(&cmd->cmd_kref);
> + spin_unlock(&sess->sess_cmd_lock);

Similar to the previous patch I don't understand the need for
sess_cmd_lock here.

> + spin_lock_irqsave(&cmd->t_state_lock, flags);
> + if (cmd->transport_state & CMD_T_ABORTED) {
> + tmr->response = TMR_FUNCTION_REJECTED;
> + spin_unlock_irqrestore(&cmd->t_state_lock, flags);
> + goto check_stop;
> + }
> + spin_unlock_irqrestore(&cmd->t_state_lock, flags);

Taking a lock for checking a single bit is pointless.
--
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] hisi_sas: fix v1 hw check for slot error

2016-01-26 Thread John Garry
Completion header bit CMPLT_HDR_RSPNS_XFRD flags
whether the response frame is received into host memory,
and not whether the response frame has an error.
As such, change the decision on whether a slot has
an error.
Also redundant check on CMPLT_HDR_CMD_CMPLT_MSK is
removed.

Fixes: 27a3f229 ("hisi_sas: Add cq interrupt handler")

Signed-off-by: John Garry 
Tested-by: Ricardo Salveti 

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c 
b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
index 057fdeb..eea24d7 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
@@ -1289,13 +1289,10 @@ static int slot_complete_v1_hw(struct hisi_hba 
*hisi_hba,
goto out;
}
 
-   if (cmplt_hdr_data & CMPLT_HDR_ERR_RCRD_XFRD_MSK) {
-   if (!(cmplt_hdr_data & CMPLT_HDR_CMD_CMPLT_MSK) ||
-   !(cmplt_hdr_data & CMPLT_HDR_RSPNS_XFRD_MSK))
-   ts->stat = SAS_DATA_OVERRUN;
-   else
-   slot_err_v1_hw(hisi_hba, task, slot);
+   if (cmplt_hdr_data & CMPLT_HDR_ERR_RCRD_XFRD_MSK &&
+   !(cmplt_hdr_data & CMPLT_HDR_RSPNS_XFRD_MSK)) {
 
+   slot_err_v1_hw(hisi_hba, task, slot);
goto out;
}
 
-- 
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-v2 3/3] target: Fix TAS handling for multi-session se_node_acls

2016-01-26 Thread Christoph Hellwig
> - if ((tmr_nacl && (tmr_nacl != cmd->se_sess->se_node_acl)) && tas) {
> + if ((tmr_sess && (tmr_sess != cmd->se_sess)) && tas) {

Care to drop the pointless braces here if you touch this anyway?

if (tmr_sess && tmr_sess != cmd->se_sess && tas)

Otherwise this looks fine to me:

Reviewed-by: Christoph Hellwig 
--
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 06/11] qla2xxx: Add support for Private link statistics counters.

2016-01-26 Thread Himanshu Madhani
From: Harish Zunjarrao 

Signed-off-by: Harish Zunjarrao 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c |6 ++-
 drivers/scsi/qla2xxx/qla_bsg.c  |   61 +++
 drivers/scsi/qla2xxx/qla_bsg.h  |1 +
 drivers/scsi/qla2xxx/qla_dbg.c  |2 +-
 drivers/scsi/qla2xxx/qla_def.h  |   32 +++-
 drivers/scsi/qla2xxx/qla_mbx.c  |3 +-
 6 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fef659a..fadce04 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1917,7 +1917,8 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
if (qla2x00_reset_active(vha))
goto done;
 
-   stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma);
+   stats = dma_alloc_coherent(&ha->pdev->dev,
+   sizeof(struct link_statistics), &stats_dma, GFP_KERNEL);
if (stats == NULL) {
ql_log(ql_log_warn, vha, 0x707d,
"Failed to allocate memory for stats.\n");
@@ -1965,7 +1966,8 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
do_div(pfc_host_stat->seconds_since_last_reset, HZ);
 
 done_free:
-dma_pool_free(ha->s_dma_pool, stats, stats_dma);
+   dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
+   stats, stats_dma);
 done:
return pfc_host_stat;
 }
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index d135d6a..913fef2 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2233,6 +2233,64 @@ qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job)
 }
 
 static int
+qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
+{
+   struct Scsi_Host *host = bsg_job->shost;
+   scsi_qla_host_t *vha = shost_priv(host);
+   struct qla_hw_data *ha = vha->hw;
+   struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
+   struct link_statistics *stats = NULL;
+   dma_addr_t stats_dma;
+   int rval = QLA_FUNCTION_FAILED;
+
+   if (test_bit(UNLOADING, &vha->dpc_flags))
+   goto done;
+
+   if (unlikely(pci_channel_offline(ha->pdev)))
+   goto done;
+
+   if (qla2x00_reset_active(vha))
+   goto done;
+
+   if (!IS_FWI2_CAPABLE(ha))
+   goto done;
+
+   stats = dma_alloc_coherent(&ha->pdev->dev,
+   sizeof(struct link_statistics), &stats_dma, GFP_KERNEL);
+   if (!stats) {
+   ql_log(ql_log_warn, vha, 0x70e2,
+   "Failed to allocate memory for stats.\n");
+   goto done;
+   }
+
+   memset(stats, 0, sizeof(struct link_statistics));
+
+   rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma);
+
+   if (rval != QLA_SUCCESS)
+   goto done_free;
+
+   ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e3,
+   (uint8_t *)stats, sizeof(struct link_statistics));
+
+   sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+   bsg_job->reply_payload.sg_cnt, stats, sizeof(struct link_statistics));
+   bsg_job->reply->reply_payload_rcv_len = sizeof(struct link_statistics);
+
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK;
+
+   bsg_job->reply_len = sizeof(struct fc_bsg_reply);
+   bsg_job->reply->result = DID_OK << 16;
+   bsg_job->job_done(bsg_job);
+
+done_free:
+   dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
+   stats, stats_dma);
+done:
+   return rval;
+}
+
+static int
 qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
 {
switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) {
@@ -2296,6 +2354,9 @@ qla2x00_process_vendor_specific(struct fc_bsg_job 
*bsg_job)
case QL_VND_GET_BBCR_DATA:
return qla27xx_get_bbcr_data(bsg_job);
 
+   case QL_VND_GET_PRIV_STATS:
+   return qla2x00_get_priv_stats(bsg_job);
+
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index 4275177..c40dd8b 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -28,6 +28,7 @@
 #define QL_VND_GET_FLASH_UPDATE_CAPS0x15
 #define QL_VND_SET_FLASH_UPDATE_CAPS0x16
 #define QL_VND_GET_BBCR_DATA0x17
+#define QL_VND_GET_PRIV_STATS  0x18
 
 /* BSG Vendor specific subcode returns */
 #define EXT_STATUS_OK  0
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 493a3ea81..aa6694b 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -32,7 +32,7 @@
  * |  || 0x503d,0x5044  |
  * |  || 0x507b,0x505f |
  * | Timer Routines   |   0x6012   ||
- * | User Spac

[PATCH 03/11] qla2xxx: Allow fw to hold status before sending ABTS response.

2016-01-26 Thread Himanshu Madhani
Set bit 12 of additional firmware options 3 to let firmware
hold status IOCB until ABTS response is received from Target.

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_gbl.h  |1 +
 drivers/scsi/qla2xxx/qla_init.c |   11 ++-
 drivers/scsi/qla2xxx/qla_os.c   |7 +++
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 0103e46..1bfdcdf 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -121,6 +121,7 @@ extern int ql2xmdcapmask;
 extern int ql2xmdenable;
 extern int ql2xexlogins;
 extern int ql2xexchoffld;
+extern int ql2xfwholdabts;
 
 extern int qla2x00_loop_reset(scsi_qla_host_t *);
 extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index a663ff6..cf487b9 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2062,6 +2062,10 @@ qla24xx_update_fw_options(scsi_qla_host_t *vha)
if (IS_P3P_TYPE(ha))
return;
 
+   /*  Hold status IOCBs until ABTS response received. */
+   if (ql2xfwholdabts)
+   ha->fw_options[3] |= BIT_12;
+
/* Update Serial Link options. */
if ((le16_to_cpu(ha->fw_seriallink_options24[0]) & BIT_0) == 0)
return;
@@ -6410,12 +6414,17 @@ qla81xx_update_fw_options(scsi_qla_host_t *vha)
 {
struct qla_hw_data *ha = vha->hw;
 
+   /*  Hold status IOCBs until ABTS response received. */
+   if (ql2xfwholdabts)
+   ha->fw_options[3] |= BIT_12;
+
if (!ql2xetsenable)
-   return;
+   goto out;
 
/* Enable ETS Burst. */
memset(ha->fw_options, 0, sizeof(ha->fw_options));
ha->fw_options[2] |= BIT_9;
+out:
qla2x00_set_fw_options(vha, ha->fw_options);
 }
 
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index f1788db..d94a236 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -233,6 +233,13 @@ MODULE_PARM_DESC(ql2xexchoffld,
 "Number of exchanges to offload. "
 "0 (Default)- Disabled.");
 
+int ql2xfwholdabts = 0;
+module_param(ql2xfwholdabts, int, S_IRUGO);
+MODULE_PARM_DESC(ql2xfwholdabts,
+   "Allow FW to hold status IOCB until ABTS rsp received. "
+   "0 (Default) Do not set fw option. "
+   "1 - Set fw option to hold ABTS.");
+
 /*
  * SCSI host template entry points
  */
-- 
1.7.7

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


[PATCH 11/11] qla2xxx: Update driver version to 8.07.00.33-k

2016-01-26 Thread Himanshu Madhani
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_version.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_version.h 
b/drivers/scsi/qla2xxx/qla_version.h
index 6d31faa..0bc93fa 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION  "8.07.00.26-k"
+#define QLA2XXX_VERSION  "8.07.00.33-k"
 
 #define QLA_DRIVER_MAJOR_VER   8
 #define QLA_DRIVER_MINOR_VER   7
-- 
1.7.7

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


[PATCH 05/11] qla2xxx: Add support for buffer to buffer credit value for ISP27XX.

2016-01-26 Thread Himanshu Madhani
From: Sawan Chandak 

Signed-off-by: Sawan Chandak 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_bsg.c |   55 
 drivers/scsi/qla2xxx/qla_bsg.h |   24 +
 drivers/scsi/qla2xxx/qla_def.h |2 +
 drivers/scsi/qla2xxx/qla_fw.h  |4 ++-
 drivers/scsi/qla2xxx/qla_mbx.c |8 ++
 5 files changed, 92 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 64fe17a..d135d6a 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2181,6 +2181,58 @@ qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job)
 }
 
 static int
+qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job)
+{
+   struct Scsi_Host *host = bsg_job->shost;
+   scsi_qla_host_t *vha = shost_priv(host);
+   struct qla_hw_data *ha = vha->hw;
+   struct qla_bbcr_data bbcr;
+   uint16_t loop_id, topo, sw_cap;
+   uint8_t domain, area, al_pa, state;
+   int rval;
+
+   if (!(IS_QLA27XX(ha)))
+   return -EPERM;
+
+   memset(&bbcr, 0, sizeof(bbcr));
+
+   if (vha->flags.bbcr_enable)
+   bbcr.status = QLA_BBCR_STATUS_ENABLED;
+   else
+   bbcr.status = QLA_BBCR_STATUS_DISABLED;
+
+   if (bbcr.status == QLA_BBCR_STATUS_ENABLED) {
+   rval = qla2x00_get_adapter_id(vha, &loop_id, &al_pa,
+   &area, &domain, &topo, &sw_cap);
+   if (rval != QLA_SUCCESS)
+   return -EIO;
+
+   state = (vha->bbcr >> 12) & 0x1;
+
+   if (state) {
+   bbcr.state = QLA_BBCR_STATE_OFFLINE;
+   bbcr.offline_reason_code = QLA_BBCR_REASON_LOGIN_REJECT;
+   } else {
+   bbcr.state = QLA_BBCR_STATE_ONLINE;
+   bbcr.negotiated_bbscn = (vha->bbcr >> 8) & 0xf;
+   }
+
+   bbcr.configured_bbscn = vha->bbcr & 0xf;
+   }
+
+   sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+   bsg_job->reply_payload.sg_cnt, &bbcr, sizeof(bbcr));
+   bsg_job->reply->reply_payload_rcv_len = sizeof(bbcr);
+
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK;
+
+   bsg_job->reply_len = sizeof(struct fc_bsg_reply);
+   bsg_job->reply->result = DID_OK << 16;
+   bsg_job->job_done(bsg_job);
+   return 0;
+}
+
+static int
 qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
 {
switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) {
@@ -2241,6 +2293,9 @@ qla2x00_process_vendor_specific(struct fc_bsg_job 
*bsg_job)
case QL_VND_SET_FLASH_UPDATE_CAPS:
return qla27xx_set_flash_upd_cap(bsg_job);
 
+   case QL_VND_GET_BBCR_DATA:
+   return qla27xx_get_bbcr_data(bsg_job);
+
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index 6c45bf4..4275177 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -27,6 +27,7 @@
 #defineQL_VND_SERDES_OP_EX 0x14
 #define QL_VND_GET_FLASH_UPDATE_CAPS0x15
 #define QL_VND_SET_FLASH_UPDATE_CAPS0x16
+#define QL_VND_GET_BBCR_DATA0x17
 
 /* BSG Vendor specific subcode returns */
 #define EXT_STATUS_OK  0
@@ -239,4 +240,27 @@ struct qla_flash_update_caps {
uint32_t  outage_duration;
uint8_t   reserved[20];
 } __packed;
+
+/* BB_CR Status */
+#define QLA_BBCR_STATUS_DISABLED   0
+#define QLA_BBCR_STATUS_ENABLED1
+
+/* BB_CR State */
+#define QLA_BBCR_STATE_OFFLINE 0
+#define QLA_BBCR_STATE_ONLINE  1
+
+/* BB_CR Offline Reason Code */
+#define QLA_BBCR_REASON_PORT_SPEED 1
+#define QLA_BBCR_REASON_PEER_PORT  2
+#define QLA_BBCR_REASON_SWITCH 3
+#define QLA_BBCR_REASON_LOGIN_REJECT   4
+
+struct  qla_bbcr_data {
+   uint8_t   status; /* 1 - enabled, 0 - Disabled */
+   uint8_t   state;  /* 1 - online, 0 - offline */
+   uint8_t   configured_bbscn;   /* 0-15 */
+   uint8_t   negotiated_bbscn;   /* 0-15 */
+   uint8_t   offline_reason_code;
+   uint8_t   reserved[11];
+} __packed;
 #endif
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 987480f..c4bd62a 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3583,6 +3583,7 @@ typedef struct scsi_qla_host {
uint32_tdelete_progress:1;
 
uint32_tfw_tgt_reported:1;
+   uint32_tbbcr_enable:1;
} flags;
 
atomic_tloop_state;
@@ -3715,6 +3716,7 @@ typedef struct scsi_qla_host {
atomic_tvref_count;
struct qla8044_reset_template reset_tmplt;
struct qla_tgt_counters tgt_counters;
+   uint16_tbbcr;
 } scsi_qla_host_t;
 
 struct qla27xx_image_sta

[PATCH 01/11] qla2xxx: Remove unneeded link offline message.

2016-01-26 Thread Himanshu Madhani
From: Chad Dupuis 

Signed-off-by: Chad Dupuis 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c |1 +
 drivers/scsi/qla2xxx/qla_isr.c |4 
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index cd0d94e..9e714cc 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -27,6 +27,7 @@
  * |  || 0x303a
|
  * | DPC Thread   |   0x4023   | 0x4002,0x4013  |
  * | Async Events |   0x5089   | 0x502b-0x502f  |
+ * |  || 0x505e |
  * |  || 0x5084,0x5075 |
  * |  || 0x503d,0x5044  |
  * |  || 0x507b,0x505f |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index d4d65eb..edd97de 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -934,10 +934,6 @@ skip_rio:
break;
 
 global_port_update:
-   /* Port unavailable. */
-   ql_log(ql_log_warn, vha, 0x505e,
-   "Link is offline.\n");
-
if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
atomic_set(&vha->loop_state, LOOP_DOWN);
atomic_set(&vha->loop_down_timer,
-- 
1.7.7

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


[PATCH 02/11] qla2xxx: Seed init-cb login timeout from nvram exclusively.

2016-01-26 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 52a8765..a663ff6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2844,7 +2844,6 @@ qla2x00_nvram_config(scsi_qla_host_t *vha)
if (nv->login_timeout < 4)
nv->login_timeout = 4;
ha->login_timeout = nv->login_timeout;
-   icb->login_timeout = nv->login_timeout;
 
/* Set minimum RATOV to 100 tenths of a second. */
ha->r_a_tov = 100;
@@ -5274,7 +5273,6 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
if (le16_to_cpu(nv->login_timeout) < 4)
nv->login_timeout = cpu_to_le16(4);
ha->login_timeout = le16_to_cpu(nv->login_timeout);
-   icb->login_timeout = nv->login_timeout;
 
/* Set minimum RATOV to 100 tenths of a second. */
ha->r_a_tov = 100;
@@ -6231,7 +6229,6 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
if (le16_to_cpu(nv->login_timeout) < 4)
nv->login_timeout = cpu_to_le16(4);
ha->login_timeout = le16_to_cpu(nv->login_timeout);
-   icb->login_timeout = nv->login_timeout;
 
/* Set minimum RATOV to 100 tenths of a second. */
ha->r_a_tov = 100;
-- 
1.7.7

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


[PATCH 04/11] qla2xxx: Add support for online flash update for ISP27XX.

2016-01-26 Thread Himanshu Madhani
From: Sawan Chandak 

Signed-off-by: Sawan Chandak 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c |   12 -
 drivers/scsi/qla2xxx/qla_bsg.c  |   80 ++
 drivers/scsi/qla2xxx/qla_bsg.h  |7 +++
 drivers/scsi/qla2xxx/qla_dbg.c  |2 +-
 drivers/scsi/qla2xxx/qla_def.h  |   22 +
 drivers/scsi/qla2xxx/qla_fw.h   |   10 
 drivers/scsi/qla2xxx/qla_gbl.h  |1 +
 drivers/scsi/qla2xxx/qla_init.c |   91 +++
 drivers/scsi/qla2xxx/qla_sup.c  |   47 +++-
 9 files changed, 266 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 6992ebc..fef659a 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -562,6 +562,7 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject 
*kobj,
struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
struct qla_hw_data *ha = vha->hw;
+   uint32_t faddr;
 
if (unlikely(pci_channel_offline(ha->pdev)))
return -EAGAIN;
@@ -569,9 +570,16 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject 
*kobj,
if (!capable(CAP_SYS_ADMIN))
return -EINVAL;
 
-   if (IS_NOCACHE_VPD_TYPE(ha))
-   ha->isp_ops->read_optrom(vha, ha->vpd, ha->flt_region_vpd << 2,
+   if (IS_NOCACHE_VPD_TYPE(ha)) {
+   faddr = ha->flt_region_vpd << 2;
+
+   if (IS_QLA27XX(ha) &&
+   qla27xx_find_valid_image(vha) == QLA27XX_SECONDARY_IMAGE)
+   faddr = ha->flt_region_vpd_sec << 2;
+
+   ha->isp_ops->read_optrom(vha, ha->vpd, faddr,
ha->vpd_size);
+   }
return memory_read_from_buffer(buf, count, &off, ha->vpd, ha->vpd_size);
 }
 
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index c26acde..64fe17a 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2107,6 +2107,80 @@ qla8044_serdes_op(struct fc_bsg_job *bsg_job)
 }
 
 static int
+qla27xx_get_flash_upd_cap(struct fc_bsg_job *bsg_job)
+{
+   struct Scsi_Host *host = bsg_job->shost;
+   scsi_qla_host_t *vha = shost_priv(host);
+   struct qla_hw_data *ha = vha->hw;
+   struct qla_flash_update_caps cap;
+
+   if (!(IS_QLA27XX(ha)))
+   return -EPERM;
+
+   memset(&cap, 0, sizeof(cap));
+   cap.capabilities = (uint64_t)ha->fw_attributes_ext[1] << 48 |
+  (uint64_t)ha->fw_attributes_ext[0] << 32 |
+  (uint64_t)ha->fw_attributes_h << 16 |
+  (uint64_t)ha->fw_attributes;
+
+   sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+   bsg_job->reply_payload.sg_cnt, &cap, sizeof(cap));
+   bsg_job->reply->reply_payload_rcv_len = sizeof(cap);
+
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
+   EXT_STATUS_OK;
+
+   bsg_job->reply_len = sizeof(struct fc_bsg_reply);
+   bsg_job->reply->result = DID_OK << 16;
+   bsg_job->job_done(bsg_job);
+   return 0;
+}
+
+static int
+qla27xx_set_flash_upd_cap(struct fc_bsg_job *bsg_job)
+{
+   struct Scsi_Host *host = bsg_job->shost;
+   scsi_qla_host_t *vha = shost_priv(host);
+   struct qla_hw_data *ha = vha->hw;
+   uint64_t online_fw_attr = 0;
+   struct qla_flash_update_caps cap;
+
+   if (!(IS_QLA27XX(ha)))
+   return -EPERM;
+
+   memset(&cap, 0, sizeof(cap));
+   sg_copy_to_buffer(bsg_job->request_payload.sg_list,
+   bsg_job->request_payload.sg_cnt, &cap, sizeof(cap));
+
+   online_fw_attr = (uint64_t)ha->fw_attributes_ext[1] << 48 |
+(uint64_t)ha->fw_attributes_ext[0] << 32 |
+(uint64_t)ha->fw_attributes_h << 16 |
+(uint64_t)ha->fw_attributes;
+
+   if (online_fw_attr != cap.capabilities) {
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
+   EXT_STATUS_INVALID_PARAM;
+   return -EINVAL;
+   }
+
+   if (cap.outage_duration < MAX_LOOP_TIMEOUT)  {
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
+   EXT_STATUS_INVALID_PARAM;
+   return -EINVAL;
+   }
+
+   bsg_job->reply->reply_payload_rcv_len = 0;
+
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
+   EXT_STATUS_OK;
+
+   bsg_job->reply_len = sizeof(struct fc_bsg_reply);
+   bsg_job->reply->result = DID_OK << 16;
+   bsg_job->job_done(bsg_job);
+   return 0;
+}
+
+static int
 qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
 {
switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) {
@@ -2161,6 +2235,12 @@ qla2x00_process_vendor_specific(struct fc_bsg_job 
*bsg_job)
case QL_VND_SERDES_OP_EX:
  

[PATCH 07/11] qla2xxx: Avoid side effects when using endianizer macros.

2016-01-26 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c   |4 +-
 drivers/scsi/qla2xxx/qla_dbg.c|  141 -
 drivers/scsi/qla2xxx/qla_init.c   |   16 ++--
 drivers/scsi/qla2xxx/qla_inline.h |4 +-
 drivers/scsi/qla2xxx/qla_mbx.c|   16 ++--
 drivers/scsi/qla2xxx/qla_sup.c|   23 +++---
 6 files changed, 106 insertions(+), 98 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fadce04..4dc06a13 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -272,8 +272,8 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject 
*kobj,
 
iter = (uint32_t *)buf;
chksum = 0;
-   for (cnt = 0; cnt < ((count >> 2) - 1); cnt++)
-   chksum += le32_to_cpu(*iter++);
+   for (cnt = 0; cnt < ((count >> 2) - 1); cnt++, iter++)
+   chksum += le32_to_cpu(*iter);
chksum = ~chksum + 1;
*iter = cpu_to_le32(chksum);
} else {
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index aa6694b..79782c7 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -294,8 +294,8 @@ qla24xx_read_window(struct device_reg_24xx __iomem *reg, 
uint32_t iobase,
 
WRT_REG_DWORD(®->iobase_addr, iobase);
dmp_reg = ®->iobase_window;
-   while (count--)
-   *buf++ = htonl(RD_REG_DWORD(dmp_reg++));
+   for ( ; count--; dmp_reg++)
+   *buf++ = htonl(RD_REG_DWORD(dmp_reg));
 
return buf;
 }
@@ -457,8 +457,8 @@ qla2xxx_read_window(struct device_reg_2xxx __iomem *reg, 
uint32_t count,
 {
uint16_t __iomem *dmp_reg = ®->u.isp2300.fb_cmd;
 
-   while (count--)
-   *buf++ = htons(RD_REG_WORD(dmp_reg++));
+   for ( ; count--; dmp_reg++)
+   *buf++ = htons(RD_REG_WORD(dmp_reg));
 }
 
 static inline void *
@@ -733,16 +733,18 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
if (rval == QLA_SUCCESS) {
dmp_reg = ®->flash_address;
-   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++, dmp_reg++)
+   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
dmp_reg = ®->u.isp2300.req_q_in;
-   for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2; cnt++)
-   fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2;
+   cnt++, dmp_reg++)
+   fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
dmp_reg = ®->u.isp2300.mailbox0;
-   for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
-   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2;
+   cnt++, dmp_reg++)
+   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
WRT_REG_WORD(®->ctrl_status, 0x40);
qla2xxx_read_window(reg, 32, fw->resp_dma_reg);
@@ -752,8 +754,9 @@ qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
WRT_REG_WORD(®->ctrl_status, 0x00);
dmp_reg = ®->risc_hw;
-   for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
-   fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2;
+   cnt++, dmp_reg++)
+   fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
WRT_REG_WORD(®->pcr, 0x2000);
qla2xxx_read_window(reg, 16, fw->risc_gp0_reg);
@@ -896,25 +899,25 @@ qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
}
if (rval == QLA_SUCCESS) {
dmp_reg = ®->flash_address;
-   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
-   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++, dmp_reg++)
+   fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
 
dmp_reg = ®->u.isp2100.mailbox0;
-   for (cnt = 0; cnt < ha->mbx_count; cnt++) {
+   for (cnt = 0; cnt < ha->mbx_count; cnt++, dmp_reg++) {
if (cnt == 8)
dmp_reg = ®->u_end.isp2200.mailbox8;
 
-   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
+   fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg));
}
 
dmp_reg = ®->u.isp2100.unused_2[0];

[PATCH 08/11] qla2xxx: Provide mbx info in BBCR data after mbx failure

2016-01-26 Thread Himanshu Madhani
From: Harish Zunjarrao 

Signed-off-by: Harish Zunjarrao 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_bsg.c |9 +++--
 drivers/scsi/qla2xxx/qla_bsg.h |4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 913fef2..392c147 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2204,8 +2204,12 @@ qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job)
if (bbcr.status == QLA_BBCR_STATUS_ENABLED) {
rval = qla2x00_get_adapter_id(vha, &loop_id, &al_pa,
&area, &domain, &topo, &sw_cap);
-   if (rval != QLA_SUCCESS)
-   return -EIO;
+   if (rval != QLA_SUCCESS) {
+   bbcr.status = QLA_BBCR_STATUS_UNKNOWN;
+   bbcr.state = QLA_BBCR_STATE_OFFLINE;
+   bbcr.mbx1 = loop_id;
+   goto done;
+   }
 
state = (vha->bbcr >> 12) & 0x1;
 
@@ -2220,6 +2224,7 @@ qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job)
bbcr.configured_bbscn = vha->bbcr & 0xf;
}
 
+done:
sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
bsg_job->reply_payload.sg_cnt, &bbcr, sizeof(bbcr));
bsg_job->reply->reply_payload_rcv_len = sizeof(bbcr);
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index c40dd8b..c80192d 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -245,6 +245,7 @@ struct qla_flash_update_caps {
 /* BB_CR Status */
 #define QLA_BBCR_STATUS_DISABLED   0
 #define QLA_BBCR_STATUS_ENABLED1
+#define QLA_BBCR_STATUS_UNKNOWN2
 
 /* BB_CR State */
 #define QLA_BBCR_STATE_OFFLINE 0
@@ -262,6 +263,7 @@ struct  qla_bbcr_data {
uint8_t   configured_bbscn;   /* 0-15 */
uint8_t   negotiated_bbscn;   /* 0-15 */
uint8_t   offline_reason_code;
-   uint8_t   reserved[11];
+   uint16_t  mbx1; /* Port state */
+   uint8_t   reserved[9];
 } __packed;
 #endif
-- 
1.7.7

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


[PATCH 10/11] qla2xxx: Set relogin flag when we fail to queue login requests.

2016-01-26 Thread Himanshu Madhani
From: Chad Dupuis 

If we fail to queue an srb for an async login we should set the
relogin flag so it will be retried as the reason for the queuing
failure was most likely transient.  Failure to do this can lead to
failed paths as login is never retried if the relogin flag is not
set.

Signed-off-by: Chad Dupuis 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 8001c89..184b6b6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -157,8 +157,12 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t 
*fcport,
if (data[1] & QLA_LOGIO_LOGIN_RETRIED)
lio->u.logio.flags |= SRB_LOGIN_RETRIED;
rval = qla2x00_start_sp(sp);
-   if (rval != QLA_SUCCESS)
+   if (rval != QLA_SUCCESS) {
+   fcport->flags &= ~FCF_ASYNC_SENT;
+   fcport->flags |= FCF_LOGIN_NEEDED;
+   set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
goto done_free_sp;
+   }
 
ql_dbg(ql_dbg_disc, vha, 0x2072,
"Async-login - hdl=%x, loopid=%x portid=%02x%02x%02x "
-- 
1.7.7

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


[PATCH 09/11] qla2xxx: Enable T10-DIF for ISP27XX

2016-01-26 Thread Himanshu Madhani
Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_os.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d94a236..fa017e9 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2217,6 +2217,7 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
ha->device_type |= DT_ZIO_SUPPORTED;
ha->device_type |= DT_FWI2;
ha->device_type |= DT_IIDMA;
+   ha->device_type |= DT_T10_PI;
ha->fw_srisc_address = RISC_START_ADDRESS_2400;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2271:
@@ -2224,6 +2225,7 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
ha->device_type |= DT_ZIO_SUPPORTED;
ha->device_type |= DT_FWI2;
ha->device_type |= DT_IIDMA;
+   ha->device_type |= DT_T10_PI;
ha->fw_srisc_address = RISC_START_ADDRESS_2400;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2261:
@@ -2231,6 +2233,7 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
ha->device_type |= DT_ZIO_SUPPORTED;
ha->device_type |= DT_FWI2;
ha->device_type |= DT_IIDMA;
+   ha->device_type |= DT_T10_PI;
ha->fw_srisc_address = RISC_START_ADDRESS_2400;
break;
}
-- 
1.7.7

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


[PATCH 00/11] qla2xxx: Patches for scsi "misc" branch.

2016-01-26 Thread Himanshu Madhani
Hi James, Martin,

Please apply following patches to the scsi tree, misc branch at your earliest
convenience. 

Thanks,
- Himanshu

Chad Dupuis (2):
  qla2xxx: Remove unneeded link offline message.
  qla2xxx: Set relogin flag when we fail to queue login requests.

Harish Zunjarrao (2):
  qla2xxx: Add support for Private link statistics counters.
  qla2xxx: Provide mbx info in BBCR data after mbx failure

Himanshu Madhani (3):
  qla2xxx: Allow fw to hold status before sending ABTS response.
  qla2xxx: Enable T10-DIF for ISP27XX
  qla2xxx: Update driver version to 8.07.00.33-k

Joe Carnuccio (2):
  qla2xxx: Seed init-cb login timeout from nvram exclusively.
  qla2xxx: Avoid side effects when using endianizer macros.

Sawan Chandak (2):
  qla2xxx: Add support for online flash update for ISP27XX.
  qla2xxx: Add support for buffer to buffer credit value for ISP27XX.

 drivers/scsi/qla2xxx/qla_attr.c|   22 +++-
 drivers/scsi/qla2xxx/qla_bsg.c |  201 
 drivers/scsi/qla2xxx/qla_bsg.h |   34 ++
 drivers/scsi/qla2xxx/qla_dbg.c |  146 ++
 drivers/scsi/qla2xxx/qla_def.h |   56 ++-
 drivers/scsi/qla2xxx/qla_fw.h  |   14 +++-
 drivers/scsi/qla2xxx/qla_gbl.h |2 +
 drivers/scsi/qla2xxx/qla_init.c|  119 --
 drivers/scsi/qla2xxx/qla_inline.h  |4 +-
 drivers/scsi/qla2xxx/qla_isr.c |4 -
 drivers/scsi/qla2xxx/qla_mbx.c |   27 +++--
 drivers/scsi/qla2xxx/qla_os.c  |   10 ++
 drivers/scsi/qla2xxx/qla_sup.c |   70 ++---
 drivers/scsi/qla2xxx/qla_version.h |2 +-
 14 files changed, 594 insertions(+), 117 deletions(-)

-- 
1.7.7

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


Re: [PATCH 07/11] qla2xxx: Avoid side effects when using endianizer macros.

2016-01-26 Thread kbuild test robot
Hi Joe,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Remove-unneeded-link-offline-message/20160127-015650
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/big_endian.h:4:0,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   drivers/scsi/qla2xxx/qla_mbx.c: In function 'qla2x00_get_link_status':
>> include/uapi/linux/byteorder/big_endian.h:94:27: warning: passing argument 1 
>> of '__swab32s' makes pointer from integer without a cast
#define __le32_to_cpus(x) __swab32s((x))
  ^
>> include/linux/byteorder/generic.h:112:22: note: in expansion of macro 
>> '__le32_to_cpus'
#define le32_to_cpus __le32_to_cpus
 ^
>> drivers/scsi/qla2xxx/qla_mbx.c:2806:5: note: in expansion of macro 
>> 'le32_to_cpus'
le32_to_cpus(*iter);
^
   In file included from include/linux/swab.h:4:0,
from include/uapi/linux/byteorder/big_endian.h:12,
from include/linux/byteorder/big_endian.h:4,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   include/uapi/linux/swab.h:235:20: note: expected '__u32 *' but argument is 
of type 'uint32_t'
static inline void __swab32s(__u32 *p)
   ^
   In file included from include/linux/byteorder/big_endian.h:4:0,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   drivers/scsi/qla2xxx/qla_mbx.c: In function 'qla24xx_get_isp_stats':
>> include/uapi/linux/byteorder/big_endian.h:94:27: warning: passing argument 1 
>> of '__swab32s' makes pointer from integer without a cast
#define __le32_to_cpus(x) __swab32s((x))
  ^
>> include/linux/byteorder/generic.h:112:22: note: in expansion of macro 
>> '__le32_to_cpus'
#define le32_to_cpus __le32_to_cpus
 ^
   drivers/scsi/qla2xxx/qla_mbx.c:2854:5: note: in expansion of macro 
'le32_to_cpus'
le32_to_cpus(*iter);
^
   In file included from include/linux/swab.h:4:0,
from include/uapi/linux/byteorder/big_endian.h:12,
from include/linux/byteorder/big_endian.h:4,
from arch/xtensa/include/uapi/asm/byteorder.h:7,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from drivers/scsi/qla2xxx/qla_def.h:10,
from drivers/scsi/qla2xxx/qla_mbx.c:7:
   include/uapi/linux/swab.h:235:20: note: expected '__u32 *' but argument is 
of type 'uint32_t'
static inline void __swab32s(__u32 *p)
   ^

vim +/le32_to_cpus +2806 drivers/scsi/qla2xxx/qla_mbx.c

  2790  mcp->flags = IOCTL_CMD;
  2791  rval = qla2x00_mailbox_command(vha, mcp);
  2792  
  2793  if (rval == QLA_SUCCESS) {
  2794  if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
  2795  ql_dbg(ql_dbg_mbx, vha, 0x1085,
  2796  "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
  2797  rval = QLA_FUNCTION_FAILED;
  2798  } else {
  2799  /* Copy over data -- firmware data is LE. */
  2800  ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1086,
  2801  "Done %s.\n", __func__);
  2802  dwords = offsetof(struct link_statistics,
  2803 

Re: [PATCH 07/11] qla2xxx: Avoid side effects when using endianizer macros.

2016-01-26 Thread kbuild test robot
Hi Joe,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Remove-unneeded-link-offline-message/20160127-015650
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_dbg.c: In function 'qla25xx_fw_dump':
>> drivers/scsi/qla2xxx/qla_dbg.c:1426:56: warning: right-hand operand of comma 
>> expression has no effect [-Wunused-value]
 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg)
   ^

vim +1426 drivers/scsi/qla2xxx/qla_dbg.c

  1410  
  1411  WRT_REG_DWORD(®->iobase_select, 0xB080);
  1412  fw->shadow_reg[8] = htonl(RD_REG_DWORD(®->iobase_sdata));
  1413  
  1414  WRT_REG_DWORD(®->iobase_select, 0xB090);
  1415  fw->shadow_reg[9] = htonl(RD_REG_DWORD(®->iobase_sdata));
  1416  
  1417  WRT_REG_DWORD(®->iobase_select, 0xB0A0);
  1418  fw->shadow_reg[10] = htonl(RD_REG_DWORD(®->iobase_sdata));
  1419  
  1420  /* RISC I/O register. */
  1421  WRT_REG_DWORD(®->iobase_addr, 0x0010);
  1422  fw->risc_io_reg = htonl(RD_REG_DWORD(®->iobase_window));
  1423  
  1424  /* Mailbox registers. */
  1425  mbx_reg = ®->mailbox0;
> 1426  for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg)
  1427  fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg));
  1428  
  1429  /* Transfer sequence registers. */
  1430  iter_reg = fw->xseq_gp_reg;
  1431  iter_reg = qla24xx_read_window(reg, 0xBF00, 16, iter_reg);
  1432  iter_reg = qla24xx_read_window(reg, 0xBF10, 16, iter_reg);
  1433  iter_reg = qla24xx_read_window(reg, 0xBF20, 16, iter_reg);
  1434  iter_reg = qla24xx_read_window(reg, 0xBF30, 16, iter_reg);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: mm: VM_BUG_ON_PAGE(PageTail(page)) in mbind

2016-01-26 Thread Kirill A. Shutemov
On Tue, Jan 26, 2016 at 01:52:31PM +0100, Dmitry Vyukov wrote:
> Hello,
> 
> The following program triggers the following bug:
> 
> page:eab82240 count:0 mapcount:1 mapping:dead
> index:0x0 compound_mapcount: 0
> flags: 0x1fffc00()
> page dumped because: VM_BUG_ON_PAGE(PageTail(page))
> [ cut here ]
> kernel BUG at mm/vmscan.c:1446!
> invalid opcode:  [#1] SMP DEBUG_PAGEALLOC KASAN
> Modules linked in:
> CPU: 1 PID: 6868 Comm: a.out Not tainted 4.5.0-rc1+ #287
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> task: 88003e24af80 ti: 88002e808000 task.ti: 88002e808000
> RIP: 0010:[]  []
> isolate_lru_page+0x4ea/0x6d0
> RSP: 0018:88002e80fa50  EFLAGS: 00010282
> RAX: 88003e24af80 RBX: eab82240 RCX: 
> RDX:  RSI: 0001 RDI: eab82278
> RBP: 88002e80fa88 R08: 0001 R09: 
> R10: 88003e24af80 R11: 0001 R12: eab82260
> R13: eab82200 R14: eab82201 R15: 20004000
> FS:  00c1f880(0063) GS:88003ed0() knlGS:
> CS:  0010 DS:  ES:  CR0: 8005003b
> CR2: 20005ff8 CR3: 2e324000 CR4: 06e0
> Stack:
>  dc00 816f5e89 88003124b010 20002000
>  dc00 eab82240 20004000 88002e80fb10
>  817612bd ea01 88002e80fc70 88002e80fde8
> Call Trace:
>  [< inline >] migrate_page_add mm/mempolicy.c:966
>  [] queue_pages_pte_range+0x4ad/0x10b0 mm/mempolicy.c:552
>  [< inline >] walk_pmd_range mm/pagewalk.c:50
>  [< inline >] walk_pud_range mm/pagewalk.c:90
>  [< inline >] walk_pgd_range mm/pagewalk.c:116
>  [] __walk_page_range+0x653/0xcd0 mm/pagewalk.c:204
>  [] walk_page_range+0x134/0x300 mm/pagewalk.c:281
>  [] queue_pages_range+0xfb/0x130 mm/mempolicy.c:687
>  [] do_mbind+0x2c1/0xdc0 mm/mempolicy.c:1239
>  [< inline >] SYSC_mbind mm/mempolicy.c:1351
>  [] SyS_mbind+0x13d/0x150 mm/mempolicy.c:1333
>  [] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185
> Code: 89 df e8 aa 64 04 00 0f 0b e8 63 6d ed ff 4d 8d 6e ff e9 73 fb
> ff ff e8 55 6d ed ff 48 c7 c6 60 7b 5b 86 48 89 df e8 86 64 04 00 <0f>
> 0b e8 3f 6d ed ff 4d 8d 6e ff e9 eb fb ff ff c7 45 d0 f0 ff
> RIP  [] isolate_lru_page+0x4ea/0x6d0 mm/vmscan.c:1446
>  RSP 
> ---[ end trace 310d844ac0b69c5b ]---
> BUG: sleeping function called from invalid context at 
> include/linux/sched.h:2805
> in_atomic(): 1, irqs_disabled(): 0, pid: 6868, name: a.out
> INFO: lockdep is turned off.
> CPU: 1 PID: 6868 Comm: a.out Tainted: G  D 4.5.0-rc1+ #287
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>   88002e80f548 829f9d0d 88003e24af80
>  1ad4  88002e80f570 813cba2b
>  88003e24af80 865527a0 0af5 88002e80f5b0
> Call Trace:
>  [< inline >] __dump_stack lib/dump_stack.c:15
>  [] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
>  [] ___might_sleep+0x27b/0x3a0 kernel/sched/core.c:7703
>  [] __might_sleep+0x90/0x1a0 kernel/sched/core.c:7665
>  [< inline >] threadgroup_change_begin include/linux/sched.h:2805
>  [] exit_signals+0x81/0x430 kernel/signal.c:2392
>  [] do_exit+0x23c/0x2cb0 kernel/exit.c:701
>  [] oops_end+0x9f/0xd0 arch/x86/kernel/dumpstack.c:250
>  [] die+0x46/0x60 arch/x86/kernel/dumpstack.c:316
>  [< inline >] do_trap_no_signal arch/x86/kernel/traps.c:205
>  [] do_trap+0x18f/0x380 arch/x86/kernel/traps.c:251
>  [] do_error_trap+0x11e/0x280 arch/x86/kernel/traps.c:290
>  [] do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:303
>  [] invalid_op+0x1e/0x30 arch/x86/entry/entry_64.S:830
>  [< inline >] migrate_page_add mm/mempolicy.c:966
>  [] queue_pages_pte_range+0x4ad/0x10b0 mm/mempolicy.c:552
>  [< inline >] walk_pmd_range mm/pagewalk.c:50
>  [< inline >] walk_pud_range mm/pagewalk.c:90
>  [< inline >] walk_pgd_range mm/pagewalk.c:116
>  [] __walk_page_range+0x653/0xcd0 mm/pagewalk.c:204
>  [] walk_page_range+0x134/0x300 mm/pagewalk.c:281
>  [] queue_pages_range+0xfb/0x130 mm/mempolicy.c:687
>  [] do_mbind+0x2c1/0xdc0 mm/mempolicy.c:1239
>  [< inline >] SYSC_mbind mm/mempolicy.c:1351
>  [] SyS_mbind+0x13d/0x150 mm/mempolicy.c:1333
>  [] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185
> note: a.out[6868] exited with preempt_count 1
> 
> 
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> 
> #ifndef SYS_mlock2
> #define SYS_mlock2 325
> #endif
> 
> int main()
> {
>   long r[8];
>   memset(r, -1, sizeof(r));
>   r[0] = syscall(SYS_mmap, 0x2000ul, 0x1000ul, 0x3ul, 0x32ul,
>  0xul, 0x0ul);
>   memcpy

Re: mm: VM_BUG_ON_PAGE(PageTail(page)) in mbind

2016-01-26 Thread Andrew Morton
On Tue, 26 Jan 2016 22:28:29 +0200 "Kirill A. Shutemov"  
wrote:

> The patch below fixes the issue for me, but this bug makes me wounder how
> many bugs like this we have in kernel... :-/
> 
> Looks like we are too permissive about which VMA is migratable:
> vma_migratable() filters out VMA by VM_IO and VM_PFNMAP.
> I think VM_DONTEXPAND also correlate with VMA which cannot be migrated.
> 
> $ git grep VM_DONTEXPAND drivers | grep -v '\(VM_IO\|VM_PFNMAN\)' | wc -l 
> 33
> 
> Hm.. :-|
> 
> It worth looking on them closely... And I wouldn't be surprised if some
> VMAs without all of these flags are not migratable too.
> 
> Sigh.. Any thoughts?

Sigh indeed.  I think that both VM_DONTEXPAND and VM_DONTDUMP are
pretty good signs that mbind() should not be mucking with this vma.  If
such a policy sometimes results in mbind failing to set a policy then
that's not a huge loss - something runs a bit slower maybe.

I mean, we only really expect mbind() to operate against regular old
anon/pagecache memory, yes?
--
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: mm: VM_BUG_ON_PAGE(PageTail(page)) in mbind

2016-01-26 Thread Andrew Morton
On Tue, 26 Jan 2016 22:28:29 +0200 "Kirill A. Shutemov"  
wrote:

> Let's mark the VMA as VM_IO to indicate to mm core that the VMA is
> migratable.
> 
> ...
>
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -1261,7 +1261,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
>   }
>  
>   sfp->mmap_called = 1;
> - vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
> + vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
>   vma->vm_private_data = sfp;
>   vma->vm_ops = &sg_mmap_vm_ops;
>   return 0;

I'll put cc:stable on this - I don't think we recently did anything to make
this happen?
--
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: mm: VM_BUG_ON_PAGE(PageTail(page)) in mbind

2016-01-26 Thread Kirill A. Shutemov
On Tue, Jan 26, 2016 at 12:49:16PM -0800, Andrew Morton wrote:
> On Tue, 26 Jan 2016 22:28:29 +0200 "Kirill A. Shutemov" 
>  wrote:
> 
> > Let's mark the VMA as VM_IO to indicate to mm core that the VMA is
> > migratable.
> > 
> > ...
> >
> > --- a/drivers/scsi/sg.c
> > +++ b/drivers/scsi/sg.c
> > @@ -1261,7 +1261,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
> > }
> >  
> > sfp->mmap_called = 1;
> > -   vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
> > +   vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
> > vma->vm_private_data = sfp;
> > vma->vm_ops = &sg_mmap_vm_ops;
> > return 0;
> 
> I'll put cc:stable on this - I don't think we recently did anything to make
> this happen?

The VM_BUG_ON is new bb5b8589767a ("mm: make sure isolate_lru_page() is
never called for tail page"), but I don't think it changes the picture
much.

-- 
 Kirill A. Shutemov
--
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: mm: VM_BUG_ON_PAGE(PageTail(page)) in mbind

2016-01-26 Thread Kirill A. Shutemov
On Tue, Jan 26, 2016 at 12:48:23PM -0800, Andrew Morton wrote:
> On Tue, 26 Jan 2016 22:28:29 +0200 "Kirill A. Shutemov" 
>  wrote:
> 
> > The patch below fixes the issue for me, but this bug makes me wounder how
> > many bugs like this we have in kernel... :-/
> > 
> > Looks like we are too permissive about which VMA is migratable:
> > vma_migratable() filters out VMA by VM_IO and VM_PFNMAP.
> > I think VM_DONTEXPAND also correlate with VMA which cannot be migrated.
> > 
> > $ git grep VM_DONTEXPAND drivers | grep -v '\(VM_IO\|VM_PFNMAN\)' | wc -l 
> > 33
> > 
> > Hm.. :-|
> > 
> > It worth looking on them closely... And I wouldn't be surprised if some
> > VMAs without all of these flags are not migratable too.
> > 
> > Sigh.. Any thoughts?
> 
> Sigh indeed.  I think that both VM_DONTEXPAND and VM_DONTDUMP are
> pretty good signs that mbind() should not be mucking with this vma.  If
> such a policy sometimes results in mbind failing to set a policy then
> that's not a huge loss - something runs a bit slower maybe.
> 
> I mean, we only really expect mbind() to operate against regular old
> anon/pagecache memory, yes?

Well, it can work fine too if driver itself uses page tables to find out
which pages it should to operate on. I don't think it's a common case.

-- 
 Kirill A. Shutemov
--
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: mm: VM_BUG_ON_PAGE(PageTail(page)) in mbind

2016-01-26 Thread Vlastimil Babka
On 26.1.2016 21:28, Kirill A. Shutemov wrote:
> From 396ad132be07a2d2b9ec5d1d6ec9fe2fffe8105e Mon Sep 17 00:00:00 2001
> From: "Kirill A. Shutemov" 
> Date: Tue, 26 Jan 2016 22:59:16 +0300
> Subject: [PATCH] sg: mark VMA as VM_IO to prevent migration
> 
> Reduced testcase:
> 
>   #include 
>   #include 
>   #include 
>   #include 
> 
>   #define SIZE 0x2000
> 
>   int main()
>   {
>   int fd;
>   void *p;
> 
>   fd = open("/dev/sg0", O_RDWR);
>   p = mmap(NULL, SIZE, PROT_EXEC, MAP_PRIVATE | MAP_LOCKED, fd, 
> 0);
>   mbind(p, SIZE, 0, NULL, 0, MPOL_MF_MOVE);
>   return 0;
>   }
> 
> We shouldn't try to migrate pages in sg VMA as we don't have a way to
> update Sg_scatter_hold::pages accordingly from mm core.
> 
> Let's mark the VMA as VM_IO to indicate to mm core that the VMA is
> migratable.

 ^ not migratable.

Acked-by: Vlastimil Babka 


> 
> Signed-off-by: Kirill A. Shutemov 
> Reported-by: Dmitry Vyukov 
> ---
>  drivers/scsi/sg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index 503ab8b46c0b..5e820674432c 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -1261,7 +1261,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
>   }
>  
>   sfp->mmap_called = 1;
> - vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
> + vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
>   vma->vm_private_data = sfp;
>   vma->vm_ops = &sg_mmap_vm_ops;
>   return 0;
> 

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


[Bug 111341] New: Firmware loader

2016-01-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=111341

Bug ID: 111341
   Summary: Firmware loader
   Product: SCSI Drivers
   Version: 2.5
Kernel Version: 4.5_rc1
  Hardware: x86-64
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Other
  Assignee: scsi_drivers-ot...@kernel-bugs.osdl.org
  Reporter: walter.moel...@moeller-it.net
Regression: No

Intel driver HDD ahci c600 /sas /sata build in kernel does not build in
firmware.

kernel 4.4.0 ist ok

regards

-- 
You are receiving this mail because:
You are watching the assignee of 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


RE: What partition should the MTMKPART argument specify? Was: Re: st driver doesn't seem to grok LTO partitioning

2016-01-26 Thread Seymour, Shane M
Hi Emmanuel,

> Hmm in fact if we keep using MB we'll be stuck when tapes reach ~2 PB
> which leaves some time to think about it, until LTO-15 circa 2036 :)

There will be other issues to solve before then (by LTO-9 2 with compression
or LTO-10 without compression and we're at LTO-7 now). Take tar format
archives with a standard block size of 10k can take this much data to get
 to 2^32 blocks and cause the current 32bit block number to wrap:

43,980,465,111,040 (2^32 * 10240)

After that much data has been written the SCSI-2 command READ POSITION
will not be able to show the current position correctly (which is what the st
driver uses to determine the position for an MTIOCPOS). It may be less
than that since some drives include file marks in the logical block number if
the program that produced the tape writes them out.

That means switching to the extended block id form of READ POSITION
so we have 64bit counts for those values, see page 150:

https://docs.oracle.com/cd/E21419_04/en/LTO5_Vol3_E5b/LTO5_Vol3_E5b.pdf

That's going to require new ioctls like MTIOCPOS64 and other changes within
the driver to support larger types for holding some values. That will also raise
all sorts of fun compatibility questions as well (should MTIOCPOS work at all
for such a tape drive or should it work until something overflows and return
what data it can and give an errno of -EOVERFLOW etc).

That's probably the correct time to also look at adding support for more
partitions. Not sure when the extended block id form of READ POSITION
got added but it may mean only supporting the wider values only with tape
drives that support REPORT SUPPORTED OPCODES (if that can indicate that
it supports READ POSITION with extended block ids and anything else
required to support block numbers larger than 2^32).

The 0x91 version of SPACE needs to be used as well (the 32bit version 0x11
Is currently used) to allow tape movement with counts >2^32. That requires
a new ioctl call. I haven't looked at what else may need to change but there's
likely to be more. The alternate version of SPACE is from page 220 of the
above HP LTO5 tape reference.

Thanks
Shane

P.S. you could force the above changes now using a 512 byte block size since
the block number would wrap at this size on LTO (ignoring the fact that it
wouldn't make sense to use a block size that small on LTO):

2,199,023,255,552 (2^32*512)


Re: [PATCH] SCSI: fix crashes in sd and sr runtime PM

2016-01-26 Thread Erich Schubert
Hello Alan,
Thank you:

The patch appears to work for me, too.

Applied on top of Debian kernel "4.4-1~exp1" I finally have a kernel boot again!
(And maybe this will also make the Intel ( i7-2677M IGP) video bugs
disappear...)

Best regards,
Erich

On Wed, Jan 20, 2016 at 5:26 PM, Alan Stern  wrote:
> Runtime suspend during driver probe and removal can cause problems.
> The driver's runtime_suspend or runtime_resume callbacks may invoked
> before the driver has finished binding to the device or after the
> driver has unbound from the device.
>
> This problem shows up with the sd and sr drivers, and can cause disk
> or CD/DVD drives to become unusable as a result.  The fix is simple.
> The drivers store a pointer to the scsi_disk or scsi_cd structure as
> their private device data when probing is finished, so we simply have
> to be sure to clear the private data during removal and test it during
> runtime suspend/resume.
>
> This fixes .
>
> Signed-off-by: Alan Stern 
> Reported-by: Paul Menzel 
> Reported-by: Erich Schubert 
> Reported-by: Alexandre Rossi 
> Tested-by: Paul Menzel 
> CC: "James E.J. Bottomley" 
> CC: Ben Hutchings 
> CC: 
>
> ---
>
>
> [as1795]
>
>
>  drivers/scsi/sd.c |7 +--
>  drivers/scsi/sr.c |4 
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> Index: usb-4.4/drivers/scsi/sd.c
> ===
> --- usb-4.4.orig/drivers/scsi/sd.c
> +++ usb-4.4/drivers/scsi/sd.c
> @@ -3275,8 +3275,8 @@ static int sd_suspend_common(struct devi
> struct scsi_disk *sdkp = dev_get_drvdata(dev);
> int ret = 0;
>
> -   if (!sdkp)
> -   return 0;   /* this can happen */
> +   if (!sdkp)  /* E.g.: runtime suspend following sd_remove() */
> +   return 0;
>
> if (sdkp->WCE && sdkp->media_present) {
> sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
> @@ -3315,6 +3315,9 @@ static int sd_resume(struct device *dev)
>  {
> struct scsi_disk *sdkp = dev_get_drvdata(dev);
>
> +   if (!sdkp)  /* E.g.: runtime resume at the start of sd_probe() */
> +   return 0;
> +
> if (!sdkp->device->manage_start_stop)
> return 0;
>
> Index: usb-4.4/drivers/scsi/sr.c
> ===
> --- usb-4.4.orig/drivers/scsi/sr.c
> +++ usb-4.4/drivers/scsi/sr.c
> @@ -144,6 +144,9 @@ static int sr_runtime_suspend(struct dev
>  {
> struct scsi_cd *cd = dev_get_drvdata(dev);
>
> +   if (!cd)/* E.g.: runtime suspend following sr_remove() */
> +   return 0;
> +
> if (cd->media_present)
> return -EBUSY;
> else
> @@ -985,6 +988,7 @@ static int sr_remove(struct device *dev)
> scsi_autopm_get_device(cd->device);
>
> del_gendisk(cd->disk);
> +   dev_set_drvdata(dev, NULL);
>
> mutex_lock(&sr_ref_mutex);
> kref_put(&cd->kref, sr_kref_release);
>
--
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 v4 00/17] be2iscsi: driver update 11.0.0.0

2016-01-26 Thread Martin K. Petersen
> "Jitendra" == Jitendra Bhivare  writes:

Applied to 4.6/scsi-queue.

PATCH 12/17: "be2iscsi: Fix IOPOLL implementation" conflicted with
Christoph's irq_poll changes. I fixed it up but please verify:

http://git.kernel.org/cgit/linux/kernel/git/mkp/scsi.git/commit/?h=4.6/scsi-queue&id=fa512e1a3156

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] be2iscsi: add checks for dma mapping errors

2016-01-26 Thread Martin K. Petersen
> "Alexey" == Alexey Khoroshilov  writes:

Alexey> hwi_write_buffer() does not check if mapping dma memory succeed.
Alexey> The patch adds the check and failure handling.

Applied to 4.6/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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 00/11] qla2xxx: Patches for scsi "misc" branch.

2016-01-26 Thread Martin K. Petersen
> "Himanshu" == Himanshu Madhani  writes:

Himanshu> Please apply following patches to the scsi tree, misc branch
Himanshu> at your earliest convenience.

Please fix kbuild warnings and repost.

Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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 09/15] megaraid_sas: Dual Queue depth support

2016-01-26 Thread Martin K. Petersen
> "Tomas" == Tomas Henzl  writes:

>> Yes this is already covered internally, there would be perf penalty
>> with VDs in configuration but this feature will be turned on based on
>> firmware settings and that specific firmware deployment has primary
>> purpose of increasing JBOD performance. This focuses on firmware
>> deployment with less VDs(or no) and more JBODs in configuration.

Tomas> OK, so it is switched off by default in the firmware and the user
Tomas> and an educated user can switch it on ? if so, it's fine for me.

Sumit?

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: export function scsi_scan.c:sanitize_inquiry_string

2016-01-26 Thread Martin K. Petersen
> "Don" == Don Brace  writes:

Don> It was pointed out to me by Kevin Barnett that I should also add a
Don> prototype in scsi.h.

Yes, please.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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 3] qla2xxx: Remove use of 'struct timeval'

2016-01-26 Thread Martin K. Petersen
> "Arnd" == Arnd Bergmann  writes:

Arnd> struct register_host_info stores a 64-bit UTC system time
Arnd> timestamp.  This patch removes the use of 'struct timeval' to
Arnd> obtain that timestamp as its tv_sec value will overflow on 32-bit
Arnd> systems in year 2038 beyond.  The patch uses
Arnd> ktime_get_real_seconds() which returns a 64-bit seconds value.

Applied to 4.6/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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 03/22] scsi: Fix dependencies for !HAS_IOMEM and !HAS_DMA archs

2016-01-26 Thread Martin K. Petersen
> "John" == John Garry  writes:

John> We can just add HAS_IOMEM dependency on the scsi fixes branch, ok?

Yes, please submit a patch against 4.5/scsi-fixes.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] hisi_sas: add dependency for HAS_IOMEM

2016-01-26 Thread Martin K. Petersen
> "John" == John Garry  writes:

John> Not every arch has io, so fix build by adding necessary
John> dependency.

Ignore previous mail. Will apply this...

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] hisi_sas: fix v1 hw check for slot error

2016-01-26 Thread Martin K. Petersen
> "John" == John Garry  writes:

John> Completion header bit CMPLT_HDR_RSPNS_XFRD flags whether the
John> response frame is received into host memory, and not whether the
John> response frame has an error.  As such, change the decision on
John> whether a slot has an error.  Also redundant check on
John> CMPLT_HDR_CMD_CMPLT_MSK is removed.

Applied to 4.5/scsi-fixes.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] mptlan: add checks for dma mapping errors

2016-01-26 Thread Martin K. Petersen
> "Tomas" == Tomas Henzl  writes:

Tomas> Other than that - previous patch for this driver came in in 2010
Tomas> - six years ago and the driver seems unmaintained now.  I'm not
Tomas> sure if we should fix hw we can't test and when there is not an
Tomas> user bug report. This example nicely shows how easy it is to add
Tomas> new bugs even when a fix looks trivial.

Yeah, I'm inclined to leave it as is.

If somebody provides a Tested-by: I'll reconsider.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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: Remove redundant code block in lpfc_scsi_cmd_iocb_cmpl

2016-01-26 Thread Martin K. Petersen
> "Johannes" == Johannes Thumshirn  writes:

Johannes> This removes a redundant code block that will either be
Johannes> executed if the ENABLE_FCP_RING_POLLING flag is set in
Johannes> phba->cfg_poll or not. The code is just duplicated in both
Johannes> cases, hence we unify it again.

Johannes> This probably is a left over from some sort of refactoring.

James/Dick: Please review.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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 7/9] aacraid: Fix AIF triggered IOP_RESET

2016-01-26 Thread Martin K. Petersen
> "Tomas" == Tomas Henzl  writes:

>> 2.Since commands are sync , place a check in aac_fib_send to block
>> commands once adapter_shutdown is set(only shutdown command will be
>> sent thru)

Tomas> This option looks better but I guess you still can find a tiny
Tomas> race window.  What do you think about a mutual exclusive access
Tomas> using a mutex, do you think this could work?

[...]

Raghava?

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] mptlan: add checks for dma mapping errors

2016-01-26 Thread Sathya Prakash
There is no fusion based network card and resources exists today in
Avago(LSI) to test this patch so we prefer to leave it as is. We would
like to prevent any new changes on MPT (FC/SCSI/SAS/LAN) drivers as we
don't have support for those cards anymore,  is there a way we could
remove those drivers from newer kernels or mark them as unmaintained?.

Thanks
Sathya

-Original Message-
From: mpt-fusionlinux@avagotech.com
[mailto:mpt-fusionlinux@avagotech.com] On Behalf Of Martin K. Petersen
Sent: Tuesday, January 26, 2016 7:23 PM
To: Tomas Henzl
Cc: Alexey Khoroshilov; Sreekanth Reddy;
mpt-fusionlinux@avagotech.com; linux-scsi@vger.kernel.org;
linux-ker...@vger.kernel.org; ldv-proj...@linuxtesting.org
Subject: Re: [PATCH v3] mptlan: add checks for dma mapping errors

> "Tomas" == Tomas Henzl  writes:

Tomas> Other than that - previous patch for this driver came in in 2010
Tomas> - six years ago and the driver seems unmaintained now.  I'm not
Tomas> sure if we should fix hw we can't test and when there is not an
Tomas> user bug report. This example nicely shows how easy it is to add
Tomas> new bugs even when a fix looks trivial.

Yeah, I'm inclined to leave it as is.

If somebody provides a Tested-by: I'll reconsider.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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-v2 11/12] xen-scsiback: Convert to percpu_ida tag allocation

2016-01-26 Thread Nicholas A. Bellinger
On Tue, 2016-01-26 at 10:45 +0100, Juergen Gross wrote:
> On 25/01/16 09:11, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger 
> > 
> > Cc: Juergen Gross 
> > Cc: Hannes Reinecke 
> > Cc: David Vrabel 
> > Signed-off-by: Nicholas Bellinger 
> > ---
> >  drivers/xen/xen-scsiback.c | 163 
> > -
> >  1 file changed, 87 insertions(+), 76 deletions(-)
> > 
> > diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
> > index 594f8a7..640fb22 100644
> > --- a/drivers/xen/xen-scsiback.c
> > +++ b/drivers/xen/xen-scsiback.c
> > @@ -190,7 +190,6 @@ module_param_named(max_buffer_pages, 
> > scsiback_max_buffer_pages, int, 0644);
> >  MODULE_PARM_DESC(max_buffer_pages,
> >  "Maximum number of free pages to keep in backend buffer");
> >  
> > -static struct kmem_cache *scsiback_cachep;
> >  static DEFINE_SPINLOCK(free_pages_lock);
> >  static int free_pages_num;
> >  static LIST_HEAD(scsiback_free_pages);
> > @@ -322,7 +321,8 @@ static void scsiback_free_translation_entry(struct kref 
> > *kref)
> >  }
> >  
> >  static void scsiback_do_resp_with_sense(char *sense_buffer, int32_t result,
> > -   uint32_t resid, struct vscsibk_pend *pending_req)
> > +   uint32_t resid, struct vscsibk_pend *pending_req,
> > +   uint16_t rqid)
> >  {
> > struct vscsiif_response *ring_res;
> > struct vscsibk_info *info = pending_req->info;
> 
> pending_req might be NULL now, so this will panic the system.
> 

Thanks for the review.

Added the following to propagate up original *info into
scsiback_do_resp_with_sense() to address the early pending_req
failure case.

https://git.kernel.org/cgit/linux/kernel/git/nab/target-pending.git/commit/?h=queue-next&id=5873f22a9b7c7aa16ff9a85074a07b739f1d06a5

Will plan to fold into the original for -v3 code.

Thanks Juergen!

--
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-v2 12/12] xen-scsiback: Convert to TARGET_SCF_ACK_KREF I/O krefs

2016-01-26 Thread Nicholas A. Bellinger
On Tue, 2016-01-26 at 10:49 +0100, Juergen Gross wrote:
> On 25/01/16 09:11, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger 
> > 
> > Cc: Juergen Gross 
> > Cc: Hannes Reinecke 
> > Cc: David Vrabel 
> > Signed-off-by: Nicholas Bellinger 
> > ---
> >  drivers/xen/xen-scsiback.c | 53 
> > +++---
> >  1 file changed, 26 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
> > index 640fb22..a10e5f1 100644
> > --- a/drivers/xen/xen-scsiback.c
> > +++ b/drivers/xen/xen-scsiback.c
> > @@ -381,6 +381,12 @@ static void scsiback_cmd_done(struct vscsibk_pend 
> > *pending_req)
> > scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req,
> > pending_req->rqid);
> > scsiback_put(info);
> > +   /*
> > +* Drop the extra KREF_ACK reference taken by 
> > target_submit_cmd_map_sgls()
> > +* ahead of scsiback_check_stop_free() ->  transport_generic_free_cmd()
> > +* final se_cmd->cmd_kref put.
> > +*/
> > +   target_put_sess_cmd(&pending_req->se_cmd);
> >  }
> >  
> >  static void scsiback_cmd_exec(struct vscsibk_pend *pending_req)
> > @@ -398,7 +404,7 @@ static void scsiback_cmd_exec(struct vscsibk_pend 
> > *pending_req)
> > rc = target_submit_cmd_map_sgls(se_cmd, sess, pending_req->cmnd,
> > pending_req->sense_buffer, pending_req->v2p->lun,
> > pending_req->data_len, 0,
> > -   pending_req->sc_data_direction, 0,
> > +   pending_req->sc_data_direction, TARGET_SCF_ACK_KREF,
> > pending_req->sgl, pending_req->n_sg,
> > NULL, 0, NULL, 0);
> > if (rc < 0) {
> > @@ -587,31 +593,28 @@ static void scsiback_disconnect(struct vscsibk_info 
> > *info)
> >  static void scsiback_device_action(struct vscsibk_pend *pending_req,
> > enum tcm_tmreq_table act, int tag)
> >  {
> > -   int rc, err = FAILED;
> > struct scsiback_tpg *tpg = pending_req->v2p->tpg;
> > +   struct scsiback_nexus *nexus = tpg->tpg_nexus;
> > struct se_cmd *se_cmd = &pending_req->se_cmd;
> > struct scsiback_tmr *tmr;
> > +   u64 unpacked_lun = pending_req->v2p->lun;
> > +   int rc, err = FAILED;
> >  
> > tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL);
> > -   if (!tmr)
> > -   goto out;
> > +   if (!tmr) {
> > +   target_put_sess_cmd(se_cmd);
> > +   goto err;
> 
> Sure? I think this should still be "goto out;"?
> 
> > +   }
> >  
> > init_waitqueue_head(&tmr->tmr_wait);
> >  
> > -   transport_init_se_cmd(se_cmd, tpg->se_tpg.se_tpg_tfo,
> > -   tpg->tpg_nexus->tvn_se_sess, 0, DMA_NONE, TCM_SIMPLE_TAG,
> > -   &pending_req->sense_buffer[0]);
> > -
> > -   rc = core_tmr_alloc_req(se_cmd, tmr, act, GFP_KERNEL);
> > -   if (rc < 0)
> > -   goto out;
> > -
> > -   se_cmd->se_tmr_req->ref_task_tag = tag;
> > +   rc = target_submit_tmr(&pending_req->se_cmd, nexus->tvn_se_sess,
> > +  &pending_req->sense_buffer[0],
> > +  unpacked_lun, tmr, act, GFP_KERNEL,
> > +  tag, TARGET_SCF_ACK_KREF);
> > +   if (rc)
> > +   goto err;
> 
> Again.
> 

Whoops, bisect breakage here..

Fixed up this in latest target-pending/queue-next.

--
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 09/15] megaraid_sas: Dual Queue depth support

2016-01-26 Thread Sumit Saxena
> -Original Message-
> From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> Sent: Wednesday, January 27, 2016 7:32 AM
> To: Tomas Henzl
> Cc: Sumit Saxena; jbottom...@parallels.com; h...@infradead.org;
> martin.peter...@oracle.com; linux-scsi@vger.kernel.org; Kashyap Desai
> Subject: Re: [PATCH 09/15] megaraid_sas: Dual Queue depth support
>
> > "Tomas" == Tomas Henzl  writes:
>
> >> Yes this is already covered internally, there would be perf penalty
> >> with VDs in configuration but this feature will be turned on based on
> >> firmware settings and that specific firmware deployment has primary
> >> purpose of increasing JBOD performance. This focuses on firmware
> >> deployment with less VDs(or no) and more JBODs in configuration.
>
> Tomas> OK, so it is switched off by default in the firmware and the user
> Tomas> and an educated user can switch it on ? if so, it's fine for me.
>
> Sumit?

Yes, this feature will be enabled for specific firmware only. On rest of
firmware types, it will be disabled(not supported).

Thanks,
Sumit
>
> --
> Martin K. PetersenOracle Linux Engineering
--
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