Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A

2017-01-19 Thread Johannes Thumshirn
On Wed, Jan 18, 2017 at 06:34:02PM -0800, James Smart wrote:
> 
> 
> On 1/18/2017 1:50 AM, Johannes Thumshirn wrote:
> 
> >>@@ -4959,11 +4968,11 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct 
> >>scsi_cmnd *cmnd,
> >>int status;
> >>rdata = lpfc_rport_data_from_scsi_device(cmnd->device);
> >>-   if (!rdata || !rdata->pnode || !NLP_CHK_NODE_ACT(rdata->pnode))
> >>-   return FAILED;
> >OK, I don't get this hunk. lpfc_rport_data_from_scsi_device() cannot return
> >NULL anymore?
> >
> >I at least expected something like:
> >
> > rdata = lpfc_rport_data_from_scsi_device(cmnd->device);
> > if (!rdata || !rdata->pnode)
> > return FAILED;
> > 
> > pnode = rdata->pnode;
> > if (!NLP_CHK_NODE_ACT(pnode)
> > return FAILED;
> 
> it can and the order of precedence for the if check allows for it. I don't
> see any difference in what you wrote vs what's there, other than pnode gets
> an assignment.

You're doing:
rdata = lpfc_rport_data_from_scsi_device(cmnd->device);
pnode = rdata->pnode;
if (!pnode || !NLP_CHK_NODE_ACT(pnode)) 
return FAILED;

So if rdata is already NULL, the pnode = rdata->pnode line will blow up.

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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/17] lpfc: NVME Initiator: Base modifications Part B

2017-01-19 Thread Johannes Thumshirn
On Wed, Jan 18, 2017 at 06:45:46PM -0800, James Smart wrote:
> 
> 
> On 1/18/2017 2:11 AM, Johannes Thumshirn wrote:
> >On Tue, Jan 17, 2017 at 05:20:46PM -0800, James Smart wrote:
> >>NVME Initiator: Base modifications
> >>
> >>This is part B of parts A..F.
> >>
> >>Part B is limited to lpfc_attr.c: lpfc attribute modifications
> >>
> >>*
> >>
> >>Refer to Part A for a description of base modifications
> >>
> >>Signed-off-by: Dick Kennedy 
> >>Signed-off-by: James Smart 
> >>---
> >[...]
> >
> >>+   len += snprintf(buf + len, PAGE_SIZE - len,
> >>+   "%s%d WWPN x%llx WWNN x%llx DID x%06x %s\n",
> >>+   "NVME LPORT lpfc",
> >Is it the lack of coffee or should it be
> > "NVME LPORT lpfc%d WWPN x%llx WWNN x%llx DID x%06x %s\n"
> >
> >I think you're doing it to not hit the 80 chars limit, but then there are
> >way more offenders than that one, so...
> 
> The line split is certainly due to the 80 limit and have that issue a lot.
> 
> As for what the string name should be - I agree with you. something is
> confused.
> 
> >>+int
> >>+lpfc_emptyq_wait(struct lpfc_hba *phba, struct list_head *q, spinlock_t 
> >>*lock)
> >>+{
> >>+   int cnt = 0;
> >>+
> >>+   spin_lock_irq(lock);
> >>+   while (!list_empty(q)) {
> >>+   spin_unlock_irq(lock);
> >>+   msleep(20);
> >>+   if (cnt++ > 250) {  /* 5 secs */
> >>+   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
> >>+   "0466 %s %s\n",
> >>+   "Outstanding IO when ",
> >>+   "bringing Adapter offline\n");
> >>+   return 0;
> >>+   }
> >>+   spin_lock_irq(lock);
> >>+   }
> >>+   spin_unlock_irq(lock);
> >>+   return 1;
> >>+}
> >>+
> >Aren't you using lpc_emptyq_wait() in patches prior to that already? This
> >breaks git bisect. Pleas test-build (ideally + checkpatch and sparse/smatch)
> >each patch in the series individually.
> 
> I called out - in patch2 - that Patches 2 through 7, known as parts A..F,
> area really one big patch. They will not follow the git bisect rules.  I
> could have sent them in one huge patch, but chose to break them up.
> Unfortunately, the mods accumulated over time with lots of reworks -
> creating a base that was too intertwined to put into small functional
> patches without spending oodles of time to carve them up.   I hope you can
> bear with me on this set and review the 7 pieces as one big patch.

For review one big patch clearly is a huge problem, I agree. But the final
merged version must not break bisects. So we can probably defer the discussion
to the end of the merging.

Byte,
Johannes
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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 08/12] qla2xxx: Add framework for Async fabric discovery.

2017-01-19 Thread Julia Lawall
Hello,

I don't have the compete context, but I have the impression that there
should be a goto done at which sp can be NULL.

julia

-- Forwarded message --
Date: Thu, 19 Jan 2017 12:38:31 +0800
From: kbuild test robot 
To: kbu...@01.org
Cc: Julia Lawall 
Subject: Re: [PATCH v3 08/12] qla2xxx: Add framework for Async fabric discovery.

In-Reply-To: <1484781585-27252-9-git-send-email-himanshu.madh...@cavium.com>

Hi Quinn,

[auto build test WARNING on next-20170118]
[cannot apply to scsi/for-next v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.10-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Feature-updates-for-target/20170119-105115
:: branch date: 2 hours ago
:: commit date: 2 hours ago

>> drivers/scsi/qla2xxx/qla_init.c:269:5-11: ERROR: sp is NULL but dereferenced.

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 8cf2e24938dd5d941b2edc9786f8e1ad8c80d9af
vim +269 drivers/scsi/qla2xxx/qla_init.c

3822263eb Madhuranath Iyengar 2010-05-04  253   lio->timeout = 
qla2x00_async_iocb_timeout;
9ba56b95a Giridhar Malavali   2012-02-09  254   sp->done = 
qla2x00_async_logout_sp_done;
ac280b670 Andrew Vasquez  2009-08-20  255   rval = qla2x00_start_sp(sp);
ac280b670 Andrew Vasquez  2009-08-20  256   if (rval != QLA_SUCCESS)
ac280b670 Andrew Vasquez  2009-08-20  257   goto done_free_sp;
ac280b670 Andrew Vasquez  2009-08-20  258
7c3df1320 Saurav Kashyap  2011-07-14  259   ql_dbg(ql_dbg_disc, vha, 0x2070,
8cf2e2493 Quinn Tran  2017-01-18  260   "Async-logout - hdl=%x 
loop-id=%x portid=%02x%02x%02x %8phC.\n",
cfb0919c1 Chad Dupuis 2011-11-18  261   sp->handle, 
fcport->loop_id, fcport->d_id.b.domain,
8cf2e2493 Quinn Tran  2017-01-18  262   fcport->d_id.b.area, 
fcport->d_id.b.al_pa,
8cf2e2493 Quinn Tran  2017-01-18  263   fcport->port_name);
ac280b670 Andrew Vasquez  2009-08-20  264   return rval;
ac280b670 Andrew Vasquez  2009-08-20  265
ac280b670 Andrew Vasquez  2009-08-20  266  done_free_sp:
9ba56b95a Giridhar Malavali   2012-02-09  267   sp->free(fcport->vha, sp);
ac280b670 Andrew Vasquez  2009-08-20  268  done:
8cf2e2493 Quinn Tran  2017-01-18 @269   sp->fcport->flags &= 
~FCF_ASYNC_SENT;
ac280b670 Andrew Vasquez  2009-08-20  270   return rval;
ac280b670 Andrew Vasquez  2009-08-20  271  }
ac280b670 Andrew Vasquez  2009-08-20  272
5ff1d5841 Andrew Vasquez  2010-05-04  273  static void
9ba56b95a Giridhar Malavali   2012-02-09  274  qla2x00_async_adisc_sp_done(void 
*data, void *ptr, int res)
5ff1d5841 Andrew Vasquez  2010-05-04  275  {
9ba56b95a Giridhar Malavali   2012-02-09  276   srb_t *sp = (srb_t *)ptr;
9ba56b95a Giridhar Malavali   2012-02-09  277   struct srb_iocb *lio = 
&sp->u.iocb_cmd;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
--
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: [LSF/MM TOPIC][LSF/MM ATTEND] NAPI polling for block drivers

2017-01-19 Thread Sagi Grimberg



I think you missed:
http://git.infradead.org/nvme.git/commit/49c91e3e09dc3c9dd1718df85112a8cce3ab7007


I indeed did, thanks.


But it doesn't help.

We're still having to wait for the first interrupt, and if we're really
fast that's the only completion we have to process.

Try this:


diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index b4b32e6..e2dd9e2 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -623,6 +623,8 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
}
__nvme_submit_cmd(nvmeq, &cmnd);
spin_unlock(&nvmeq->sq_lock);
+   disable_irq_nosync(nvmeq_irq(irq));
+   irq_poll_sched(&nvmeq->iop);


a. This would trigger a condition that we disable irq twice which
is wrong at least because it will generate a warning.

b. This would cause a way-too-much triggers of ksoftirqd. In order for
it to be effective we need to to run only when it should and optimally
when the completion queue has a batch of completions waiting.

After a deeper analysis, I agree with Bart that interrupt coalescing is
needed for it to work. The problem with nvme coalescing as Jens said, is
a death penalty of 100us granularity. Hannes, Johannes, how does it look
like with the devices you are testing with?

Also, I think that adaptive moderation is needed in order for it to
work well. I know that some networking drivers implemented adaptive
moderation in SW before having HW support for it. It can be done by
maintaining stats and having a periodic work that looks at it and
changes the moderation parameters.

Does anyone think that this is something we should consider?
--
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 04/17] lpfc: NVME Initiator: Base modifications Part C

2017-01-19 Thread Johannes Thumshirn
On Wed, Jan 18, 2017 at 06:54:37PM -0800, James Smart wrote:
> 
> 
> On 1/18/2017 3:03 AM, Johannes Thumshirn wrote:
> >
> >>+   /* maximum number of xris available for nvme buffers */
> >>+   els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba);
> >>+   phba->sli4_hba.nvme_xri_max = phba->sli4_hba.max_cfg_param.max_xri -
> >>+ els_xri_cnt;
> >>+   phba->sli4_hba.nvme_xri_max -= phba->sli4_hba.scsi_xri_max;
> > nvme_xri_max = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt;
> > nvme_xri_max -= phba->sli4_hba.scsi_xri_max;
> > phba->sli4_hba.nvme_xri_max = nvme_xri_max;
> >
> >Low hanging anti line-break fruit.
> 
> ok - but I didn't think that a style change like this is a mandate.   As I'm
> addressing your other comments, I'll do so.

I don't think it's a mandate, but line wrappings are always bad to read. Code
is written once but read a lot of times. I know I'm nitpicking a lot here but
hard to read code makes errors hard to spot.

Thanks for your patience,
Johannes

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] scsi: hisi_sas: workaround v2 hw SATA IO timeout issue

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 12:32:47AM +0800, John Garry wrote:
> From: Xiang Chen 
> 
> The v2 SAS controller needs more time to detect channel idle
> and send setup link request than SATA disk does, so it is
> difficult for SAS controller to setup an STP link. Therefore it
> may cause some IO timeouts.
> 
> We need to periodically configure the SAS controller so it
> doesn't receive STP setup requests from SATA disks for a while,
> so IO can be sent during this period.
> 
> Signed-off-by: Xiang Chen 
> Signed-off-by: John Garry 
> ---

Looks good,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] scsi: hisi_sas: modify some values of ITCT table

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 12:32:48AM +0800, John Garry wrote:
> From: Xiang Chen 
> 
> Set SMP connection timeout and continue AWT timer;
> Clear ITCT table when dev gone.
> 
> Signed-off-by: Xiang Chen 
> Signed-off-by: John Garry 
> ---
>  drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c 
> b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> index 6c787eb..452e329 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> @@ -334,6 +334,8 @@
>  #define ITCT_HDR_MCR_MSK (0xf << ITCT_HDR_MCR_OFF)
>  #define ITCT_HDR_VLN_OFF 9
>  #define ITCT_HDR_VLN_MSK (0xf << ITCT_HDR_VLN_OFF)
> +#define ITCT_HDR_SMP_TIMEOUT_OFF 16
> +#define ITCT_HDR_AWT_CONTINUE_OFF25
>  #define ITCT_HDR_PORT_ID_OFF 28
>  #define ITCT_HDR_PORT_ID_MSK (0xf << ITCT_HDR_PORT_ID_OFF)
>  /* qw2 */
> @@ -696,6 +698,8 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
>   qw0 |= ((1 << ITCT_HDR_VALID_OFF) |
>   (device->linkrate << ITCT_HDR_MCR_OFF) |
>   (1 << ITCT_HDR_VLN_OFF) |
> + (0xfa << ITCT_HDR_SMP_TIMEOUT_OFF) |
 ^~ You may want to give that magic value a name.

Other than that,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] scsi: hisi_sas: downgrade refclk message

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 12:32:49AM +0800, John Garry wrote:
> The message to inform that the controller has no refclk
> is currently at warning level, which is unnecessary, so
> downgrade to debug.
> 
> Signed-off-by: John Garry 
> Reviewed-by: Xiang Chen 
> ---

Looks good,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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 6/7] scsi: hisi_sas: fix probe ordering problem

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 12:32:52AM +0800, John Garry wrote:
> From: Xiang Chen 
> 
> There is a potential probe issue in how we trigger the hw initialisation.
> Although we use 1s timer to delay hw initialisation, there is still a
> potential that sas_register_ha() is not be finished before we start
> the PHY init from hw->hw_init().
> To avoid this issue, initialise the hw after sas_register_ha() in the
> same probe context.
> Note: it is not necessary to use 1s timer now (modified v2 hw only).
> 
> Signed-off-by: Xiang Chen 
> Signed-off-by: John Garry 
> ---

Looks OK,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] scsi: hisi_sas: modify some values of ITCT table

2017-01-19 Thread John Garry

On 19/01/2017 08:44, Johannes Thumshirn wrote:

On Thu, Jan 19, 2017 at 12:32:48AM +0800, John Garry wrote:

From: Xiang Chen 

Set SMP connection timeout and continue AWT timer;
Clear ITCT table when dev gone.

Signed-off-by: Xiang Chen 
Signed-off-by: John Garry 
---
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c 
b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 6c787eb..452e329 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -334,6 +334,8 @@
 #define ITCT_HDR_MCR_MSK   (0xf << ITCT_HDR_MCR_OFF)
 #define ITCT_HDR_VLN_OFF   9
 #define ITCT_HDR_VLN_MSK   (0xf << ITCT_HDR_VLN_OFF)
+#define ITCT_HDR_SMP_TIMEOUT_OFF   16
+#define ITCT_HDR_AWT_CONTINUE_OFF  25
 #define ITCT_HDR_PORT_ID_OFF   28
 #define ITCT_HDR_PORT_ID_MSK   (0xf << ITCT_HDR_PORT_ID_OFF)
 /* qw2 */
@@ -696,6 +698,8 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
qw0 |= ((1 << ITCT_HDR_VALID_OFF) |
(device->linkrate << ITCT_HDR_MCR_OFF) |
(1 << ITCT_HDR_VLN_OFF) |
+   (0xfa << ITCT_HDR_SMP_TIMEOUT_OFF) |

 ^~ You may want to give that magic value a name.



Thanks for having a look.

We will create a new patch without the mysterious value.

Regards,
John


Other than that,
Reviewed-by: Johannes Thumshirn 




--
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 7/7] scsi: hisi_sas: decrease running_req in hisi_sas_slot_task_free()

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 12:32:53AM +0800, John Garry wrote:
> From: Xiang Chen 
> 
> There is an issue that hisi_sas_dev.running_req is not
> decremented properly for internal abort and TMF.
> 
> To resolve, only decrease running_req in hisi_sas_slot_task_free()
> 
> Signed-off-by: Xiang Chen 
> Signed-off-by: John Garry 
> ---

Looks good,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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 4/7] scsi: hisi_sas: modify hard reset for directed-attached disk

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 12:32:50AM +0800, John Garry wrote:
> From: Xiang Chen 
> 
> Correctly set registers in v2 for root PHY hardreset for directly
> attached disk.
> 
> Signed-off-by: Xiang Chen 
> Signed-off-by: John Garry 
> ---

Looks good,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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 5/7] scsi: hisi_sas: downgrade internal abort exit print

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 12:32:51AM +0800, John Garry wrote:
> Downgrade the exit print in hisi_sas_internal_task_abort()
> to dbg level, as info is not required.
> 
> Signed-off-by: John Garry 
> Reviewed-by: Xiang Chen 
> ---

Looks good,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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: [LSF/MM TOPIC][LSF/MM ATTEND] NAPI polling for block drivers

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 10:12:17AM +0200, Sagi Grimberg wrote:
> 
> >>>I think you missed:
> >>>http://git.infradead.org/nvme.git/commit/49c91e3e09dc3c9dd1718df85112a8cce3ab7007
> >>
> >>I indeed did, thanks.
> >>
> >But it doesn't help.
> >
> >We're still having to wait for the first interrupt, and if we're really
> >fast that's the only completion we have to process.
> >
> >Try this:
> >
> >
> >diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> >index b4b32e6..e2dd9e2 100644
> >--- a/drivers/nvme/host/pci.c
> >+++ b/drivers/nvme/host/pci.c
> >@@ -623,6 +623,8 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
> >}
> >__nvme_submit_cmd(nvmeq, &cmnd);
> >spin_unlock(&nvmeq->sq_lock);
> >+   disable_irq_nosync(nvmeq_irq(irq));
> >+   irq_poll_sched(&nvmeq->iop);
> 
> a. This would trigger a condition that we disable irq twice which
> is wrong at least because it will generate a warning.
> 
> b. This would cause a way-too-much triggers of ksoftirqd. In order for
> it to be effective we need to to run only when it should and optimally
> when the completion queue has a batch of completions waiting.
> 
> After a deeper analysis, I agree with Bart that interrupt coalescing is
> needed for it to work. The problem with nvme coalescing as Jens said, is
> a death penalty of 100us granularity. Hannes, Johannes, how does it look
> like with the devices you are testing with?

I haven't had a look at AHCI's Command Completion Coalescing yet but hopefully
I find the time today (+SSD testing!!!).

Don't know if Hannes did (but I _think_ no). The problem is we've already
maxed out our test HW w/o irq_poll and so the only changes we're seeing
currently is an increase of wasted CPU cycles. Not what we wanted to have.

> 
> Also, I think that adaptive moderation is needed in order for it to
> work well. I know that some networking drivers implemented adaptive
> moderation in SW before having HW support for it. It can be done by
> maintaining stats and having a periodic work that looks at it and
> changes the moderation parameters.
> 
> Does anyone think that this is something we should consider?

Yes we've been discussing this internally as well and it sounds good but thats
still all pure theory and nothing actually implemented and tested.

Byte,
Johannes

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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: [LSF/MM TOPIC][LSF/MM ATTEND] NAPI polling for block drivers

2017-01-19 Thread Johannes Thumshirn
On Thu, Jan 19, 2017 at 10:23:28AM +0200, Sagi Grimberg wrote:
> Christoph suggest to me once that we can take a hybrid
> approach where we consume a small amount of completions (say 4)
> right away from the interrupt handler and if we have more
> we schedule irq-poll to reap the rest. But back then it
> didn't work better which is not aligned with my observations
> that we consume only 1 completion per interrupt...
> 
> I can give it another go... What do people think about it?

This could be good.

What's also possible (see answer to my previous mail) is measuring the time it
takes for a completion to arrive and if the average time is lower than the
context switch time just busy loop insted of waiting for the IRQ to arrive. If
it is higher we can always schedule a timer to hit _before_ the IRQ will
likely arrive and start polling. Is this something that sounds reasonable to
you guys as well?

Johannes

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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: [LSF/MM TOPIC][LSF/MM ATTEND] NAPI polling for block drivers

2017-01-19 Thread Sagi Grimberg

Christoph suggest to me once that we can take a hybrid
approach where we consume a small amount of completions (say 4)
right away from the interrupt handler and if we have more
we schedule irq-poll to reap the rest. But back then it
didn't work better which is not aligned with my observations
that we consume only 1 completion per interrupt...

I can give it another go... What do people think about it?
--
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: [LSF/MM TOPIC][LSF/MM ATTEND] NAPI polling for block drivers

2017-01-19 Thread Ming Lei
On Wed, Jan 11, 2017 at 11:07 PM, Jens Axboe  wrote:
> On 01/11/2017 06:43 AM, Johannes Thumshirn wrote:
>> Hi all,
>>
>> I'd like to attend LSF/MM and would like to discuss polling for block 
>> drivers.
>>
>> Currently there is blk-iopoll but it is neither as widely used as NAPI in the
>> networking field and accoring to Sagi's findings in [1] performance with
>> polling is not on par with IRQ usage.
>>
>> On LSF/MM I'd like to whether it is desirable to have NAPI like polling in
>> more block drivers and how to overcome the currently seen performance issues.
>
> It would be an interesting topic to discuss, as it is a shame that blk-iopoll
> isn't used more widely.

I remembered that Keith and I discussed some issues of blk-iopoll:

http://marc.info/?l=linux-block&m=147576999016407&w=2

seems which isn't addressed yet.


Thanks,
Ming Lei
--
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: [LSF/MM TOPIC][LSF/MM ATTEND] NAPI polling for block drivers

2017-01-19 Thread Hannes Reinecke
On 01/19/2017 11:57 AM, Ming Lei wrote:
> On Wed, Jan 11, 2017 at 11:07 PM, Jens Axboe  wrote:
>> On 01/11/2017 06:43 AM, Johannes Thumshirn wrote:
>>> Hi all,
>>>
>>> I'd like to attend LSF/MM and would like to discuss polling for block 
>>> drivers.
>>>
>>> Currently there is blk-iopoll but it is neither as widely used as NAPI in 
>>> the
>>> networking field and accoring to Sagi's findings in [1] performance with
>>> polling is not on par with IRQ usage.
>>>
>>> On LSF/MM I'd like to whether it is desirable to have NAPI like polling in
>>> more block drivers and how to overcome the currently seen performance 
>>> issues.
>>
>> It would be an interesting topic to discuss, as it is a shame that blk-iopoll
>> isn't used more widely.
> 
> I remembered that Keith and I discussed some issues of blk-iopoll:
> 
> http://marc.info/?l=linux-block&m=147576999016407&w=2
> 
> seems which isn't addressed yet.
> 
That's a different poll.

For some obscure reasons you have a blk-mq-poll function (via
q->mq_ops->poll) and an irqpoll function.
The former is for polling completion of individual block-layer tags, the
latter for polling completions from the hardware instead of relying on
interrupts.

We're discussing the latter here, so that thread isn't really applicable
here. However, there have been requests to discuss the former at LSF/MM,
too. So there might be a chance of restarting that discussion.

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


requeue failure with blk-mq-sched

2017-01-19 Thread Hannes Reinecke
Hi Jens,

upon further testing with your blk-mq-sched branch I hit a queue stall
during requeing:

[  202.340959] sd 3:0:4:1: tag#473 Send: scmd 0x880422e7a440
[  202.340962] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
[  202.341161] sd 3:0:4:1: tag#473 Done: ADD_TO_MLQUEUE Result:
hostbyte=DID_OK driverbyte=DRIVER_OK
[  202.341164] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
[  202.341167] sd 3:0:4:1: tag#473 Sense Key : Unit Attention [current]
[  202.341171] sd 3:0:4:1: tag#473 Add. Sense: Power on, reset, or bus
device reset occurred
[  202.341173] sd 3:0:4:1: tag#473 scsi host busy 1 failed 0
[  202.341176] sd 3:0:4:1: tag#473 Inserting command 880422e7a440
into mlqueue

... and that is the last ever heard of that device.
The 'device_busy' count remains at '1' and no further commands will be
sent to the device.

Debugging continues.

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: requeue failure with blk-mq-sched

2017-01-19 Thread Jens Axboe
On 01/19/2017 04:27 AM, Hannes Reinecke wrote:
> Hi Jens,
> 
> upon further testing with your blk-mq-sched branch I hit a queue stall
> during requeing:
> 
> [  202.340959] sd 3:0:4:1: tag#473 Send: scmd 0x880422e7a440
> [  202.340962] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
> [  202.341161] sd 3:0:4:1: tag#473 Done: ADD_TO_MLQUEUE Result:
> hostbyte=DID_OK driverbyte=DRIVER_OK
> [  202.341164] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
> [  202.341167] sd 3:0:4:1: tag#473 Sense Key : Unit Attention [current]
> [  202.341171] sd 3:0:4:1: tag#473 Add. Sense: Power on, reset, or bus
> device reset occurred
> [  202.341173] sd 3:0:4:1: tag#473 scsi host busy 1 failed 0
> [  202.341176] sd 3:0:4:1: tag#473 Inserting command 880422e7a440
> into mlqueue
> 
> ... and that is the last ever heard of that device.
> The 'device_busy' count remains at '1' and no further commands will be
> sent to the device.

If device_busy is at 1, then it should have a command pending. Where did
you log this - it would be bandy if you attached whatever debug patch
you put in, so we can see where the printks are coming from. If we get a
BUSY with nothing pending, the driver should be ensuring that the queue
gets run again later through blk_mq_delay_queue(), for instance.

When the device is stuck, does it restart if you send it IO?

-- 
Jens Axboe

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


[PATCH] scsi: mq queue stall during command requeue

2017-01-19 Thread Hannes Reinecke
When we're hitting a busy condition in queuecommand() we need to
stop the hardware queue before calling blk_mq_delay_queue(); if
we don't blk_mq_delay_queue() will not do anything and requeue
will never triggered.

Signed-off-by: Hannes Reinecke 
---
 drivers/scsi/scsi_lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e9e1e14..4b1cbc6 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1951,8 +1951,10 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
switch (ret) {
case BLK_MQ_RQ_QUEUE_BUSY:
if (atomic_read(&sdev->device_busy) == 0 &&
-   !scsi_device_blocked(sdev))
+   !scsi_device_blocked(sdev)) {
+   blk_mq_stop_hw_queue(hctx);
blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY);
+   }
break;
case BLK_MQ_RQ_QUEUE_ERROR:
/*
-- 
1.8.5.6

--
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: requeue failure with blk-mq-sched

2017-01-19 Thread Hannes Reinecke
On 01/19/2017 03:09 PM, Jens Axboe wrote:
> On 01/19/2017 04:27 AM, Hannes Reinecke wrote:
>> Hi Jens,
>>
>> upon further testing with your blk-mq-sched branch I hit a queue stall
>> during requeing:
>>
>> [  202.340959] sd 3:0:4:1: tag#473 Send: scmd 0x880422e7a440
>> [  202.340962] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
>> [  202.341161] sd 3:0:4:1: tag#473 Done: ADD_TO_MLQUEUE Result:
>> hostbyte=DID_OK driverbyte=DRIVER_OK
>> [  202.341164] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
>> [  202.341167] sd 3:0:4:1: tag#473 Sense Key : Unit Attention [current]
>> [  202.341171] sd 3:0:4:1: tag#473 Add. Sense: Power on, reset, or bus
>> device reset occurred
>> [  202.341173] sd 3:0:4:1: tag#473 scsi host busy 1 failed 0
>> [  202.341176] sd 3:0:4:1: tag#473 Inserting command 880422e7a440
>> into mlqueue
>>
>> ... and that is the last ever heard of that device.
>> The 'device_busy' count remains at '1' and no further commands will be
>> sent to the device.
> 
> If device_busy is at 1, then it should have a command pending. Where did
> you log this - it would be bandy if you attached whatever debug patch
> you put in, so we can see where the printks are coming from. If we get a
> BUSY with nothing pending, the driver should be ensuring that the queue
> gets run again later through blk_mq_delay_queue(), for instance.
> 
> When the device is stuck, does it restart if you send it IO?
> 
Meanwhile I've found it.

Problem is that scsi_queue_rq() will not stop the queue when hitting a
busy condition before sending commands down to the driver, but still
calls blk_mq_delay_queue():

switch (ret) {
case BLK_MQ_RQ_QUEUE_BUSY:
if (atomic_read(&sdev->device_busy) == 0 &&
!scsi_device_blocked(sdev))
blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY);
break;

As the queue isn't stopped blk_mq_delay_queue() won't do anything,
so queue_rq() will never be called.
I've send a patch to linux-scsi.

BTW: Is it a hard requirement that the queue has to be stopped when
returning BLK_MQ_RQ_QUEUE_BUSY?
The comments indicate as such, but none of the drivers do so...
Also, blk_mq_delay_queue() is a bit odd, in that it'll only start
stopped hardware queues. I would at least document that the queue has to
be stopped when calling that.
Better still, can't we have blk_mq_delay_queue start the queues
unconditionally?

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: requeue failure with blk-mq-sched

2017-01-19 Thread Jens Axboe
On 01/19/2017 06:24 AM, Hannes Reinecke wrote:
> On 01/19/2017 03:09 PM, Jens Axboe wrote:
>> On 01/19/2017 04:27 AM, Hannes Reinecke wrote:
>>> Hi Jens,
>>>
>>> upon further testing with your blk-mq-sched branch I hit a queue stall
>>> during requeing:
>>>
>>> [  202.340959] sd 3:0:4:1: tag#473 Send: scmd 0x880422e7a440
>>> [  202.340962] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
>>> [  202.341161] sd 3:0:4:1: tag#473 Done: ADD_TO_MLQUEUE Result:
>>> hostbyte=DID_OK driverbyte=DRIVER_OK
>>> [  202.341164] sd 3:0:4:1: tag#473 CDB: Test Unit Ready 00 00 00 00 00 00
>>> [  202.341167] sd 3:0:4:1: tag#473 Sense Key : Unit Attention [current]
>>> [  202.341171] sd 3:0:4:1: tag#473 Add. Sense: Power on, reset, or bus
>>> device reset occurred
>>> [  202.341173] sd 3:0:4:1: tag#473 scsi host busy 1 failed 0
>>> [  202.341176] sd 3:0:4:1: tag#473 Inserting command 880422e7a440
>>> into mlqueue
>>>
>>> ... and that is the last ever heard of that device.
>>> The 'device_busy' count remains at '1' and no further commands will be
>>> sent to the device.
>>
>> If device_busy is at 1, then it should have a command pending. Where did
>> you log this - it would be bandy if you attached whatever debug patch
>> you put in, so we can see where the printks are coming from. If we get a
>> BUSY with nothing pending, the driver should be ensuring that the queue
>> gets run again later through blk_mq_delay_queue(), for instance.
>>
>> When the device is stuck, does it restart if you send it IO?
>>
> Meanwhile I've found it.
> 
> Problem is that scsi_queue_rq() will not stop the queue when hitting a
> busy condition before sending commands down to the driver, but still
> calls blk_mq_delay_queue():
> 
>   switch (ret) {
>   case BLK_MQ_RQ_QUEUE_BUSY:
>   if (atomic_read(&sdev->device_busy) == 0 &&
>   !scsi_device_blocked(sdev))
>   blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY);
>   break;
> 
> As the queue isn't stopped blk_mq_delay_queue() won't do anything,
> so queue_rq() will never be called.
> I've send a patch to linux-scsi.
> 
> BTW: Is it a hard requirement that the queue has to be stopped when
> returning BLK_MQ_RQ_QUEUE_BUSY?

No, but currently it is apparently a hard requirement that the queue be
stopped when you call delay. Which does make sense, since there's little
point in doing the delay if the queue is run anyway.

> The comments indicate as such, but none of the drivers do so...
> Also, blk_mq_delay_queue() is a bit odd, in that it'll only start
> stopped hardware queues. I would at least document that the queue has to
> be stopped when calling that.
> Better still, can't we have blk_mq_delay_queue start the queues
> unconditionally?

I think so, it doesn't make sense to have blk_mq_delay_queue() NOT stop
the queue, yet its own work handler requires it to be set to actually
run.


diff --git a/block/blk-mq.c b/block/blk-mq.c
index fa1f8619bfe7..739a29208a63 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1161,8 +1161,8 @@ static void blk_mq_delay_work_fn(struct work_struct *work)
 
hctx = container_of(work, struct blk_mq_hw_ctx, delay_work.work);
 
-   if (test_and_clear_bit(BLK_MQ_S_STOPPED, &hctx->state))
-   __blk_mq_run_hw_queue(hctx);
+   clear_bit(BLK_MQ_S_STOPPED, &hctx->state);
+   __blk_mq_run_hw_queue(hctx);
 }
 
 void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs)

-- 
Jens Axboe

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


Re: [PATCH] scsi: mq queue stall during command requeue

2017-01-19 Thread Jens Axboe
On 01/19/2017 06:52 AM, Hannes Reinecke wrote:
> On 01/19/2017 03:46 PM, Christoph Hellwig wrote:
>> On Thu, Jan 19, 2017 at 03:17:45PM +0100, Hannes Reinecke wrote:
>>> When we're hitting a busy condition in queuecommand() we need to
>>> stop the hardware queue before calling blk_mq_delay_queue(); if
>>> we don't blk_mq_delay_queue() will not do anything and requeue
>>> will never triggered.
>>
>> I suspect the stop needs to move into blk_mq_delay_queue to make
>> it more useful.
>>
> Which is what I've suggested to Jens, too.
> And he even agreed to it :-)

Yeah, I made that patch and grepped the tree. The usage in the fc
code in nvme looks weird. It's stopping all potential hardware queues,
yet only delaying one.

if (op->rq) {   
blk_mq_stop_hw_queues(op->rq->q);   
blk_mq_delay_queue(queue->hctx, NVMEFC_QUEUE_DELAY);
}   
return BLK_MQ_RQ_QUEUE_BUSY;

James/Christoph, what's going on there? I'm going to leave that one
as-is for now, but add the stop to the delay. If the above stop-all is
indeed buggy, then it can later just be removed.

-- 
Jens Axboe

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


Re: [PATCH] scsi: mq queue stall during command requeue

2017-01-19 Thread Christoph Hellwig
On Thu, Jan 19, 2017 at 06:58:09AM -0800, Jens Axboe wrote:
> Yeah, I made that patch and grepped the tree. The usage in the fc
> code in nvme looks weird. It's stopping all potential hardware queues,
> yet only delaying one.
> 
> if (op->rq) {   
> blk_mq_stop_hw_queues(op->rq->q);   
> blk_mq_delay_queue(queue->hctx, NVMEFC_QUEUE_DELAY);
> }   
> return BLK_MQ_RQ_QUEUE_BUSY;
> 
> James/Christoph, what's going on there? I'm going to leave that one
> as-is for now, but add the stop to the delay. If the above stop-all is
> indeed buggy, then it can later just be removed.

It looks broken to me, but I'll need James to confirm.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] mpt3sas: Bump driver version to 15.100.00.00

2017-01-19 Thread Chaitra P B

Signed-off-by: Chaitra P B 
   Suganath Prabu 
---
 drivers/scsi/mpt3sas/mpt3sas_base.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 83cfa16..4ab634f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -73,9 +73,9 @@
 #define MPT3SAS_DRIVER_NAME"mpt3sas"
 #define MPT3SAS_AUTHOR "Avago Technologies "
 #define MPT3SAS_DESCRIPTION"LSI MPT Fusion SAS 3.0 Device Driver"
-#define MPT3SAS_DRIVER_VERSION "14.101.00.00"
-#define MPT3SAS_MAJOR_VERSION  14
-#define MPT3SAS_MINOR_VERSION  101
+#define MPT3SAS_DRIVER_VERSION "15.100.00.00"
+#define MPT3SAS_MAJOR_VERSION  15
+#define MPT3SAS_MINOR_VERSION  100
 #define MPT3SAS_BUILD_VERSION  0
 #define MPT3SAS_RELEASE_VERSION00
 
-- 
1.7.1

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


[PATCH 1/4] mpt3sas: Added print to notify cable running at a degraded speed.

2017-01-19 Thread Chaitra P B
Driver processes the event MPI26_EVENT_ACTIVE_CABLE_DEGRADED
when a cable is present and is running at a degraded speed
(below the SAS3 12 Gb/s rate). Prints added
to inform the user that the cable is not running at
optimal speed.

Signed-off-by: Chaitra P B 
   Suganath Prabu 
---
 drivers/scsi/mpt3sas/mpi/mpi2_ioc.h  |2 ++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   18 +-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h 
b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h
index 8bae305..af4be40 100644
--- a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h
+++ b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h
@@ -624,6 +624,8 @@ typedef struct _MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT {
 
 /* defines for ReasonCode field */
 #define MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00)
+#define MPI26_EVENT_ACTIVE_CABLE_PRESENT(0x01)
+#define MPI26_EVENT_ACTIVE_CABLE_DEGRADED   (0x02)
 
 /*Hard Reset Received Event data */
 
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 75f3fce..5ffbfb1 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -8028,15 +8028,23 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER 
*ioc, u8 msix_index,
case MPI2_EVENT_ACTIVE_CABLE_EXCEPTION:
ActiveCableEventData =
(Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;
-   if (ActiveCableEventData->ReasonCode ==
-   MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER) {
+   switch (ActiveCableEventData->ReasonCode) {
+   case MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER:
pr_info(MPT3SAS_FMT "Currently an active cable with 
ReceptacleID %d",
ioc->name, ActiveCableEventData->ReceptacleID);
-   pr_info("cannot be powered and devices connected to 
this active cable");
-   pr_info("will not be seen. This active cable");
-   pr_info("requires %d mW of power",
+   pr_info(" cannot be powered and devices connected to");
+   pr_info(" this active cable will not be seen. This");
+   pr_info(" cable requires %d mW of power",
ActiveCableEventData->ActiveCablePowerRequirement);
+   break;
+
+   case MPI26_EVENT_ACTIVE_CABLE_DEGRADED:
+   pr_info(MPT3SAS_FMT "Currently a cable with 
ReceptacleID %d",
+   ioc->name, ActiveCableEventData->ReceptacleID);
+   pr_info(" is not running at optimal speed(12 Gb/s)\n");
+   break;
}
+
break;
 
default: /* ignore the rest */
-- 
1.7.1

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


[PATCH 3/4] mpt3sas: Fix Firmware fault state 0x2100 during heavy 4K RR FIO stress test.

2017-01-19 Thread Chaitra P B
Due existence of loop in the IO path our HBA will receive heavy IOs and
also as driver is not updating the Reply Post Host Index frequently, So
there will be a high chance that our Firmware unable to find any free entry
in the Reply Post Descriptor Queue (i.e. Queue overflow occurs) and can
observe 0x2100 firmware fault.
So to fix this, we have defined a thresh hold value. After continuously
processing this threshold number of reply descriptors driver will update
the Reply Descriptor Host Index so that this threshold number of reply
descriptors entries will be freed and these entries will be available for
firmware and we won't observe this Firmware fault. We have defined this
threshold value as 1/3rd of the hba queue depth.

Signed-off-by: Chaitra P B 
   Suganath Prabu 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 722fab9..a3fe1fb 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1040,6 +1040,25 @@ _base_interrupt(int irq, void *bus_id)
reply_q->reply_post_free[reply_q->reply_post_host_index].
Default.ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
completed_cmds++;
+   /* Update the reply post host index after continuously
+* processing the threshold number of Reply Descriptors.
+* So that FW can find enough entries to post the Reply
+* Descriptors in the reply descriptor post queue.
+*/
+   if (completed_cmds > ioc->hba_queue_depth/3) {
+   if (ioc->combined_reply_queue) {
+   writel(reply_q->reply_post_host_index |
+   ((msix_index  & 7) <<
+MPI2_RPHI_MSIX_INDEX_SHIFT),
+   ioc->replyPostRegisterIndex[msix_index/8]);
+   } else {
+   writel(reply_q->reply_post_host_index |
+   (msix_index <<
+MPI2_RPHI_MSIX_INDEX_SHIFT),
+   &ioc->chip->ReplyPostHostIndex);
+   }
+   completed_cmds = 1;
+   }
if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
goto out;
if (!reply_q->reply_post_host_index)
-- 
1.7.1

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


[PATCH 2/4] mpt3sas: Fix for Crusader to achieve product targets with SAS devices.

2017-01-19 Thread Chaitra P B
Small glitch/degraded performance in Crusader is improved with SAS
drives by removing unnecessary spinlocks while clearing scsi command
in drivers internal lookup table.

Signed-off-by: Chaitra P B 
   Suganath Prabu 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  |1 +
 drivers/scsi/mpt3sas/mpt3sas_base.h  |1 +
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |4 +++-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   29 -
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index f00ef88..722fab9 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -5522,6 +5522,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
goto out_free_resources;
 
ioc->non_operational_loop = 0;
+   ioc->got_task_abort_from_ioctl = 0;
return 0;
 
  out_free_resources:
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index dcb33f4..83cfa16 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1000,6 +1000,7 @@ struct MPT3SAS_ADAPTER {
u8  broadcast_aen_busy;
u16 broadcast_aen_pending;
u8  shost_recovery;
+   u8  got_task_abort_from_ioctl;
 
struct mutexreset_in_progress_mutex;
spinlock_t  ioc_reset_in_progress_lock;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 95f0f24..02fe1c4 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -826,16 +826,18 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct 
mpt3_ioctl_command karg,
"TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n",
ioc->name,
le16_to_cpu(tm_request->DevHandle), tm_request->TaskType));
-
+   ioc->got_task_abort_from_ioctl = 1;
if (tm_request->TaskType ==
MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK ||
tm_request->TaskType ==
MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK) {
if (_ctl_set_task_mid(ioc, &karg, tm_request)) {
mpt3sas_base_free_smid(ioc, smid);
+   ioc->got_task_abort_from_ioctl = 0;
goto out;
}
}
+   ioc->got_task_abort_from_ioctl = 0;
 
if (test_bit(device_handle, ioc->device_remove_in_progress)) {
dtmprintk(ioc, pr_info(MPT3SAS_FMT
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 5ffbfb1..b3f9f7a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -1096,6 +1096,27 @@ _scsih_scsi_lookup_get_clear(struct MPT3SAS_ADAPTER 
*ioc, u16 smid)
 }
 
 /**
+ * _scsih_scsi_lookup_get_clear_without_lock - returns scmd entry without
+ * holding any lock.
+ * @ioc: per adapter object
+ * @smid: system request message index
+ *
+ * Returns the smid stored scmd pointer.
+ * Then will derefrence the stored scmd pointer.
+ */
+static inline struct scsi_cmnd *
+_scsih_scsi_lookup_get_clear_without_lock(struct MPT3SAS_ADAPTER *ioc,
+   u16 smid)
+{
+   struct scsi_cmnd *scmd;
+
+   scmd = ioc->scsi_lookup[smid - 1].scmd;
+   ioc->scsi_lookup[smid - 1].scmd = NULL;
+
+   return scmd;
+}
+
+/**
  * _scsih_scsi_lookup_find_by_scmd - scmd lookup
  * @ioc: per adapter object
  * @smid: system request message index
@@ -4659,7 +4680,13 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 
msix_index, u32 reply)
unsigned long flags;
 
mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
-   scmd = _scsih_scsi_lookup_get_clear(ioc, smid);
+
+   if (ioc->broadcast_aen_busy || ioc->pci_error_recovery ||
+   ioc->got_task_abort_from_ioctl)
+   scmd = _scsih_scsi_lookup_get_clear(ioc, smid);
+   else
+   scmd = _scsih_scsi_lookup_get_clear_without_lock(ioc, smid);
+
if (scmd == NULL)
return 1;
 
-- 
1.7.1

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


[PATCH 0/4] mpt3sas driver Enhancements and

2017-01-19 Thread Chaitra P B
Here is the change list:
Posting 4 patches for mpt3sas driver enhancement and defect fixes.
  * Handle cable event for notifying degraded speed.
  * Performance improvement for Crusader.
  * Fix Firmware fault state 0x2100 during heavy 4K RR
FIO stress test.
  * Updated driver version to 15.100.00.00

Chaitra P B (4):
  mpt3sas: Added print to notify cable running at a  degraded
speed.
  mpt3sas: Fix for Crusader to achieve product targets with  SAS
devices.
  mpt3sas: Fix Firmware fault state 0x2100 during heavy 4K RR  FIO
stress test.
  mpt3sas: Bump driver version to 15.100.00.00

 drivers/scsi/mpt3sas/mpi/mpi2_ioc.h  |2 +
 drivers/scsi/mpt3sas/mpt3sas_base.c  |   20 ++
 drivers/scsi/mpt3sas/mpt3sas_base.h  |7 +++--
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |4 ++-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   47 +
 5 files changed, 70 insertions(+), 10 deletions(-)

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


Re: [PATCH 2/4] mpt3sas: Fix for Crusader to achieve product targets with SAS devices.

2017-01-19 Thread Bart Van Assche
On Thu, 2017-01-19 at 21:19 +0530, Chaitra P B wrote:
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
> b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index 5ffbfb1..b3f9f7a 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> @@ -1096,6 +1096,27 @@ _scsih_scsi_lookup_get_clear(struct MPT3SAS_ADAPTER 
> *ioc, u16 smid)
>  }
>  
>  /**
> + * _scsih_scsi_lookup_get_clear_without_lock - returns scmd entry without
> + *   holding any lock.
> + * @ioc: per adapter object
> + * @smid: system request message index
> + *
> + * Returns the smid stored scmd pointer.
> + * Then will derefrence the stored scmd pointer.
> + */
> +static inline struct scsi_cmnd *
> +_scsih_scsi_lookup_get_clear_without_lock(struct MPT3SAS_ADAPTER *ioc,
> + u16 smid)
> +{
> + struct scsi_cmnd *scmd;
> +
> + scmd = ioc->scsi_lookup[smid - 1].scmd;
> + ioc->scsi_lookup[smid - 1].scmd = NULL;
> +
> + return scmd;
> +}

Please make the following changes in the above code:
* Use swap() instead of open-coding it.
* Call _scsih_scsi_lookup_get_clear_without_lock() from
  _scsih_scsi_lookup_get_clear() to avoid code duplication.
* Fix the spelling of "dereference".

Thanks,

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


Re: [PATCH] scsi: mq queue stall during command requeue

2017-01-19 Thread Bart Van Assche
On Thu, 2017-01-19 at 15:17 +0100, Hannes Reinecke wrote:
> When we're hitting a busy condition in queuecommand() we need to
> stop the hardware queue before calling blk_mq_delay_queue(); if
> we don't blk_mq_delay_queue() will not do anything and requeue
> will never triggered.
> 
> Signed-off-by: Hannes Reinecke 
> ---
>  drivers/scsi/scsi_lib.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index e9e1e14..4b1cbc6 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1951,8 +1951,10 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
>   switch (ret) {
>   case BLK_MQ_RQ_QUEUE_BUSY:
>   if (atomic_read(&sdev->device_busy) == 0 &&
> - !scsi_device_blocked(sdev))
> + !scsi_device_blocked(sdev)) {
> + blk_mq_stop_hw_queue(hctx);
>   blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY);
> + }
>   break;
>   case BLK_MQ_RQ_QUEUE_ERROR:
>   /*

You may want to add Fixes: 52d7f1b5c2f3 (blk-mq: Avoid that requeueing
starts stopped queues). See also
https://www.spinics.net/lists/linux-block/msg06144.html.

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


Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A

2017-01-19 Thread James Smart

Nevermind - I misread the "-" for "+". will fix

-- james

--
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: mq queue stall during command requeue

2017-01-19 Thread Hannes Reinecke
On 01/19/2017 03:46 PM, Christoph Hellwig wrote:
> On Thu, Jan 19, 2017 at 03:17:45PM +0100, Hannes Reinecke wrote:
>> When we're hitting a busy condition in queuecommand() we need to
>> stop the hardware queue before calling blk_mq_delay_queue(); if
>> we don't blk_mq_delay_queue() will not do anything and requeue
>> will never triggered.
> 
> I suspect the stop needs to move into blk_mq_delay_queue to make
> it more useful.
> 
Which is what I've suggested to Jens, too.
And he even agreed to it :-)

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] scsi: scsi_transport_fc: Provide a lightweight option for Virtual FC Hosts.

2017-01-19 Thread Christoph Hellwig
On Wed, Jan 18, 2017 at 03:28:57PM -0500, Cathy Avery wrote:
> The patch provides a means to offer a lightweight option to the
> current FC transport class. The new option is selected by a
> driver when it indicates it wants the lightweight
> transport via fc_function_template.

This need some really good documentation in the code and changelog
what "lightweight" means.  It's a pretty horrible term, btw.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] scsi: scsi_transport_fc: Provide a lightweight option for Virtual FC Hosts.

2017-01-19 Thread Cathy Avery



On 01/19/2017 10:11 AM, Christoph Hellwig wrote:

On Wed, Jan 18, 2017 at 03:28:57PM -0500, Cathy Avery wrote:

The patch provides a means to offer a lightweight option to the
current FC transport class. The new option is selected by a
driver when it indicates it wants the lightweight
transport via fc_function_template.

This need some really good documentation in the code and changelog
what "lightweight" means.  It's a pretty horrible term, btw.


Thanks, I will work on better documentation and a better name.

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


Re: [PATCH 2/2] scsi: storvsc: Add support for FC lightweight host.

2017-01-19 Thread Cathy Avery



On 01/18/2017 06:15 PM, Dan Carpenter wrote:

On Wed, Jan 18, 2017 at 03:28:58PM -0500, Cathy Avery wrote:

Enable FC lightweight host option so that the luns exposed by
the driver may be manually scanned.

Signed-off-by: Cathy Avery 
---
  drivers/scsi/storvsc_drv.c | 6 +-
  1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 888e16e..fc1d6ba 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1882,6 +1882,7 @@ static struct hv_driver storvsc_drv = {
  static struct fc_function_template fc_transport_functions = {
.show_host_node_name = 1,
.show_host_port_name = 1,
+   .lightweight_transport = 1,
  };
  #endif
  
@@ -1906,11 +1907,6 @@ static int __init storvsc_drv_init(void)

fc_transport_template = fc_attach_transport(&fc_transport_functions);
if (!fc_transport_template)
return -ENODEV;
-
-   /*
-* Install Hyper-V specific timeout handler.
-*/
-   fc_transport_template->eh_timed_out = storvsc_eh_timed_out;

I don't undestand how removing this is related.


Its not related but it is also not necessary so I took it out. The 
default scsi timeout handler will be used.


I can certainly put it back.

Cathy


regards,
dan carpenter


--
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: mq queue stall during command requeue

2017-01-19 Thread Christoph Hellwig
On Thu, Jan 19, 2017 at 03:17:45PM +0100, Hannes Reinecke wrote:
> When we're hitting a busy condition in queuecommand() we need to
> stop the hardware queue before calling blk_mq_delay_queue(); if
> we don't blk_mq_delay_queue() will not do anything and requeue
> will never triggered.

I suspect the stop needs to move into blk_mq_delay_queue to make
it more useful.
--
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: command emulation fix

2017-01-19 Thread Christoph Hellwig
On Thu, Jan 19, 2017 at 03:34:58PM -0500, Tejun Heo wrote:
> So, unless we allocate one mempool per port, we're gonna have to
> synchronize around its use anyway.  mempool can't guarantee allocation
> to multiple users at the same time.  If this is something which
> affects scalability, I'm completley fine with making it per-port (or
> device).  Each ata_port carries 512 byte buffer anyway.  Maybe we can
> reuse that?

I'll play around with these things a bit more.  For the slow
path ops I think I can get away without any dynamic allocation
at all - just use small on-stack buffers.

For DSM / Write Same we rewrite into the buffer the SCSI layer
provided us.  This is a bit of an issue anyway as this might
modify user data that is not expected to be rewritten or even
mapped read-only.  Maybe we need to kill off that emulation
entirely and just have ATA DSM using the ATA_16 CDB as another
provisioning option in sd.c.  While that is a bit of a layering
violation it would solve a lot of problems with the way TRIM
is currently implemented.
--
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 00/12] qla2xxx: Feature updates for target.

2017-01-19 Thread Bart Van Assche
On Wed, 2017-01-18 at 15:19 -0800, Himanshu Madhani wrote:
> Changes from v2 --> v3
> 
> o Cleaned up sparse warnings reported by you.

Not all warnings have been addressed. I still see the following smatch
warnings:

  CHECK   drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_init.c:265: qla2x00_async_logout() error: we 
previously assumed 'sp' could be null (see line 241)

  CHECK   drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_isr.c:1456: qla2x00_ct_entry() warn: inconsistent 
indenting

The second warning is minor but is easy to address. The first one is
serious and applies to the following code: if (!sp) ... sp->
Please address these smatch warnings.

Thanks,

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


Re: [LSF/MM TOPIC][LSF/MM ATTEND] NAPI polling for block drivers

2017-01-19 Thread Jens Axboe
On 01/18/2017 06:02 AM, Hannes Reinecke wrote:
> On 01/17/2017 05:50 PM, Sagi Grimberg wrote:
>>
>>> So it looks like we are super not efficient because most of the
>>> times we catch 1
>>> completion per interrupt and the whole point is that we need to find
>>> more! This fio
>>> is single threaded with QD=32 so I'd expect that we be somewhere in
>>> 8-31 almost all
>>> the time... I also tried QD=1024, histogram is still the same.
>>>
>>>
>>> It looks like it takes you longer to submit an I/O than to service an
>>> interrupt,
>>
>> Well, with irq-poll we do practically nothing in the interrupt handler,
>> only schedule irq-poll. Note that the latency measures are only from
>> the point the interrupt arrives and the point we actually service it
>> by polling for completions.
>>
>>> so increasing queue depth in the singe-threaded case doesn't
>>> make much difference. You might want to try multiple threads per core
>>> with QD, say, 32
>>
>> This is how I ran, QD=32.
> 
> The one thing which I found _really_ curious is this:
> 
>   IO depths: 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%,
>> =64=100.0%
>  submit: 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
>> =64=0.0%
>  complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
>> =64=0.1%
>  issued: total=r=7673377/w=0/d=0, short=r=0/w=0/d=0,
> drop=r=0/w=0/d=0
>  latency   : target=0, window=0, percentile=100.00%, depth=256
> 
> (note the lines starting with 'submit' and 'complete').
> They are _always_ 4, irrespective of the hardware and/or tests which I
> run. Jens, what are these numbers supposed to mean?
> Is this intended?

It's bucketized. 0=0.0% means that 0% of the submissions didn't submit
anything (unsurprisingly), and ditto for the complete side. The next bucket
is 1..4, so 100% of submissions and completions was in that range.

-- 
Jens Axboe

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


[GIT PULL] SCSI fixes for 4.10-rc4

2017-01-19 Thread James Bottomley
This is a set of 12 fixes including the mpt3sas one that was causing
hangs on ATA passthrough.  The others are a couple of zoned block
device fixes, a SAS device detection bug which lead to SATA drives not
being matched to bays, two qla2xxx MSI fixes, a qla2xxx req for rsp
confusion caused by cut and paste, and a few other minor fixes.

The patch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

The short changelog is:

Christoph Hellwig (2):
  scsi: qla2xxx: remove irq_affinity_notifier
  scsi: qla2xxx: fix MSI-X vector affinity

Damien Le Moal (2):
  scsi: sd: Ignore zoned field for host-managed devices
  scsi: sd: Fix wrong DPOFUA disable in sd_read_cache_type

Dave Jones (1):
  scsi: qla2xxx: Fix apparent cut-n-paste error.

Ewan D. Milne (1):
  scsi: ses: Fix SAS device detection in enclosure

Fam Zheng (1):
  scsi: libfc: Fix variable name in fc_set_wwpn

James Bottomley (1):
  scsi: mpt3sas: fix hang on ata passthrough commands

Johannes Thumshirn (2):
  scsi: lpfc: Set elsiocb contexts to NULL after freeing it
  scsi: bfa: fix wrongly initialized variable in 
bfad_im_bsg_els_ct_request()

Milan P. Gandhi (1):
  scsi: qla2xxx: Get mutex lock before checking optrom_state

Roberto Sassu (1):
  scsi: lpfc: avoid double free of resource identifiers

And the diffstat:

 drivers/scsi/bfa/bfad_bsg.c  |  2 +-
 drivers/scsi/lpfc/lpfc_els.c |  2 +
 drivers/scsi/lpfc/lpfc_sli.c |  7 +++
 drivers/scsi/mpt3sas/mpt3sas_base.h  | 12 +
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 40 ++--
 drivers/scsi/qla2xxx/qla_attr.c  | 18 ++--
 drivers/scsi/qla2xxx/qla_def.h   |  3 +-
 drivers/scsi/qla2xxx/qla_isr.c   | 88 +---
 drivers/scsi/qla2xxx/qla_os.c|  2 +-
 drivers/scsi/sd.c| 23 +++---
 drivers/scsi/ses.c   |  2 +-
 include/scsi/libfc.h |  6 +--
 12 files changed, 94 insertions(+), 111 deletions(-)

With full diff below.

James

---

diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index a9a0016..b2e8c0d 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -3363,7 +3363,7 @@ bfad_im_bsg_els_ct_request(struct bsg_job *job)
struct bfad_fcxp*drv_fcxp;
struct bfa_fcs_lport_s *fcs_port;
struct bfa_fcs_rport_s *fcs_rport;
-   struct fc_bsg_request *bsg_request = bsg_request;
+   struct fc_bsg_request *bsg_request = job->request;
struct fc_bsg_reply *bsg_reply = job->reply;
uint32_t command_type = bsg_request->msgcode;
unsigned long flags;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 236e4e5..7b6bd8e 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -3590,12 +3590,14 @@ lpfc_els_free_iocb(struct lpfc_hba *phba, struct 
lpfc_iocbq *elsiocb)
} else {
buf_ptr1 = (struct lpfc_dmabuf *) elsiocb->context2;
lpfc_els_free_data(phba, buf_ptr1);
+   elsiocb->context2 = NULL;
}
}
 
if (elsiocb->context3) {
buf_ptr = (struct lpfc_dmabuf *) elsiocb->context3;
lpfc_els_free_bpl(phba, buf_ptr);
+   elsiocb->context3 = NULL;
}
lpfc_sli_release_iocbq(phba, elsiocb);
return 0;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 4faa767..a78a3df 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -5954,18 +5954,25 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba 
*phba)
 
  free_vfi_bmask:
kfree(phba->sli4_hba.vfi_bmask);
+   phba->sli4_hba.vfi_bmask = NULL;
  free_xri_ids:
kfree(phba->sli4_hba.xri_ids);
+   phba->sli4_hba.xri_ids = NULL;
  free_xri_bmask:
kfree(phba->sli4_hba.xri_bmask);
+   phba->sli4_hba.xri_bmask = NULL;
  free_vpi_ids:
kfree(phba->vpi_ids);
+   phba->vpi_ids = NULL;
  free_vpi_bmask:
kfree(phba->vpi_bmask);
+   phba->vpi_bmask = NULL;
  free_rpi_ids:
kfree(phba->sli4_hba.rpi_ids);
+   phba->sli4_hba.rpi_ids = NULL;
  free_rpi_bmask:
kfree(phba->sli4_hba.rpi_bmask);
+   phba->sli4_hba.rpi_bmask = NULL;
  err_exit:
return rc;
 }
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 394fe13..dcb33f4 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -393,6 +393,7 @@ struct MPT3SAS_TARGET {
  * @eedp_enable: eedp support enable bit
  * @eedp_type: 0(type_1), 1(type_2), 2(type_3)
  * @eedp_block_length: block size
+ * @ata_command_pending: SATL passthrough outstanding for device
  */
 struct MPT3SAS_DEVICE {
struct MPT3SAS_TARGET *sas_target;
@@ -404,6 +405,17 @@ struct MPT3SAS_DEVICE {
u8  igno

[PATCH v4 01/12] qla2xxx: Remove direct access of scsi_status field in se_cmd

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Reviewed-by: Christoph Hellwig 
Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h| 1 +
 drivers/scsi/qla2xxx/qla_target.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 1f7c6d2..1196150 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1794,6 +1794,7 @@ struct crc_context {
 #define SS_RESIDUAL_OVER   BIT_10
 #define SS_SENSE_LEN_VALID BIT_9
 #define SS_RESPONSE_INFO_LEN_VALID BIT_8
+#define SS_SCSI_STATUS_BYTE0xff
 
 #define SS_RESERVE_CONFLICT(BIT_4 | BIT_3)
 #define SS_BUSY_CONDITION  BIT_3
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 9c6cb75..47acc26 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2288,7 +2288,7 @@ static void qlt_24xx_init_ctio_to_isp(struct 
ctio7_to_24xx *ctio,
int i;
 
if (qlt_need_explicit_conf(prm->tgt->ha, prm->cmd, 1)) {
-   if (prm->cmd->se_cmd.scsi_status != 0) {
+   if ((prm->rq_result & SS_SCSI_STATUS_BYTE) != 0) {
ql_dbg(ql_dbg_tgt, prm->cmd->vha, 0xe017,
"Skipping EXPLICIT_CONFORM and "
"CTIO7_FLAGS_CONFORM_REQ for FCP READ w/ "
-- 
1.8.3.1

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


[PATCH v4 05/12] qla2xxx: Fix wrong argument in sp done callback.

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Callback for sp->done expects scsi_qla_host is passed in as argument,
Instead qla_hw_data is passed in.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_isr.c | 8 
 drivers/scsi/qla2xxx/qla_mr.c  | 6 +++---
 drivers/scsi/qla2xxx/qla_os.c  | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 0c6bd93..87b57bf 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1216,7 +1216,7 @@ static void qla_irq_affinity_notify(struct 
irq_affinity_notify *,
req->outstanding_cmds[index] = NULL;
 
/* Save ISP completion status */
-   sp->done(ha, sp, DID_OK << 16);
+   sp->done(vha, sp, DID_OK << 16);
} else {
ql_log(ql_log_warn, vha, 0x3016, "Invalid SCSI SRB.\n");
 
@@ -2409,7 +2409,7 @@ struct scsi_dif_tuple {
resid_len, fw_resid_len, sp, cp);
 
if (rsp->status_srb == NULL)
-   sp->done(ha, sp, res);
+   sp->done(vha, sp, res);
 }
 
 /**
@@ -2466,7 +2466,7 @@ struct scsi_dif_tuple {
/* Place command on done queue. */
if (sense_len == 0) {
rsp->status_srb = NULL;
-   sp->done(ha, sp, cp->result);
+   sp->done(vha, sp, cp->result);
}
 }
 
@@ -2502,7 +2502,7 @@ struct scsi_dif_tuple {
 
sp = qla2x00_get_sp_from_handle(vha, func, req, pkt);
if (sp) {
-   sp->done(ha, sp, res);
+   sp->done(vha, sp, res);
return;
}
 fatal:
diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index 02f1de1..d38bc64 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -2537,7 +2537,7 @@
par_sense_len, rsp_info_len);
 
if (rsp->status_srb == NULL)
-   sp->done(ha, sp, res);
+   sp->done(vha, sp, res);
 }
 
 /**
@@ -2614,7 +2614,7 @@
/* Place command on done queue. */
if (sense_len == 0) {
rsp->status_srb = NULL;
-   sp->done(ha, sp, cp->result);
+   sp->done(vha, sp, cp->result);
}
 }
 
@@ -2695,7 +2695,7 @@
 
sp = qla2x00_get_sp_from_handle(vha, func, req, pkt);
if (sp) {
-   sp->done(ha, sp, res);
+   sp->done(vha, sp, res);
return;
}
 
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 074dcca..65eca89 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1203,7 +1203,7 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)
}
 
spin_lock_irqsave(&ha->hardware_lock, flags);
-   sp->done(ha, sp, 0);
+   sp->done(vha, sp, 0);
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
/* Did the command return during mailbox execution? */
-- 
1.8.3.1

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


[PATCH v4 10/12] qla2xxx: Remove unused reverse_ini_mode.

2017-01-19 Thread Himanshu Madhani
With support for dual mode in the driver, this mode becomes
dead code. Remove reverse_ini_mode from code.

Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h|  1 -
 drivers/scsi/qla2xxx/qla_target.c | 10 --
 drivers/scsi/qla2xxx/qla_target.h |  8 
 3 files changed, 19 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index fd179df..b447b01 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3238,7 +3238,6 @@ struct qlt_hw_data {
/* Protected by hw lock */
uint32_t enable_class_2:1;
uint32_t enable_explicit_conf:1;
-   uint32_t ini_mode_force_reverse:1;
uint32_t node_name_set:1;
 
dma_addr_t atio_dma;/* Physical address. */
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 225d2bf..62cee7b 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -5855,8 +5855,6 @@ void qlt_lport_deregister(struct scsi_qla_host *vha)
 /* Must be called under HW lock */
 static void qlt_set_mode(struct scsi_qla_host *vha)
 {
-   struct qla_hw_data *ha = vha->hw;
-
switch (ql2x_ini_mode) {
case QLA2XXX_INI_MODE_DISABLED:
case QLA2XXX_INI_MODE_EXCLUSIVE:
@@ -5871,16 +5869,11 @@ static void qlt_set_mode(struct scsi_qla_host *vha)
default:
break;
}
-
-   if (ha->tgt.ini_mode_force_reverse)
-   qla_reverse_ini_mode(vha);
 }
 
 /* Must be called under HW lock */
 static void qlt_clear_mode(struct scsi_qla_host *vha)
 {
-   struct qla_hw_data *ha = vha->hw;
-
switch (ql2x_ini_mode) {
case QLA2XXX_INI_MODE_DISABLED:
vha->host->active_mode = MODE_UNKNOWN;
@@ -5895,9 +5888,6 @@ static void qlt_clear_mode(struct scsi_qla_host *vha)
default:
break;
}
-
-   if (ha->tgt.ini_mode_force_reverse)
-   qla_reverse_ini_mode(vha);
 }
 
 /*
diff --git a/drivers/scsi/qla2xxx/qla_target.h 
b/drivers/scsi/qla2xxx/qla_target.h
index ac86b37..a7f90dc 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -995,14 +995,6 @@ static inline bool qla_dual_mode_enabled(struct 
scsi_qla_host *ha)
return (ha->host->active_mode == MODE_DUAL);
 }
 
-static inline void qla_reverse_ini_mode(struct scsi_qla_host *ha)
-{
-   if (ha->host->active_mode & MODE_INITIATOR)
-   ha->host->active_mode &= ~MODE_INITIATOR;
-   else
-   ha->host->active_mode |= MODE_INITIATOR;
-}
-
 static inline uint32_t sid_to_key(const uint8_t *s_id)
 {
uint32_t key;
-- 
1.8.3.1

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


[PATCH v4 04/12] qla2xxx: Remove SRR code.

2017-01-19 Thread Himanshu Madhani
During initial implementation, tape support was included but not
enabled by default on target. So far, we don't see any target
customer requesting this support. Since this code is not being
used actively, we want to remove it and we will add back if there
are any request in future for SRR support.

Reviewed-by: Christoph Hellwig 
Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_target.c | 641 --
 drivers/scsi/qla2xxx/qla_target.h |  21 --
 2 files changed, 662 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 1bd9cac..74709d3 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -106,8 +106,6 @@ static int qlt_issue_task_mgmt(struct qla_tgt_sess *sess, 
uint32_t lun,
int fn, void *iocb, int flags);
 static void qlt_send_term_exchange(struct scsi_qla_host *ha, struct qla_tgt_cmd
*cmd, struct atio_from_isp *atio, int ha_locked, int ul_abort);
-static void qlt_reject_free_srr_imm(struct scsi_qla_host *ha,
-   struct qla_tgt_srr_imm *imm, int ha_lock);
 static void qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha,
struct qla_tgt_cmd *cmd);
 static void qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
@@ -2183,95 +2181,6 @@ static inline int qlt_need_explicit_conf(struct 
qla_hw_data *ha,
cmd->conf_compl_supported;
 }
 
-#ifdef CONFIG_QLA_TGT_DEBUG_SRR
-/*
- *  Original taken from the XFS code
- */
-static unsigned long qlt_srr_random(void)
-{
-   static int Inited;
-   static unsigned long RandomValue;
-   static DEFINE_SPINLOCK(lock);
-   /* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */
-   register long rv;
-   register long lo;
-   register long hi;
-   unsigned long flags;
-
-   spin_lock_irqsave(&lock, flags);
-   if (!Inited) {
-   RandomValue = jiffies;
-   Inited = 1;
-   }
-   rv = RandomValue;
-   hi = rv / 127773;
-   lo = rv % 127773;
-   rv = 16807 * lo - 2836 * hi;
-   if (rv <= 0)
-   rv += 2147483647;
-   RandomValue = rv;
-   spin_unlock_irqrestore(&lock, flags);
-   return rv;
-}
-
-static void qlt_check_srr_debug(struct qla_tgt_cmd *cmd, int *xmit_type)
-{
-#if 0 /* This is not a real status packets lost, so it won't lead to SRR */
-   if ((*xmit_type & QLA_TGT_XMIT_STATUS) && (qlt_srr_random() % 200)
-   == 50) {
-   *xmit_type &= ~QLA_TGT_XMIT_STATUS;
-   ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf015,
-   "Dropping cmd %p (tag %d) status", cmd, se_cmd->tag);
-   }
-#endif
-   /*
-* It's currently not possible to simulate SRRs for FCP_WRITE without
-* a physical link layer failure, so don't even try here..
-*/
-   if (cmd->dma_data_direction != DMA_FROM_DEVICE)
-   return;
-
-   if (qlt_has_data(cmd) && (cmd->sg_cnt > 1) &&
-   ((qlt_srr_random() % 100) == 20)) {
-   int i, leave = 0;
-   unsigned int tot_len = 0;
-
-   while (leave == 0)
-   leave = qlt_srr_random() % cmd->sg_cnt;
-
-   for (i = 0; i < leave; i++)
-   tot_len += cmd->sg[i].length;
-
-   ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf016,
-   "Cutting cmd %p (tag %d) buffer"
-   " tail to len %d, sg_cnt %d (cmd->bufflen %d,"
-   " cmd->sg_cnt %d)", cmd, se_cmd->tag, tot_len, leave,
-   cmd->bufflen, cmd->sg_cnt);
-
-   cmd->bufflen = tot_len;
-   cmd->sg_cnt = leave;
-   }
-
-   if (qlt_has_data(cmd) && ((qlt_srr_random() % 100) == 70)) {
-   unsigned int offset = qlt_srr_random() % cmd->bufflen;
-
-   ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf017,
-   "Cutting cmd %p (tag %d) buffer head "
-   "to offset %d (cmd->bufflen %d)", cmd, se_cmd->tag, offset,
-   cmd->bufflen);
-   if (offset == 0)
-   *xmit_type &= ~QLA_TGT_XMIT_DATA;
-   else if (qlt_set_data_offset(cmd, offset)) {
-   ql_dbg(ql_dbg_tgt_mgt, cmd->vha, 0xf018,
-   "qlt_set_data_offset() failed (tag %d)", 
se_cmd->tag);
-   }
-   }
-}
-#else
-static inline void qlt_check_srr_debug(struct qla_tgt_cmd *cmd, int *xmit_type)
-{}
-#endif
-
 static void qlt_24xx_init_ctio_to_isp(struct ctio7_to_24xx *ctio,
struct qla_tgt_prm *prm)
 {
@@ -2686,7 +2595,6 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int 
xmit_type,
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
memset(&prm, 0, sizeof(prm));
-   qlt_check_srr_debug(cmd, &xmit_type);
 
ql_dbg(ql_dbg_tgt, cmd->vha, 0xe018,
"is_send_status=%d, cmd->bufflen=%d, cmd

[PATCH v4 02/12] qla2xxx: Cleanup TMF code translation from qla_target.

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Move code code which converts Task Mgmt Command flags for
ATIO to TCM #defines, from qla2xxx driver to tcm_qla2xxx
driver.

Reviewed-by: Christoph Hellwig 
Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_target.c  | 75 --
 drivers/scsi/qla2xxx/qla_target.h  |  6 ++-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 40 +++-
 3 files changed, 49 insertions(+), 72 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 47acc26..39e6a02 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1592,8 +1592,9 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host 
*vha,
mcmd->sess = sess;
memcpy(&mcmd->orig_iocb.abts, abts, sizeof(mcmd->orig_iocb.abts));
mcmd->reset_count = vha->hw->chip_reset;
+   mcmd->tmr_func = QLA_TGT_ABTS;
 
-   rc = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, TMR_ABORT_TASK,
+   rc = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, mcmd->tmr_func,
abts->exchange_addr_to_abort);
if (rc != 0) {
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052,
@@ -4048,7 +4049,6 @@ static int qlt_issue_task_mgmt(struct qla_tgt_sess *sess, 
uint32_t lun,
struct qla_tgt_mgmt_cmd *mcmd;
struct atio_from_isp *a = (struct atio_from_isp *)iocb;
int res;
-   uint8_t tmr_func;
 
mcmd = mempool_alloc(qla_tgt_mgmt_cmd_mempool, GFP_ATOMIC);
if (!mcmd) {
@@ -4070,74 +4070,12 @@ static int qlt_issue_task_mgmt(struct qla_tgt_sess 
*sess, uint32_t lun,
mcmd->reset_count = vha->hw->chip_reset;
 
switch (fn) {
-   case QLA_TGT_CLEAR_ACA:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x1,
-   "qla_target(%d): CLEAR_ACA received\n", sess->vha->vp_idx);
-   tmr_func = TMR_CLEAR_ACA;
-   break;
-
-   case QLA_TGT_TARGET_RESET:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10001,
-   "qla_target(%d): TARGET_RESET received\n",
-   sess->vha->vp_idx);
-   tmr_func = TMR_TARGET_WARM_RESET;
-   break;
-
case QLA_TGT_LUN_RESET:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10002,
-   "qla_target(%d): LUN_RESET received\n", sess->vha->vp_idx);
-   tmr_func = TMR_LUN_RESET;
-   abort_cmds_for_lun(vha, lun, a->u.isp24.fcp_hdr.s_id);
-   break;
-
-   case QLA_TGT_CLEAR_TS:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10003,
-   "qla_target(%d): CLEAR_TS received\n", sess->vha->vp_idx);
-   tmr_func = TMR_CLEAR_TASK_SET;
-   break;
-
-   case QLA_TGT_ABORT_TS:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10004,
-   "qla_target(%d): ABORT_TS received\n", sess->vha->vp_idx);
-   tmr_func = TMR_ABORT_TASK_SET;
-   break;
-#if 0
-   case QLA_TGT_ABORT_ALL:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10005,
-   "qla_target(%d): Doing ABORT_ALL_TASKS\n",
-   sess->vha->vp_idx);
-   tmr_func = 0;
-   break;
-
-   case QLA_TGT_ABORT_ALL_SESS:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10006,
-   "qla_target(%d): Doing ABORT_ALL_TASKS_SESS\n",
-   sess->vha->vp_idx);
-   tmr_func = 0;
-   break;
-
-   case QLA_TGT_NEXUS_LOSS_SESS:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10007,
-   "qla_target(%d): Doing NEXUS_LOSS_SESS\n",
-   sess->vha->vp_idx);
-   tmr_func = 0;
-   break;
-
-   case QLA_TGT_NEXUS_LOSS:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x10008,
-   "qla_target(%d): Doing NEXUS_LOSS\n", sess->vha->vp_idx);
-   tmr_func = 0;
-   break;
-#endif
-   default:
-   ql_dbg(ql_dbg_tgt_tmr, vha, 0x1000a,
-   "qla_target(%d): Unknown task mgmt fn 0x%x\n",
-   sess->vha->vp_idx, fn);
-   mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool);
-   return -ENOSYS;
+   abort_cmds_for_lun(vha, lun, a->u.isp24.fcp_hdr.s_id);
+   break;
}
 
-   res = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, tmr_func, 0);
+   res = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, mcmd->tmr_func, 0);
if (res != 0) {
ql_dbg(ql_dbg_tgt_tmr, vha, 0x1000b,
"qla_target(%d): tgt.tgt_ops->handle_tmr() failed: %d\n",
@@ -4212,8 +4150,9 @@ static int __qlt_abort_task(struct scsi_qla_host *vha,
lun = a->u.isp24.fcp_cmnd.lun;
unpacked_lun = scsilun_to_int((struct scsi_lun *)&lun);
mcmd->reset_count = vha->hw->chip_reset;
+   mcmd->tmr_func = QLA_TGT_2G_ABORT_TASK;
 
-   rc = ha->tgt.tgt_ops->handle_tmr(mcmd, unpacked_lun, TMR_ABORT_TASK,
+   rc = ha->tgt.tgt

[PATCH v4 06/12] qla2xxx: Use d_id instead of s_id for more clarity.

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Updated code with d_id from s_id for better readabilty
and clarity.

Reviewed-by: Christoph Hellwig 
Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dfs.c |  9 -
 drivers/scsi/qla2xxx/qla_target.c  | 24 +++---
 drivers/scsi/qla2xxx/qla_target.h  |  2 +-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 41 --
 4 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 34272fd..98550c9 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -26,12 +26,11 @@
seq_printf(s, "Port ID   Port NameHandle\n");
 
spin_lock_irqsave(&ha->tgt.sess_lock, flags);
-   list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) {
+   list_for_each_entry(sess, &tgt->sess_list, sess_list_entry)
seq_printf(s, "%02x:%02x:%02x  %8phC  %d\n",
-  
sess->s_id.b.domain,sess->s_id.b.area,
-  sess->s_id.b.al_pa,  sess->port_name,
-  sess->loop_id);
-   }
+   sess->d_id.b.domain, sess->d_id.b.area,
+   sess->d_id.b.al_pa, sess->port_name,
+   sess->loop_id);
spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
}
 
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 74709d3..c977337 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -530,7 +530,7 @@ static void qlt_free_session_done(struct work_struct *work)
"%s: se_sess %p / sess %p from port %8phC loop_id %#04x"
" s_id %02x:%02x:%02x logout %d keep %d els_logo %d\n",
__func__, sess->se_sess, sess, sess->port_name, sess->loop_id,
-   sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa,
+   sess->d_id.b.domain, sess->d_id.b.area, sess->d_id.b.al_pa,
sess->logout_on_delete, sess->keep_nport_handle,
sess->send_els_logo);
 
@@ -538,7 +538,7 @@ static void qlt_free_session_done(struct work_struct *work)
 
if (sess->send_els_logo) {
qlt_port_logo_t logo;
-   logo.id = sess->s_id;
+   logo.id = sess->d_id;
logo.cmd_count = 0;
qlt_send_first_logo(vha, &logo);
}
@@ -548,7 +548,7 @@ static void qlt_free_session_done(struct work_struct *work)
 
memset(&fcport, 0, sizeof(fcport));
fcport.loop_id = sess->loop_id;
-   fcport.d_id = sess->s_id;
+   fcport.d_id = sess->d_id;
memcpy(fcport.port_name, sess->port_name, WWN_SIZE);
fcport.vha = vha;
fcport.tgt_session = sess;
@@ -757,7 +757,7 @@ static void qlt_schedule_sess_for_deletion(struct 
qla_tgt_sess *sess,
"qla_target(%d): session for port %8phC (loop ID %d s_id 
%02x:%02x:%02x)"
" scheduled for deletion in %u secs (expires: %lu) immed: %d, 
logout: %d, gen: %#x\n",
sess->vha->vp_idx, sess->port_name, sess->loop_id,
-   sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa,
+   sess->d_id.b.domain, sess->d_id.b.area, sess->d_id.b.al_pa,
dev_loss_tmo, sess->expires, immediate, sess->logout_on_delete,
sess->generation);
 
@@ -892,8 +892,8 @@ static struct qla_tgt_sess *qlt_create_sess(
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf005,
"Double sess %p found (s_id %x:%x:%x, "
"loop_id %d), updating to d_id %x:%x:%x, "
-   "loop_id %d", sess, sess->s_id.b.domain,
-   sess->s_id.b.al_pa, sess->s_id.b.area,
+   "loop_id %d", sess, sess->d_id.b.domain,
+   sess->d_id.b.al_pa, sess->d_id.b.area,
sess->loop_id, fcport->d_id.b.domain,
fcport->d_id.b.al_pa, fcport->d_id.b.area,
fcport->loop_id);
@@ -943,7 +943,7 @@ static struct qla_tgt_sess *qlt_create_sess(
}
sess->tgt = vha->vha_tgt.qla_tgt;
sess->vha = vha;
-   sess->s_id = fcport->d_id;
+   sess->d_id = fcport->d_id;
sess->loop_id = fcport->loop_id;
sess->local = local;
kref_init(&sess->sess_kref);
@@ -974,8 +974,8 @@ static struct qla_tgt_sess *qlt_create_sess(
"qla_target(%d): %ssession for wwn %8phC (loop_id %d, "
"s_id %x:%x:%x, confirmed completion %ssupported) added\n",
vha->vp_idx, local ?  "local " : "", fcport->port_name,
-   fcport->loop_id, sess->s_id.b.domain, sess->s_id.b

[PATCH v4 09/12] qla2xxx: Add Dual mode support in the driver

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Add switch to allow both Initiator Mode & Target
mode to operate at the same time.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h |   1 +
 drivers/scsi/qla2xxx/qla_init.c|   6 +-
 drivers/scsi/qla2xxx/qla_isr.c |  19 ++-
 drivers/scsi/qla2xxx/qla_target.c  | 110 +++--
 drivers/scsi/qla2xxx/qla_target.h  |   3 +
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |   2 +-
 6 files changed, 119 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 253f991..fd179df 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3390,6 +3390,7 @@ struct qla_hw_data {
 #define FLOGI_SP_SUPPORTBIT_13
 
uint8_t port_no;/* Physical port of adapter */
+   uint8_t exch_starvation;
 
/* Timeout timers. */
uint8_t loop_down_abort_time;/* port down timer */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 8b7c046..4c0a2d8 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1568,8 +1568,7 @@ void qla2x00_fcport_event_handler(scsi_qla_host_t *vha,
}
}
 
-   if (qla_ini_mode_enabled(vha) ||
-   qla_dual_mode_enabled(vha))
+   if (qla_ini_mode_enabled(vha) || qla_dual_mode_enabled(vha))
rval = qla2x00_init_rings(vha);
 
ha->flags.chip_reset_done = 1;
@@ -3994,7 +3993,8 @@ static void qla2xxx_nvram_wwn_from_ofw(scsi_qla_host_t 
*vha, nvram_t *nv)
 * Process any ATIO queue entries that came in
 * while we weren't online.
 */
-   if (qla_tgt_mode_enabled(vha)) {
+   if (qla_tgt_mode_enabled(vha) ||
+   qla_dual_mode_enabled(vha)) {
if (IS_QLA27XX(ha) || IS_QLA83XX(ha)) {
spin_lock_irqsave(&ha->tgt.atio_lock,
flags);
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 7ad9cdf..c67b52c 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1029,7 +1029,8 @@ static void qla_irq_affinity_notify(struct 
irq_affinity_notify *,
 
qla2x00_mark_all_devices_lost(vha, 1);
 
-   if (vha->vp_idx == 0 && !qla_ini_mode_enabled(vha))
+   if (vha->vp_idx == 0 &&
+   (qla_tgt_mode_enabled(vha) || qla_dual_mode_enabled(vha)))
set_bit(SCR_PENDING, &vha->dpc_flags);
 
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
@@ -1641,6 +1642,7 @@ static void qla_irq_affinity_notify(struct 
irq_affinity_notify *,
fcport->d_id.b.area, fcport->d_id.b.al_pa,
le32_to_cpu(logio->io_parameter[0]));
 
+   vha->hw->exch_starvation = 0;
data[0] = MBS_COMMAND_COMPLETE;
if (sp->type != SRB_LOGIN_CMD)
goto logio_done;
@@ -1676,6 +1678,21 @@ static void qla_irq_affinity_notify(struct 
irq_affinity_notify *,
case LSC_SCODE_NPORT_USED:
data[0] = MBS_LOOP_ID_USED;
break;
+   case LSC_SCODE_NOXCB:
+   vha->hw->exch_starvation++;
+   if (vha->hw->exch_starvation > 5) {
+   ql_log(ql_log_warn, vha, 0x,
+   "Exchange starvation. Resetting RISC\n");
+
+   vha->hw->exch_starvation = 0;
+
+   if (IS_P3P_TYPE(vha->hw))
+   set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
+   else
+   set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
+   qla2xxx_wake_dpc(vha);
+   }
+   /* drop through */
default:
data[0] = MBS_COMMAND_ERROR;
break;
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index b5cfab0..225d2bf 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -55,8 +55,17 @@
"disabled on enabling target mode and then on disabling target mode "
"enabled back; "
"\"disabled\" - initiator mode will never be enabled; "
+   "\"dual\" - Initiator Modes will be enabled. Target Mode can be 
activated "
+   "when ready "
"\"enabled\" (default) - initiator mode will always stay enabled.");
 
+static int ql_dm_tgt_ex_pct = 50;
+module_param(ql_dm_tgt_ex_pct, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(ql_dm_tgt_ex_pct,
+   "For Dual Mode (qlini_mode=dual), this parameter determines "
+   "the percentage of exchanges/cmds FW will allocate resources "
+   "for Target mode.");

[PATCH v4 03/12] qla2xxx: Make trace flags more readable.

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Trace flags are useful during debugging crash dumps
using crash utility. These trace flags makes it easier
to understand various states a command has successfully
completed.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_target.c  | 28 +--
 drivers/scsi/qla2xxx/qla_target.h  | 55 +-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 43 ++---
 3 files changed, 59 insertions(+), 67 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 39e6a02..1bd9cac 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3294,7 +3294,7 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd)
return EIO;
}
cmd->aborted = 1;
-   cmd->cmd_flags |= BIT_6;
+   cmd->trc_flags |= TRC_ABORT;
spin_unlock_irqrestore(&cmd->cmd_lock, flags);
 
qlt_send_term_exchange(vha, cmd, &cmd->atio, 0, 1);
@@ -3342,7 +3342,7 @@ static int qlt_prepare_srr_ctio(struct scsi_qla_host *vha,
struct qla_tgt_srr_imm *imm;
 
tgt->ctio_srr_id++;
-   cmd->cmd_flags |= BIT_15;
+   cmd->trc_flags |= TRC_SRR_CTIO;
 
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf019,
"qla_target(%d): CTIO with SRR status received\n", vha->vp_idx);
@@ -3525,7 +3525,7 @@ static struct qla_tgt_cmd *qlt_ctio_to_cmd(struct 
scsi_qla_host *vha,
dump_stack();
}
 
-   cmd->cmd_flags |= BIT_17;
+   cmd->trc_flags |= TRC_FLUSH;
ha->tgt.tgt_ops->free_cmd(cmd);
 }
 
@@ -3691,7 +3691,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host 
*vha, uint32_t handle,
 */
if ((cmd->state != QLA_TGT_STATE_NEED_DATA) &&
(!cmd->aborted)) {
-   cmd->cmd_flags |= BIT_13;
+   cmd->trc_flags |= TRC_CTIO_ERR;
if (qlt_term_ctio_exchange(vha, ctio, cmd, status))
return;
}
@@ -3699,7 +3699,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host 
*vha, uint32_t handle,
 skip_term:
 
if (cmd->state == QLA_TGT_STATE_PROCESSED) {
-   cmd->cmd_flags |= BIT_12;
+   cmd->trc_flags |= TRC_CTIO_DONE;
} else if (cmd->state == QLA_TGT_STATE_NEED_DATA) {
cmd->state = QLA_TGT_STATE_DATA_IN;
 
@@ -3709,11 +3709,11 @@ static void qlt_do_ctio_completion(struct scsi_qla_host 
*vha, uint32_t handle,
ha->tgt.tgt_ops->handle_data(cmd);
return;
} else if (cmd->aborted) {
-   cmd->cmd_flags |= BIT_18;
+   cmd->trc_flags |= TRC_CTIO_ABORTED;
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01e,
  "Aborted command %p (tag %lld) finished\n", cmd, se_cmd->tag);
} else {
-   cmd->cmd_flags |= BIT_19;
+   cmd->trc_flags |= TRC_CTIO_STRANGE;
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf05c,
"qla_target(%d): A command in state (%d) should "
"not return a CTIO complete\n", vha->vp_idx, cmd->state);
@@ -3778,7 +3778,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd)
int ret, fcp_task_attr, data_dir, bidi = 0;
 
cmd->cmd_in_wq = 0;
-   cmd->cmd_flags |= BIT_1;
+   cmd->trc_flags |= TRC_DO_WORK;
if (tgt->tgt_stop)
goto out_term;
 
@@ -3830,7 +3830,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd)
 * cmd has not sent to target yet, so pass NULL as the second
 * argument to qlt_send_term_exchange() and free the memory here.
 */
-   cmd->cmd_flags |= BIT_2;
+   cmd->trc_flags |= TRC_DO_WORK_ERR;
spin_lock_irqsave(&ha->hardware_lock, flags);
qlt_send_term_exchange(vha, NULL, &cmd->atio, 1, 0);
 
@@ -3881,7 +3881,7 @@ static struct qla_tgt_cmd *qlt_get_tag(scsi_qla_host_t 
*vha,
cmd->loop_id = sess->loop_id;
cmd->conf_compl_supported = sess->conf_compl_supported;
 
-   cmd->cmd_flags = 0;
+   cmd->trc_flags = 0;
cmd->jiffies_at_alloc = get_jiffies_64();
 
cmd->reset_count = vha->hw->chip_reset;
@@ -4017,7 +4017,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host 
*vha,
}
 
cmd->cmd_in_wq = 1;
-   cmd->cmd_flags |= BIT_0;
+   cmd->trc_flags |= TRC_NEW_CMD;
cmd->se_cmd.cpuid = ha->msix_count ?
ha->tgt.rspq_vector_cpuid : WORK_CPU_UNBOUND;
 
@@ -4709,7 +4709,7 @@ static void qlt_handle_srr(struct scsi_qla_host *vha,
0, 0, 0, NOTIFY_ACK_SRR_FLAGS_ACCEPT, 0, 0);
spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (xmit_type & QLA_TGT_XMIT_DATA) {
-   cmd->cmd_flags |= BIT_8;
+   cmd->trc_flags |= TRC_SRR_XRDY;
   

[PATCH v4 00/12] qla2xxx: Feature updates for target.

2017-01-19 Thread Himanshu Madhani
Hi Bart,

Please consider this updated series for inclusion in target-pending.

Changes from v3 --> v4

o Fixed warnings reported by smatch tool.
o Fixed indentatation warnings reported by smatch tool.

Changes from v2 --> v3

o Cleaned up sparse warnings reported by you.

Changes from v1 --> v2

o Updated review comments and added Reviewed-by tags for necessary patches.
o We left the one particular review comment to add helper routine to
  be addressed at later time in the follow up bug fixes pathes which we
  will be sending in few weeks.
o Added patch to simplify SRB usage in driver.
o Cleaned up warnings reported by sparse option w=1.

Please apply to target-pending.

Thanks,
Himanshu 

Himanshu Madhani (2):
  qla2xxx: Remove SRR code.
  qla2xxx: Remove unused reverse_ini_mode.

Joe Carnuccio (1):
  qla2xxx: Simplify usage of SRB structure in driver.

Quinn Tran (9):
  qla2xxx: Remove direct access of scsi_status field in se_cmd
  qla2xxx: Cleanup TMF code translation from qla_target.
  qla2xxx: Make trace flags more readable.
  qla2xxx: Fix wrong argument in sp done callback.
  qla2xxx: Use d_id instead of s_id for more clarity.
  qla2xxx: Track I-T nexus as single fc_port struct.
  qla2xxx: Add framework for Async fabric discovery.
  qla2xxx: Add Dual mode support in the driver
  qla2xxx: Improve RSCN handling in driver

 drivers/scsi/qla2xxx/qla_attr.c|3 +
 drivers/scsi/qla2xxx/qla_bsg.c |   23 +-
 drivers/scsi/qla2xxx/qla_def.h |  306 -
 drivers/scsi/qla2xxx/qla_dfs.c |   11 +-
 drivers/scsi/qla2xxx/qla_fw.h  |  106 +-
 drivers/scsi/qla2xxx/qla_gbl.h |   72 +-
 drivers/scsi/qla2xxx/qla_gs.c  |  726 +--
 drivers/scsi/qla2xxx/qla_init.c| 1612 ++--
 drivers/scsi/qla2xxx/qla_inline.h  |   18 +-
 drivers/scsi/qla2xxx/qla_iocb.c|  167 ++-
 drivers/scsi/qla2xxx/qla_isr.c |  317 +++--
 drivers/scsi/qla2xxx/qla_mbx.c |  232 ++--
 drivers/scsi/qla2xxx/qla_mr.c  |   48 +-
 drivers/scsi/qla2xxx/qla_os.c  |  330 +++--
 drivers/scsi/qla2xxx/qla_target.c  | 2392 +---
 drivers/scsi/qla2xxx/qla_target.h  |  252 +---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |  256 ++--
 drivers/scsi/qla2xxx/tcm_qla2xxx.h |4 +-
 18 files changed, 4324 insertions(+), 2551 deletions(-)

-- 
1.8.3.1

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


[PATCH v4 11/12] qla2xxx: Improve RSCN handling in driver

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Current code blindly does State Change Registration when
the link is up. Move SCR behind fabric scan, so that arbitrated
loop scan would not get erroneous error message.

Some of the other improvements are as follows

- Add session deletion for TPRLO and send acknowledgment for TPRLO.
- Enable FW option to move ABTS, RIDA & PUREX from RSPQ to ATIOQ.
- Save NPort ID early in link init.
- Move ABTS & RIDA to ATIOQ helps in keeping command ordering and
  link up sequence ordering.
- Save Nport ID and update VP map so that SCSI CMD/ATIO won't be dropped.
- fcport alloc does the initializes memory to zero. Remove memset to
  zero since It might corrupt link list.
- Turn off Registration for State Change MB in loop mode.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h|  11 +-
 drivers/scsi/qla2xxx/qla_fw.h |  75 +---
 drivers/scsi/qla2xxx/qla_gbl.h|   2 +
 drivers/scsi/qla2xxx/qla_gs.c |   4 +-
 drivers/scsi/qla2xxx/qla_init.c   | 150 
 drivers/scsi/qla2xxx/qla_isr.c|   6 +-
 drivers/scsi/qla2xxx/qla_mbx.c| 144 +++
 drivers/scsi/qla2xxx/qla_os.c |  48 
 drivers/scsi/qla2xxx/qla_target.c | 238 ++
 9 files changed, 533 insertions(+), 145 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index b447b01..329aebf 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2226,6 +2226,13 @@ enum fcport_mgt_event {
FCME_DELETE_DONE,
 };
 
+enum rscn_addr_format {
+   RSCN_PORT_ADDR,
+   RSCN_AREA_ADDR,
+   RSCN_DOM_ADDR,
+   RSCN_FAB_ADDR,
+};
+
 /*
  * Fibre channel port structure.
  */
@@ -3957,7 +3964,7 @@ struct qla_tgt_counters {
 #define FCOE_CTX_RESET_NEEDED  18  /* Initiate FCoE context reset */
 #define MPI_RESET_NEEDED   19  /* Initiate MPI FW reset */
 #define ISP_QUIESCE_NEEDED 20  /* Driver need some quiescence */
-#define SCR_PENDING21  /* SCR in target mode */
+#define FREE_BIT 21
 #define PORT_UPDATE_NEEDED 22
 #define FX00_RESET_RECOVERY23
 #define FX00_TARGET_SCAN   24
@@ -4011,7 +4018,9 @@ struct qla_tgt_counters {
/* list of commands waiting on workqueue */
struct list_headqla_cmd_list;
struct list_headqla_sess_op_cmd_list;
+   struct list_headunknown_atio_list;
spinlock_t  cmd_list_lock;
+   struct delayed_work unknown_atio_work;
 
/* Counter to detect races between ELS and RSCN events */
atomic_tgeneration_tick;
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index ee135cf..1f80892 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -1301,27 +1301,76 @@ struct vp_config_entry_24xx {
 };
 
 #define VP_RPT_ID_IOCB_TYPE0x32/* Report ID Acquisition entry. */
+enum VP_STATUS {
+   VP_STAT_COMPL,
+   VP_STAT_FAIL,
+   VP_STAT_ID_CHG,
+   VP_STAT_SNS_TO, /* timeout */
+   VP_STAT_SNS_RJT,
+   VP_STAT_SCR_TO, /* timeout */
+   VP_STAT_SCR_RJT,
+};
+
+enum VP_FLAGS {
+   VP_FLAGS_CON_FLOOP = 1,
+   VP_FLAGS_CON_P2P = 2,
+   VP_FLAGS_CON_FABRIC = 3,
+   VP_FLAGS_NAME_VALID = BIT_5,
+};
+
 struct vp_rpt_id_entry_24xx {
uint8_t entry_type; /* Entry type. */
uint8_t entry_count;/* Entry count. */
uint8_t sys_define; /* System defined. */
uint8_t entry_status;   /* Entry Status. */
-
-   uint32_t handle;/* System handle. */
-
-   uint16_t vp_count;  /* Format 0 -- | VP setup | VP acq |. */
-   /* Format 1 -- | VP count |. */
-   uint16_t vp_idx;/* Format 0 -- Reserved. */
-   /* Format 1 -- VP status and index. */
+   uint32_t resv1;
+   uint8_t vp_acquired;
+   uint8_t vp_setup;
+   uint8_t vp_idx; /* Format 0=reserved */
+   uint8_t vp_status;  /* Format 0=reserved */
 
uint8_t port_id[3];
uint8_t format;
-
-   uint8_t vp_idx_map[16];
-
-   uint8_t reserved_4[24];
-   uint16_t bbcr;
-   uint8_t reserved_5[6];
+   union {
+   struct {
+   /* format 0 loop */
+   uint8_t vp_idx_map[16];
+   uint8_t reserved_4[32];
+   } f0;
+   struct {
+   /* format 1 fabric */
+   uint8_t vpstat1_subcode; /* vp_status=1 subcode */
+   uint8_t flags;
+   uint16_t fip_flags;
+   uint8_t rsv2[12];
+
+   uint8_t ls_rjt_vendor;
+   uint8_t ls_rj

[PATCH v4 07/12] qla2xxx: Track I-T nexus as single fc_port struct.

2017-01-19 Thread Himanshu Madhani
From: Quinn Tran 

Current code merges qla_tgt_sess and fc_port structure
into single fc_port structure represeting same I-T nexus.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h | 112 -
 drivers/scsi/qla2xxx/qla_dfs.c |   4 +-
 drivers/scsi/qla2xxx/qla_init.c|  12 --
 drivers/scsi/qla2xxx/qla_iocb.c|   2 +-
 drivers/scsi/qla2xxx/qla_target.c  | 326 -
 drivers/scsi/qla2xxx/qla_target.h  | 150 ++---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 130 ---
 drivers/scsi/qla2xxx/tcm_qla2xxx.h |   4 +-
 8 files changed, 310 insertions(+), 430 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 1196150..11d5288 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1976,6 +1976,84 @@ struct mbx_entry {
uint8_t port_name[WWN_SIZE];
 };
 
+#ifndef IMMED_NOTIFY_TYPE
+#define IMMED_NOTIFY_TYPE 0x0D /* Immediate notify entry. */
+/*
+ * ISP queue - immediate notify entry structure definition.
+ * This is sent by the ISP to the Target driver.
+ * This IOCB would have report of events sent by the
+ * initiator, that needs to be handled by the target
+ * driver immediately.
+ */
+struct imm_ntfy_from_isp {
+   uint8_t  entry_type;/* Entry type. */
+   uint8_t  entry_count;   /* Entry count. */
+   uint8_t  sys_define;/* System defined. */
+   uint8_t  entry_status;  /* Entry Status. */
+   union {
+   struct {
+   uint32_t sys_define_2; /* System defined. */
+   target_id_t target;
+   uint16_t lun;
+   uint8_t  target_id;
+   uint8_t  reserved_1;
+   uint16_t status_modifier;
+   uint16_t status;
+   uint16_t task_flags;
+   uint16_t seq_id;
+   uint16_t srr_rx_id;
+   uint32_t srr_rel_offs;
+   uint16_t srr_ui;
+#define SRR_IU_DATA_IN 0x1
+#define SRR_IU_DATA_OUT0x5
+#define SRR_IU_STATUS  0x7
+   uint16_t srr_ox_id;
+   uint8_t reserved_2[28];
+   } isp2x;
+   struct {
+   uint32_t reserved;
+   uint16_t nport_handle;
+   uint16_t reserved_2;
+   uint16_t flags;
+#define NOTIFY24XX_FLAGS_GLOBAL_TPRLO   BIT_1
+#define NOTIFY24XX_FLAGS_PUREX_IOCB BIT_0
+   uint16_t srr_rx_id;
+   uint16_t status;
+   uint8_t  status_subcode;
+   uint8_t  fw_handle;
+   uint32_t exchange_address;
+   uint32_t srr_rel_offs;
+   uint16_t srr_ui;
+   uint16_t srr_ox_id;
+   union {
+   struct {
+   uint8_t node_name[8];
+   } plogi; /* PLOGI/ADISC/PDISC */
+   struct {
+   /* PRLI word 3 bit 0-15 */
+   uint16_t wd3_lo;
+   uint8_t resv0[6];
+   } prli;
+   struct {
+   uint8_t port_id[3];
+   uint8_t resv1;
+   uint16_t nport_handle;
+   uint16_t resv2;
+   } req_els;
+   } u;
+   uint8_t port_name[8];
+   uint8_t resv3[3];
+   uint8_t  vp_index;
+   uint32_t reserved_5;
+   uint8_t  port_id[3];
+   uint8_t  reserved_6;
+   } isp24;
+   } u;
+   uint16_t reserved_7;
+   uint16_t ox_id;
+} __packed;
+#endif
+
 /*
  * ISP request and response queue entry sizes
  */
@@ -2026,7 +2104,7 @@ struct mbx_entry {
 /*
  * Fibre channel port type.
  */
- typedef enum {
+typedef enum {
FCT_UNKNOWN,
FCT_RSCN,
FCT_SWITCH,
@@ -2035,6 +2113,19 @@ struct mbx_entry {
FCT_TARGET
 } fc_port_type_t;
 
+enum qlt_plogi_link_t {
+   QLT_PLOGI_LINK_SAME_WWN,
+   QLT_PLOGI_LINK_CONFLICT,
+   QLT_PLOGI_LINK_MAX
+};
+
+struct qlt_plogi_ack_t {
+   struct list_headlist;
+   struct imm_ntfy_from_isp iocb;
+   port_id_t   id;
+   int ref_count;
+};
+
 /*
  * Fibre channel port structure.
  */
@@ -2048,6 +2139,25 @@ struct mbx_entry {
uint16_t loop_id;
   

[PATCH v4 12/12] qla2xxx: Simplify usage of SRB structure in driver.

2017-01-19 Thread Himanshu Madhani
From: Joe Carnuccio 

This patch simplifies SRB structure usage in driver.

- Simplify sp->done() and sp->free() interfaces.
- Remove sp->fcport->vha to use vha pointer from sp.
- Use sp->vha context in qla2x00_rel_sp().

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_bsg.c|  23 -
 drivers/scsi/qla2xxx/qla_def.h|   7 +--
 drivers/scsi/qla2xxx/qla_gbl.h|  14 +++---
 drivers/scsi/qla2xxx/qla_gs.c |  32 ++--
 drivers/scsi/qla2xxx/qla_init.c   | 100 +++---
 drivers/scsi/qla2xxx/qla_inline.h |  13 +++--
 drivers/scsi/qla2xxx/qla_iocb.c   |  96 ++--
 drivers/scsi/qla2xxx/qla_isr.c|  36 +++---
 drivers/scsi/qla2xxx/qla_mr.c |  48 +-
 drivers/scsi/qla2xxx/qla_os.c |  35 +++--
 drivers/scsi/qla2xxx/qla_target.c |   8 +--
 11 files changed, 201 insertions(+), 211 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 1bf8061..975e7a1 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -13,28 +13,25 @@
 
 /* BSG support for ELS/CT pass through */
 void
-qla2x00_bsg_job_done(void *data, void *ptr, int res)
+qla2x00_bsg_job_done(void *ptr, int res)
 {
-   srb_t *sp = (srb_t *)ptr;
-   struct scsi_qla_host *vha = (scsi_qla_host_t *)data;
+   srb_t *sp = ptr;
struct bsg_job *bsg_job = sp->u.bsg_job;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
 
bsg_reply->result = res;
bsg_job_done(bsg_job, bsg_reply->result,
   bsg_reply->reply_payload_rcv_len);
-   sp->free(vha, sp);
+   sp->free(sp);
 }
 
 void
-qla2x00_bsg_sp_free(void *data, void *ptr)
+qla2x00_bsg_sp_free(void *ptr)
 {
-   srb_t *sp = (srb_t *)ptr;
-   struct scsi_qla_host *vha = sp->fcport->vha;
+   srb_t *sp = ptr;
+   struct qla_hw_data *ha = sp->vha->hw;
struct bsg_job *bsg_job = sp->u.bsg_job;
struct fc_bsg_request *bsg_request = bsg_job->request;
-
-   struct qla_hw_data *ha = vha->hw;
struct qla_mt_iocb_rqst_fx00 *piocb_rqst;
 
if (sp->type == SRB_FXIOCB_BCMD) {
@@ -62,7 +59,7 @@
sp->type == SRB_FXIOCB_BCMD ||
sp->type == SRB_ELS_CMD_HST)
kfree(sp->fcport);
-   qla2x00_rel_sp(vha, sp);
+   qla2x00_rel_sp(sp);
 }
 
 int
@@ -394,7 +391,7 @@
if (rval != QLA_SUCCESS) {
ql_log(ql_log_warn, vha, 0x700e,
"qla2x00_start_sp failed = %d\n", rval);
-   qla2x00_rel_sp(vha, sp);
+   qla2x00_rel_sp(sp);
rval = -EIO;
goto done_unmap_sg;
}
@@ -542,7 +539,7 @@
if (rval != QLA_SUCCESS) {
ql_log(ql_log_warn, vha, 0x7017,
"qla2x00_start_sp failed=%d.\n", rval);
-   qla2x00_rel_sp(vha, sp);
+   qla2x00_rel_sp(sp);
rval = -EIO;
goto done_free_fcport;
}
@@ -2578,6 +2575,6 @@
 
 done:
spin_unlock_irqrestore(&ha->hardware_lock, flags);
-   sp->free(vha, sp);
+   sp->free(sp);
return 0;
 }
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 329aebf..8b1c06d 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -433,7 +433,7 @@ struct srb_iocb {
 typedef struct srb {
atomic_t ref_count;
struct fc_port *fcport;
-   void *vha;
+   struct scsi_qla_host *vha;
uint32_t handle;
uint16_t flags;
uint16_t type;
@@ -447,8 +447,8 @@ struct srb_iocb {
struct bsg_job *bsg_job;
struct srb_cmd scmd;
} u;
-   void (*done)(void *, void *, int);
-   void (*free)(void *, void *);
+   void (*done)(void *, int);
+   void (*free)(void *);
 } srb_t;
 
 #define GET_CMD_SP(sp) (sp->u.scmd.cmd)
@@ -3225,6 +3225,7 @@ struct qla_qpair {
struct qla_hw_data *hw;
struct work_struct q_work;
struct list_head qp_list_elem; /* vha->qp_list */
+   struct scsi_qla_host *vha;
 };
 
 /* Place holder for FW buffer parameters */
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index e091457..b3d6441 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -186,9 +186,9 @@ extern struct scsi_qla_host *qla2x00_create_host(struct 
scsi_host_template *,
 
 extern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32);
 extern void qla2x00_disable_board_on_pci_error(struct work_struct *);
-extern void qla2x00_sp_compl(void *, void *, int);
-extern void qla2xxx_qpair_sp_free_dma(void *, void *);
-extern void qla2xxx_qpair_sp_compl(void *, void *, int);
+extern void qla2x00_sp_compl(void *, int);
+extern void qla2xxx_qpair_sp_free_dma(void *);
+extern void qla2xxx_qpair_sp_compl(void *, int);
 extern int qla24xx_post_upd_

Re: [PATCH] scsi: mq queue stall during command requeue

2017-01-19 Thread Hannes Reinecke
On 01/19/2017 05:11 PM, Bart Van Assche wrote:
> On Thu, 2017-01-19 at 15:17 +0100, Hannes Reinecke wrote:
>> When we're hitting a busy condition in queuecommand() we need to
>> stop the hardware queue before calling blk_mq_delay_queue(); if
>> we don't blk_mq_delay_queue() will not do anything and requeue
>> will never triggered.
>>
>> Signed-off-by: Hannes Reinecke 
>> ---
>>  drivers/scsi/scsi_lib.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
>> index e9e1e14..4b1cbc6 100644
>> --- a/drivers/scsi/scsi_lib.c
>> +++ b/drivers/scsi/scsi_lib.c
>> @@ -1951,8 +1951,10 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
>>  switch (ret) {
>>  case BLK_MQ_RQ_QUEUE_BUSY:
>>  if (atomic_read(&sdev->device_busy) == 0 &&
>> -!scsi_device_blocked(sdev))
>> +!scsi_device_blocked(sdev)) {
>> +blk_mq_stop_hw_queue(hctx);
>>  blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY);
>> +}
>>  break;
>>  case BLK_MQ_RQ_QUEUE_ERROR:
>>  /*
> 
> You may want to add Fixes: 52d7f1b5c2f3 (blk-mq: Avoid that requeueing
> starts stopped queues). See also
> https://www.spinics.net/lists/linux-block/msg06144.html.
> 
Yes indeed.

But the powers that be still ponder if it should be fixed in
the SCSI stack or whether it's a generic fix for blk_mq_delay_queue().

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html