linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv5 00/11] scsi: remove legacy cmd_list implementation
@ 2019-11-20 10:31 Hannes Reinecke
  2019-11-20 10:31 ` [PATCH 01/11] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete() Hannes Reinecke
                   ` (10 more replies)
  0 siblings, 11 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke

Hi all,

with the switch to blk-mq we have an efficient way of looking up
outstanding commands via blk_mq_rq_busy_iter().
In this patchset the dpt_i2o and aacraid drivers are switched over
to using that function, and the now obsolete cmd_list implemantation
in the SCSI midlayer is removed.

As usual, comments and reviews are welcome.

Changes to v1:
- Fixup kbuild warning

Changes to v2:
- Add scsi_host_busy_iter()
- Include reviews from Christoph

Changes to v3:
- Include reviews from Christoph
- Add midlayer helper to terminate outstanding commands
- Split off aacraid modifcations into several patches

Changes to v4:
- Include reviews from Bart
- Add new midlayer helper scsi_host_quiesce()/scsi_host_resume()
- Improve comments

Hannes Reinecke (11):
  dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete()
  scsi: add scsi_host_flush_commands() helper
  dpt_i2o: use scsi_host_flush_commands() to abort outstanding commands
  aacraid: Do not wait for outstanding write commands on
    synchronize_cache
  aacraid: use midlayer helper to terminate outstanding commands
  aacraid: replace aac_flush_ios() with midlayer helper
  scsi: add scsi_host_quiesce()/scsi_host_resume() helper
  aacraid: use scsi_host_quiesce() to wait for I/O to complete
  scsi: add scsi_host_busy_iter()
  aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs()
  scsi: Remove cmd_list functionality

 drivers/scsi/aacraid/aachba.c   |  76 +----------------------------
 drivers/scsi/aacraid/comminit.c |  35 +-------------
 drivers/scsi/aacraid/commsup.c  |  24 +--------
 drivers/scsi/aacraid/linit.c    | 105 ++++++++++++++++------------------------
 drivers/scsi/dpt_i2o.c          |  25 ++--------
 drivers/scsi/dpti.h             |   3 +-
 drivers/scsi/hosts.c            |  62 ++++++++++++++++++++++++
 drivers/scsi/scsi.c             |  14 ------
 drivers/scsi/scsi_error.c       |   1 -
 drivers/scsi/scsi_lib.c         |  49 +++++++------------
 drivers/scsi/scsi_priv.h        |   2 -
 drivers/scsi/scsi_scan.c        |   1 -
 include/scsi/scsi_cmnd.h        |   1 -
 include/scsi/scsi_device.h      |   3 +-
 include/scsi/scsi_host.h        |   8 ++-
 15 files changed, 141 insertions(+), 268 deletions(-)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/11] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete()
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-26 16:54   ` Christoph Hellwig
  2019-11-20 10:31 ` [PATCH 02/11] scsi: add scsi_host_flush_commands() helper Hannes Reinecke
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Adaptec OEM Raid Solutions

Rename the badly named function into adpt_i2o_scsi_complete(),
and make it a void function as the return value is never used.
This also fixes a potential use-after free as the return value
might be evaluated from the command result after the command
has been freed.

Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/dpt_i2o.c | 5 ++---
 drivers/scsi/dpti.h    | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index abc74fd474dc..c30ace9f251e 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -2173,7 +2173,7 @@ static irqreturn_t adpt_isr(int irq, void *dev_id)
 						 readl(reply + 12) - 1);
 			if(cmd != NULL){
 				scsi_dma_unmap(cmd);
-				adpt_i2o_to_scsi(reply, cmd);
+				adpt_i2o_scsi_complete(reply, cmd);
 			}
 		}
 		writel(m, pHba->reply_port);
@@ -2341,7 +2341,7 @@ static s32 adpt_scsi_host_alloc(adpt_hba* pHba, struct scsi_host_template *sht)
 }
 
 
-static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
+static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd)
 {
 	adpt_hba* pHba;
 	u32 hba_status;
@@ -2459,7 +2459,6 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
 	if(cmd->scsi_done != NULL){
 		cmd->scsi_done(cmd);
 	} 
-	return cmd->result;
 }
 
 
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index 42b1e28b5884..3ec391134bb0 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -286,7 +286,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba);
 static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba);
 static s32 adpt_i2o_hrt_get(adpt_hba* pHba);
 static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice);
-static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd);
+static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd);
 static s32 adpt_scsi_host_alloc(adpt_hba* pHba,struct scsi_host_template * sht);
 static s32 adpt_hba_reset(adpt_hba* pHba);
 static s32 adpt_i2o_reset_hba(adpt_hba* pHba);
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/11] scsi: add scsi_host_flush_commands() helper
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
  2019-11-20 10:31 ` [PATCH 01/11] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete() Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-20 16:19   ` Bart Van Assche
  2019-11-26 16:55   ` Christoph Hellwig
  2019-11-20 10:31 ` [PATCH 03/11] dpt_i2o: use scsi_host_flush_commands() to abort outstanding commands Hannes Reinecke
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke

Add a helper scsi_host_flush_commands() to terminate all outstanding
commands on a scsi host.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/hosts.c     | 29 +++++++++++++++++++++++++++++
 include/scsi/scsi_host.h |  1 +
 2 files changed, 30 insertions(+)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 1d669e47b692..c26fa1fe6103 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -650,3 +650,32 @@ void scsi_flush_work(struct Scsi_Host *shost)
 	flush_workqueue(shost->work_q);
 }
 EXPORT_SYMBOL_GPL(scsi_flush_work);
+
+static bool flush_cmds_iter(struct request *rq, void *data, bool reserved)
+{
+	struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq);
+	int status = *(int *)data;
+
+	if (reserved)
+		return true;
+	scsi_dma_unmap(scmd);
+	scmd->result = status << 16;
+	scmd->scsi_done(scmd);
+	return true;
+}
+
+/**
+ * scsi_host_flush_commands -- Terminate all running commands
+ * @shost:	Scsi Host on which commands should be terminated
+ * @status:	Status to be set for the terminated commands
+ *
+ * There is no protection against modification of the number
+ * of outstanding commands. It is the responsibility of the
+ * caller to ensure that concurrent I/O submission and/or
+ * completion is stopped when calling this function.
+ */
+void scsi_host_flush_commands(struct Scsi_Host *shost, int status)
+{
+	blk_mq_tagset_busy_iter(&shost->tag_set, flush_cmds_iter, &status);
+}
+EXPORT_SYMBOL_GPL(scsi_host_flush_commands);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index f577647bf5f2..cb9a6fe9ad5b 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -735,6 +735,7 @@ extern int scsi_host_busy(struct Scsi_Host *shost);
 extern void scsi_host_put(struct Scsi_Host *t);
 extern struct Scsi_Host *scsi_host_lookup(unsigned short);
 extern const char *scsi_host_state_name(enum scsi_host_state);
+extern void scsi_host_flush_commands(struct Scsi_Host *shost, int status);
 
 static inline int __must_check scsi_add_host(struct Scsi_Host *host,
 					     struct device *dev)
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/11] dpt_i2o: use scsi_host_flush_commands() to abort outstanding commands
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
  2019-11-20 10:31 ` [PATCH 01/11] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete() Hannes Reinecke
  2019-11-20 10:31 ` [PATCH 02/11] scsi: add scsi_host_flush_commands() helper Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-26 16:55   ` Christoph Hellwig
  2019-11-20 10:31 ` [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache Hannes Reinecke
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Adaptec OEM Raid Solutions

Rather than traversing all outstanding commands manually use the
scsi_host_flush_commands() helper to terminate all commands during
reset.
With that we can drop the cmd_list usage from the midlayer.

Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/dpt_i2o.c | 20 +-------------------
 drivers/scsi/dpti.h    |  1 -
 2 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index c30ace9f251e..5fc09caa7ded 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -817,7 +817,7 @@ static int adpt_hba_reset(adpt_hba* pHba)
 	}
 	pHba->state &= ~DPTI_STATE_RESET;
 
-	adpt_fail_posted_scbs(pHba);
+	scsi_host_flush_commands(pHba->host, DID_RESET);
 	return 0;	/* return success */
 }
 
@@ -2335,7 +2335,6 @@ static s32 adpt_scsi_host_alloc(adpt_hba* pHba, struct scsi_host_template *sht)
 	host->unique_id = (u32)sys_tbl_pa + pHba->unit;
 	host->sg_tablesize = pHba->sg_tablesize;
 	host->can_queue = pHba->post_fifo_size;
-	host->use_cmd_list = 1;
 
 	return 0;
 }
@@ -2646,23 +2645,6 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
 	return 0;
 }
 
-static void adpt_fail_posted_scbs(adpt_hba* pHba)
-{
-	struct scsi_cmnd* 	cmd = NULL;
-	struct scsi_device* 	d = NULL;
-
-	shost_for_each_device(d, pHba->host) {
-		unsigned long flags;
-		spin_lock_irqsave(&d->list_lock, flags);
-		list_for_each_entry(cmd, &d->cmd_list, list) {
-			cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1);
-			cmd->scsi_done(cmd);
-		}
-		spin_unlock_irqrestore(&d->list_lock, flags);
-	}
-}
-
-
 /*============================================================================
  *  Routines from i2o subsystem
  *============================================================================
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index 3ec391134bb0..72293b8450b6 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -295,7 +295,6 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba);
 static s32 adpt_send_nop(adpt_hba*pHba,u32 m);
 static void adpt_i2o_delete_hba(adpt_hba* pHba);
 static void adpt_inquiry(adpt_hba* pHba);
-static void adpt_fail_posted_scbs(adpt_hba* pHba);
 static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u64 lun);
 static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ;
 static int adpt_i2o_online_hba(adpt_hba* pHba);
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (2 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 03/11] dpt_i2o: use scsi_host_flush_commands() to abort outstanding commands Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-26 17:02   ` Christoph Hellwig
  2019-11-28 11:40   ` Balsundar.P
  2019-11-20 10:31 ` [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands Hannes Reinecke
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Balsundar P, Adaptec OEM Raid Solutions

There is no need to wait for outstanding write commands on synchronize
cache; the block layer is responsible for I/O scheduling, no need
to out-guess it on the driver layer.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/aachba.c | 76 ++-----------------------------------------
 1 file changed, 2 insertions(+), 74 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index e36608ce937a..cfa14e15d5f0 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2601,9 +2601,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)
 static void synchronize_callback(void *context, struct fib *fibptr)
 {
 	struct aac_synchronize_reply *synchronizereply;
-	struct scsi_cmnd *cmd;
-
-	cmd = context;
+	struct scsi_cmnd *cmd = context;
 
 	if (!aac_valid_context(cmd, fibptr))
 		return;
@@ -2644,77 +2642,8 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
 	int status;
 	struct fib *cmd_fibcontext;
 	struct aac_synchronize *synchronizecmd;
-	struct scsi_cmnd *cmd;
 	struct scsi_device *sdev = scsicmd->device;
-	int active = 0;
 	struct aac_dev *aac;
-	u64 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) |
-		(scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
-	u32 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
-	unsigned long flags;
-
-	/*
-	 * Wait for all outstanding queued commands to complete to this
-	 * specific target (block).
-	 */
-	spin_lock_irqsave(&sdev->list_lock, flags);
-	list_for_each_entry(cmd, &sdev->cmd_list, list)
-		if (cmd->SCp.phase == AAC_OWNER_FIRMWARE) {
-			u64 cmnd_lba;
-			u32 cmnd_count;
-
-			if (cmd->cmnd[0] == WRITE_6) {
-				cmnd_lba = ((cmd->cmnd[1] & 0x1F) << 16) |
-					(cmd->cmnd[2] << 8) |
-					cmd->cmnd[3];
-				cmnd_count = cmd->cmnd[4];
-				if (cmnd_count == 0)
-					cmnd_count = 256;
-			} else if (cmd->cmnd[0] == WRITE_16) {
-				cmnd_lba = ((u64)cmd->cmnd[2] << 56) |
-					((u64)cmd->cmnd[3] << 48) |
-					((u64)cmd->cmnd[4] << 40) |
-					((u64)cmd->cmnd[5] << 32) |
-					((u64)cmd->cmnd[6] << 24) |
-					(cmd->cmnd[7] << 16) |
-					(cmd->cmnd[8] << 8) |
-					cmd->cmnd[9];
-				cmnd_count = (cmd->cmnd[10] << 24) |
-					(cmd->cmnd[11] << 16) |
-					(cmd->cmnd[12] << 8) |
-					cmd->cmnd[13];
-			} else if (cmd->cmnd[0] == WRITE_12) {
-				cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
-					(cmd->cmnd[3] << 16) |
-					(cmd->cmnd[4] << 8) |
-					cmd->cmnd[5];
-				cmnd_count = (cmd->cmnd[6] << 24) |
-					(cmd->cmnd[7] << 16) |
-					(cmd->cmnd[8] << 8) |
-					cmd->cmnd[9];
-			} else if (cmd->cmnd[0] == WRITE_10) {
-				cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
-					(cmd->cmnd[3] << 16) |
-					(cmd->cmnd[4] << 8) |
-					cmd->cmnd[5];
-				cmnd_count = (cmd->cmnd[7] << 8) |
-					cmd->cmnd[8];
-			} else
-				continue;
-			if (((cmnd_lba + cmnd_count) < lba) ||
-			  (count && ((lba + count) < cmnd_lba)))
-				continue;
-			++active;
-			break;
-		}
-
-	spin_unlock_irqrestore(&sdev->list_lock, flags);
-
-	/*
-	 *	Yield the processor (requeue for later)
-	 */
-	if (active)
-		return SCSI_MLQUEUE_DEVICE_BUSY;
 
 	aac = (struct aac_dev *)sdev->host->hostdata;
 	if (aac->in_reset)
@@ -2723,8 +2652,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
 	/*
 	 *	Allocate and initialize a Fib
 	 */
-	if (!(cmd_fibcontext = aac_fib_alloc(aac)))
-		return SCSI_MLQUEUE_HOST_BUSY;
+	cmd_fibcontext = aac_fib_alloc_tag(aac, scsicmd);
 
 	aac_fib_init(cmd_fibcontext);
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (3 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-26 17:02   ` Christoph Hellwig
  2019-11-28 11:41   ` Balsundar.P
  2019-11-20 10:31 ` [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper Hannes Reinecke
                   ` (5 subsequent siblings)
  10 siblings, 2 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Balsundar P, Adaptec OEM Raid Solutions

Use scsi_host_flush_commands() to terminate all outstanding commands
instead, and change the command result for terminated commands to
the more common 'DID_RESET' instead of 'QUEUE_FULL'.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/aacraid/commsup.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 5a8a999606ea..e413b784a8d0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1478,8 +1478,6 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	int retval;
 	struct Scsi_Host *host;
 	struct scsi_device *dev;
-	struct scsi_cmnd *command;
-	struct scsi_cmnd *command_list;
 	int jafo = 0;
 	int bled;
 	u64 dmamask;
@@ -1607,26 +1605,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	 * This is where the assumption that the Adapter is quiesced
 	 * is important.
 	 */
-	command_list = NULL;
-	__shost_for_each_device(dev, host) {
-		unsigned long flags;
-		spin_lock_irqsave(&dev->list_lock, flags);
-		list_for_each_entry(command, &dev->cmd_list, list)
-			if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
-				command->SCp.buffer = (struct scatterlist *)command_list;
-				command_list = command;
-			}
-		spin_unlock_irqrestore(&dev->list_lock, flags);
-	}
-	while ((command = command_list)) {
-		command_list = (struct scsi_cmnd *)command->SCp.buffer;
-		command->SCp.buffer = NULL;
-		command->result = DID_OK << 16
-		  | COMMAND_COMPLETE << 8
-		  | SAM_STAT_TASK_SET_FULL;
-		command->SCp.phase = AAC_OWNER_ERROR_HANDLER;
-		command->scsi_done(command);
-	}
+	scsi_host_flush_commands(host, DID_RESET);
+
 	/*
 	 * Any Device that was already marked offline needs to be marked
 	 * running
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (4 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-20 16:14   ` Bart Van Assche
  2019-11-28 11:41   ` Balsundar.P
  2019-11-20 10:31 ` [PATCH 07/11] scsi: add scsi_host_quiesce()/scsi_host_resume() helper Hannes Reinecke
                   ` (4 subsequent siblings)
  10 siblings, 2 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Balsundar P, Adaptec OEM Raid Solutions

Use the midlayer helper scsi_host_flush_commands() to flush all
outstanding commands.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/linit.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index ee6bc2f9b80a..847dac80defa 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1977,26 +1977,6 @@ static void aac_remove_one(struct pci_dev *pdev)
 	}
 }
 
-static void aac_flush_ios(struct aac_dev *aac)
-{
-	int i;
-	struct scsi_cmnd *cmd;
-
-	for (i = 0; i < aac->scsi_host_ptr->can_queue; i++) {
-		cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data;
-		if (cmd && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) {
-			scsi_dma_unmap(cmd);
-
-			if (aac->handle_pci_error)
-				cmd->result = DID_NO_CONNECT << 16;
-			else
-				cmd->result = DID_RESET << 16;
-
-			cmd->scsi_done(cmd);
-		}
-	}
-}
-
 static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
 					enum pci_channel_state error)
 {
@@ -2013,7 +1993,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
 
 		scsi_block_requests(aac->scsi_host_ptr);
 		aac_cancel_rescan_worker(aac);
-		aac_flush_ios(aac);
+		scsi_host_flush_commands(aac->scsi_host_ptr, DID_NO_CONNECT);
 		aac_release_resources(aac);
 
 		pci_disable_pcie_error_reporting(pdev);
@@ -2023,7 +2003,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
 	case pci_channel_io_perm_failure:
 		aac->handle_pci_error = 1;
 
-		aac_flush_ios(aac);
+		scsi_host_flush_commands(aac->scsi_host_ptr, DID_NO_CONNECT);
 		return PCI_ERS_RESULT_DISCONNECT;
 	}
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/11] scsi: add scsi_host_quiesce()/scsi_host_resume() helper
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (5 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-20 10:31 ` [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete Hannes Reinecke
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke

Add helper functions for quiescing/resuming all devices on a
given scsi host.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/scsi_lib.c    | 18 ++++++++++++++++++
 include/scsi/scsi_device.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2563b061f56b..771a8352d3e8 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2630,6 +2630,24 @@ scsi_target_resume(struct scsi_target *starget)
 }
 EXPORT_SYMBOL(scsi_target_resume);
 
+void scsi_host_quiesce(struct Scsi_Host *shost)
+{
+	struct scsi_device *sdev;
+
+	shost_for_each_device(sdev, shost)
+		scsi_device_quiesce(sdev);
+}
+EXPORT_SYMBOL(scsi_host_quiesce);
+
+void scsi_host_resume(struct Scsi_Host *shost)
+{
+	struct scsi_device *sdev;
+
+	shost_for_each_device(sdev, shost)
+		scsi_device_resume(sdev);
+}
+EXPORT_SYMBOL(scsi_host_resume);
+
 /**
  * scsi_internal_device_block_nowait - try to transition to the SDEV_BLOCK state
  * @sdev: device to block
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 3ed836db5306..2185068ce955 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -420,6 +420,8 @@ extern int scsi_device_quiesce(struct scsi_device *sdev);
 extern void scsi_device_resume(struct scsi_device *sdev);
 extern void scsi_target_quiesce(struct scsi_target *);
 extern void scsi_target_resume(struct scsi_target *);
+extern void scsi_host_quiesce(struct Scsi_Host *);
+extern void scsi_host_resume(struct Scsi_Host *);
 extern void scsi_scan_target(struct device *parent, unsigned int channel,
 			     unsigned int id, u64 lun,
 			     enum scsi_scan_mode rescan);
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (6 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 07/11] scsi: add scsi_host_quiesce()/scsi_host_resume() helper Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-20 16:23   ` Bart Van Assche
                     ` (2 more replies)
  2019-11-20 10:31 ` [PATCH 09/11] scsi: add scsi_host_busy_iter() Hannes Reinecke
                   ` (2 subsequent siblings)
  10 siblings, 3 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Balsundar P, Adaptec OEM Raid Solutions

Instead of waiting for all I/O to complete by monitoring the
request tags we can as well call scsi_host_quiesce() and drop
the hand-crafted helpers.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/comminit.c | 35 ++---------------------------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index f75878d773cf..a01dca86eb37 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -272,38 +272,6 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem,
 	q->entries = qsize;
 }
 
-static void aac_wait_for_io_completion(struct aac_dev *aac)
-{
-	unsigned long flagv = 0;
-	int i = 0;
-
-	for (i = 60; i; --i) {
-		struct scsi_device *dev;
-		struct scsi_cmnd *command;
-		int active = 0;
-
-		__shost_for_each_device(dev, aac->scsi_host_ptr) {
-			spin_lock_irqsave(&dev->list_lock, flagv);
-			list_for_each_entry(command, &dev->cmd_list, list) {
-				if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
-					active++;
-					break;
-				}
-			}
-			spin_unlock_irqrestore(&dev->list_lock, flagv);
-			if (active)
-				break;
-
-		}
-		/*
-		 * We can exit If all the commands are complete
-		 */
-		if (active == 0)
-			break;
-		ssleep(1);
-	}
-}
-
 /**
  *	aac_send_shutdown		-	shutdown an adapter
  *	@dev: Adapter to shutdown
@@ -326,7 +294,7 @@ int aac_send_shutdown(struct aac_dev * dev)
 		mutex_unlock(&dev->ioctl_mutex);
 	}
 
-	aac_wait_for_io_completion(dev);
+	scsi_host_quiesce(dev->scsi_host_ptr);
 
 	fibctx = aac_fib_alloc(dev);
 	if (!fibctx)
@@ -352,6 +320,7 @@ int aac_send_shutdown(struct aac_dev * dev)
 	if (aac_is_src(dev) &&
 	     dev->msi_enabled)
 		aac_set_intx_mode(dev);
+	scsi_host_resume(dev->scsi_host_ptr);
 	return status;
 }
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/11] scsi: add scsi_host_busy_iter()
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (7 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-20 10:31 ` [PATCH 10/11] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs() Hannes Reinecke
  2019-11-20 10:31 ` [PATCH 11/11] scsi: Remove cmd_list functionality Hannes Reinecke
  10 siblings, 0 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Hannes Reinecke

Add an iterator scsi_host_busy_iter() to traverse all busy commands.
If locking against concurrent command completions is required it
has to be provided by the caller.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/hosts.c     | 33 +++++++++++++++++++++++++++++++++
 include/scsi/scsi_host.h |  5 +++++
 2 files changed, 38 insertions(+)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index c26fa1fe6103..23e8c8a38d1f 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -679,3 +679,36 @@ void scsi_host_flush_commands(struct Scsi_Host *shost, int status)
 	blk_mq_tagset_busy_iter(&shost->tag_set, flush_cmds_iter, &status);
 }
 EXPORT_SYMBOL_GPL(scsi_host_flush_commands);
+
+struct scsi_host_busy_iter_data {
+	scsi_host_busy_iter_fn *fn;
+	void *priv;
+};
+
+static bool __scsi_host_busy_iter_fn(struct request *req, void *priv,
+				   bool reserved)
+{
+	struct scsi_host_busy_iter_data *iter_data = priv;
+	struct scsi_cmnd *sc = blk_mq_rq_to_pdu(req);
+
+	return iter_data->fn(sc, iter_data->priv, reserved);
+}
+
+/**
+ * scsi_host_busy_iter - Iterate over all busy commands
+ * @shost:	Pointer to Scsi_Host.
+ * @fn:		Function to call on each busy command
+ * @priv:	Data pointer passed to @fn
+ **/
+void scsi_host_busy_iter(struct Scsi_Host *shost,
+			 scsi_host_busy_iter_fn *fn, void *priv)
+{
+	struct scsi_host_busy_iter_data iter_data = {
+		.fn = fn,
+		.priv = priv,
+	};
+
+	blk_mq_tagset_busy_iter(&shost->tag_set, __scsi_host_busy_iter_fn,
+				&iter_data);
+}
+EXPORT_SYMBOL_GPL(scsi_host_busy_iter);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index cb9a6fe9ad5b..1293d9686115 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -761,6 +761,11 @@ static inline int scsi_host_scan_allowed(struct Scsi_Host *shost)
 extern void scsi_unblock_requests(struct Scsi_Host *);
 extern void scsi_block_requests(struct Scsi_Host *);
 
+typedef bool (scsi_host_busy_iter_fn)(struct scsi_cmnd *, void *, bool);
+
+void scsi_host_busy_iter(struct Scsi_Host *,
+			 scsi_host_busy_iter_fn *fn, void *priv);
+
 struct class_container;
 
 /*
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/11] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs()
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (8 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 09/11] scsi: add scsi_host_busy_iter() Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  2019-11-28 11:42   ` Balsundar.P
  2019-11-20 10:31 ` [PATCH 11/11] scsi: Remove cmd_list functionality Hannes Reinecke
  10 siblings, 1 reply; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Balsundar P, Adaptec OEM Raid Solutions

Use the scsi midlayer helper to traverse the number of outstanding
commands. This also eliminates the last usage for the cmd_list
functionality so we can drop it.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/linit.c | 81 ++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 40 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 847dac80defa..b7b189672118 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -622,54 +622,56 @@ static int aac_ioctl(struct scsi_device *sdev, unsigned int cmd,
 	return aac_do_ioctl(dev, cmd, arg);
 }
 
-static int get_num_of_incomplete_fibs(struct aac_dev *aac)
+struct fib_count_data {
+	int mlcnt;
+	int llcnt;
+	int ehcnt;
+	int fwcnt;
+	int krlcnt;
+};
+
+static bool fib_count_iter(struct scsi_cmnd *scmnd, void *data, bool reserved)
 {
+	struct fib_count_data *fib_count = data;
 
-	unsigned long flags;
-	struct scsi_device *sdev = NULL;
+	switch (scmnd->SCp.phase) {
+	case AAC_OWNER_FIRMWARE:
+		fib_count->fwcnt++;
+		break;
+	case AAC_OWNER_ERROR_HANDLER:
+		fib_count->ehcnt++;
+		break;
+	case AAC_OWNER_LOWLEVEL:
+		fib_count->llcnt++;
+		break;
+	case AAC_OWNER_MIDLEVEL:
+		fib_count->mlcnt++;
+		break;
+	default:
+		fib_count->krlcnt++;
+		break;
+	}
+	return true;
+}
+
+/* Called during SCSI EH, so we don't need to block requests */
+static int get_num_of_incomplete_fibs(struct aac_dev *aac)
+{
 	struct Scsi_Host *shost = aac->scsi_host_ptr;
-	struct scsi_cmnd *scmnd = NULL;
 	struct device *ctrl_dev;
+	struct fib_count_data fcnt = { };
 
-	int mlcnt  = 0;
-	int llcnt  = 0;
-	int ehcnt  = 0;
-	int fwcnt  = 0;
-	int krlcnt = 0;
-
-	__shost_for_each_device(sdev, shost) {
-		spin_lock_irqsave(&sdev->list_lock, flags);
-		list_for_each_entry(scmnd, &sdev->cmd_list, list) {
-			switch (scmnd->SCp.phase) {
-			case AAC_OWNER_FIRMWARE:
-				fwcnt++;
-				break;
-			case AAC_OWNER_ERROR_HANDLER:
-				ehcnt++;
-				break;
-			case AAC_OWNER_LOWLEVEL:
-				llcnt++;
-				break;
-			case AAC_OWNER_MIDLEVEL:
-				mlcnt++;
-				break;
-			default:
-				krlcnt++;
-				break;
-			}
-		}
-		spin_unlock_irqrestore(&sdev->list_lock, flags);
-	}
+	scsi_host_busy_iter(shost, fib_count_iter, &fcnt);
 
 	ctrl_dev = &aac->pdev->dev;
 
-	dev_info(ctrl_dev, "outstanding cmd: midlevel-%d\n", mlcnt);
-	dev_info(ctrl_dev, "outstanding cmd: lowlevel-%d\n", llcnt);
-	dev_info(ctrl_dev, "outstanding cmd: error handler-%d\n", ehcnt);
-	dev_info(ctrl_dev, "outstanding cmd: firmware-%d\n", fwcnt);
-	dev_info(ctrl_dev, "outstanding cmd: kernel-%d\n", krlcnt);
+	dev_info(ctrl_dev, "outstanding cmd: midlevel-%d\n", fcnt.mlcnt);
+	dev_info(ctrl_dev, "outstanding cmd: lowlevel-%d\n", fcnt.llcnt);
+	dev_info(ctrl_dev, "outstanding cmd: error handler-%d\n", fcnt.ehcnt);
+	dev_info(ctrl_dev, "outstanding cmd: firmware-%d\n", fcnt.fwcnt);
+	dev_info(ctrl_dev, "outstanding cmd: kernel-%d\n", fcnt.krlcnt);
 
-	return mlcnt + llcnt + ehcnt + fwcnt;
+	return fcnt.mlcnt + fcnt.llcnt + fcnt.ehcnt + fcnt.fwcnt;
 }
 
 static int aac_eh_abort(struct scsi_cmnd* cmd)
@@ -1675,7 +1677,6 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	shost->irq = pdev->irq;
 	shost->unique_id = unique_id;
 	shost->max_cmd_len = 16;
-	shost->use_cmd_list = 1;
 
 	if (aac_cfg_major == AAC_CHARDEV_NEEDS_REINIT)
 		aac_init_char();
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/11] scsi: Remove cmd_list functionality
  2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
                   ` (9 preceding siblings ...)
  2019-11-20 10:31 ` [PATCH 10/11] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs() Hannes Reinecke
@ 2019-11-20 10:31 ` Hannes Reinecke
  10 siblings, 0 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-20 10:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke

Remove cmd_list functionality; no users left.
With that the scsi_put_command() becomes empty,
so remove that one, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi.c        | 14 --------------
 drivers/scsi/scsi_error.c  |  1 -
 drivers/scsi/scsi_lib.c    | 31 -------------------------------
 drivers/scsi/scsi_priv.h   |  2 --
 drivers/scsi/scsi_scan.c   |  1 -
 include/scsi/scsi_cmnd.h   |  1 -
 include/scsi/scsi_device.h |  1 -
 include/scsi/scsi_host.h   |  2 --
 8 files changed, 53 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index adfe8b3693d5..ed533b6e1fd0 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -94,20 +94,6 @@ EXPORT_SYMBOL(scsi_logging_level);
 ASYNC_DOMAIN_EXCLUSIVE(scsi_sd_pm_domain);
 EXPORT_SYMBOL(scsi_sd_pm_domain);
 
-/**
- * scsi_put_command - Free a scsi command block
- * @cmd: command block to free
- *
- * Returns:	Nothing.
- *
- * Notes:	The command must not belong to any lists.
- */
-void scsi_put_command(struct scsi_cmnd *cmd)
-{
-	scsi_del_cmd_from_list(cmd);
-	BUG_ON(delayed_work_pending(&cmd->abort_work));
-}
-
 #ifdef CONFIG_SCSI_LOGGING
 void scsi_log_send(struct scsi_cmnd *cmd)
 {
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index ae2fa170f6ad..978be1602f71 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2412,7 +2412,6 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
 	wake_up(&shost->host_wait);
 	scsi_run_host_queues(shost);
 
-	scsi_put_command(scmd);
 	kfree(rq);
 
 out_put_autopm_host:
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 771a8352d3e8..c942245fc6aa 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -562,7 +562,6 @@ static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd)
 {
 	scsi_mq_free_sgtables(cmd);
 	scsi_uninit_cmd(cmd);
-	scsi_del_cmd_from_list(cmd);
 }
 
 /* Returns false when no more bytes to process, true if there are more */
@@ -1098,35 +1097,6 @@ static void scsi_cleanup_rq(struct request *rq)
 	}
 }
 
-/* Add a command to the list used by the aacraid and dpt_i2o drivers */
-void scsi_add_cmd_to_list(struct scsi_cmnd *cmd)
-{
-	struct scsi_device *sdev = cmd->device;
-	struct Scsi_Host *shost = sdev->host;
-	unsigned long flags;
-
-	if (shost->use_cmd_list) {
-		spin_lock_irqsave(&sdev->list_lock, flags);
-		list_add_tail(&cmd->list, &sdev->cmd_list);
-		spin_unlock_irqrestore(&sdev->list_lock, flags);
-	}
-}
-
-/* Remove a command from the list used by the aacraid and dpt_i2o drivers */
-void scsi_del_cmd_from_list(struct scsi_cmnd *cmd)
-{
-	struct scsi_device *sdev = cmd->device;
-	struct Scsi_Host *shost = sdev->host;
-	unsigned long flags;
-
-	if (shost->use_cmd_list) {
-		spin_lock_irqsave(&sdev->list_lock, flags);
-		BUG_ON(list_empty(&cmd->list));
-		list_del_init(&cmd->list);
-		spin_unlock_irqrestore(&sdev->list_lock, flags);
-	}
-}
-
 /* Called after a request has been started. */
 void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
 {
@@ -1160,7 +1130,6 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
 	if (in_flight)
 		__set_bit(SCMD_STATE_INFLIGHT, &cmd->state);
 
-	scsi_add_cmd_to_list(cmd);
 }
 
 static blk_status_t scsi_setup_scsi_cmnd(struct scsi_device *sdev,
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 3bff9f7aa684..5eab5da4efe7 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -84,8 +84,6 @@ int scsi_eh_get_sense(struct list_head *work_q,
 int scsi_noretry_cmd(struct scsi_cmnd *scmd);
 
 /* scsi_lib.c */
-extern void scsi_add_cmd_to_list(struct scsi_cmnd *cmd);
-extern void scsi_del_cmd_from_list(struct scsi_cmnd *cmd);
 extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
 extern void scsi_device_unbusy(struct scsi_device *sdev, struct scsi_cmnd *cmd);
 extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 058079f915f1..f2437a7570ce 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -236,7 +236,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	sdev->sdev_state = SDEV_CREATED;
 	INIT_LIST_HEAD(&sdev->siblings);
 	INIT_LIST_HEAD(&sdev->same_target_siblings);
-	INIT_LIST_HEAD(&sdev->cmd_list);
 	INIT_LIST_HEAD(&sdev->starved_entry);
 	INIT_LIST_HEAD(&sdev->event_list);
 	spin_lock_init(&sdev->list_lock);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index a2849bb9cd19..80ac89e47b47 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -159,7 +159,6 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
 	return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
 }
 
-extern void scsi_put_command(struct scsi_cmnd *);
 extern void scsi_finish_command(struct scsi_cmnd *cmd);
 
 extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 2185068ce955..59074f6ec4ae 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -110,7 +110,6 @@ struct scsi_device {
 	atomic_t device_blocked;	/* Device returned QUEUE_FULL. */
 
 	spinlock_t list_lock;
-	struct list_head cmd_list;	/* queue of in use SCSI Command structures */
 	struct list_head starved_entry;
 	unsigned short queue_depth;	/* How deep of a queue we want */
 	unsigned short max_queue_depth;	/* max queue depth */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 1293d9686115..ee43db94a479 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -627,8 +627,6 @@ struct Scsi_Host {
 	/* The controller does not support WRITE SAME */
 	unsigned no_write_same:1;
 
-	unsigned use_cmd_list:1;
-
 	/* Host responded with short (<36 bytes) INQUIRY result */
 	unsigned short_inquiry:1;
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper
  2019-11-20 10:31 ` [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper Hannes Reinecke
@ 2019-11-20 16:14   ` Bart Van Assche
  2019-11-28 11:41   ` Balsundar.P
  1 sibling, 0 replies; 30+ messages in thread
From: Bart Van Assche @ 2019-11-20 16:14 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Balsundar P,
	Adaptec OEM Raid Solutions

On 11/20/19 2:31 AM, Hannes Reinecke wrote:
> Use the midlayer helper scsi_host_flush_commands() to flush all
> outstanding commands.
  Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/11] scsi: add scsi_host_flush_commands() helper
  2019-11-20 10:31 ` [PATCH 02/11] scsi: add scsi_host_flush_commands() helper Hannes Reinecke
@ 2019-11-20 16:19   ` Bart Van Assche
  2019-11-21 15:46     ` Hannes Reinecke
  2019-11-26 16:55   ` Christoph Hellwig
  1 sibling, 1 reply; 30+ messages in thread
From: Bart Van Assche @ 2019-11-20 16:19 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi

On 11/20/19 2:31 AM, Hannes Reinecke wrote:
> +static bool flush_cmds_iter(struct request *rq, void *data, bool reserved)
> +{
> +	struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq);
> +	int status = *(int *)data;
> +
> +	if (reserved)
> +		return true;

Since the SCSI core does not support reserving tags, this early return 
is dead code. Additionally, I'm not sure this early return would be 
correct if reserved tag support would be added to the SCSI core. How 
about leaving out this early return?

> +	scsi_dma_unmap(scmd);
> +	scmd->result = status << 16;
> +	scmd->scsi_done(scmd);
> +	return true;
> +}
> +
> +/**
> + * scsi_host_flush_commands -- Terminate all running commands
                                ^^
Should this have been a single hyphen?

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete
  2019-11-20 10:31 ` [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete Hannes Reinecke
@ 2019-11-20 16:23   ` Bart Van Assche
  2019-11-26  8:29   ` Balsundar.P
  2019-11-28 11:45   ` Balsundar.P
  2 siblings, 0 replies; 30+ messages in thread
From: Bart Van Assche @ 2019-11-20 16:23 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Balsundar P,
	Adaptec OEM Raid Solutions

On 11/20/19 2:31 AM, Hannes Reinecke wrote:
> Instead of waiting for all I/O to complete by monitoring the
> request tags we can as well call scsi_host_quiesce() and drop
> the hand-crafted helpers.
> 
> Cc: Balsundar P <balsundar.p@microsemi.com>
> Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/scsi/aacraid/comminit.c | 35 ++---------------------------------
>   1 file changed, 2 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
> index f75878d773cf..a01dca86eb37 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -272,38 +272,6 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem,
>   	q->entries = qsize;
>   }
>   
> -static void aac_wait_for_io_completion(struct aac_dev *aac)
> -{
> -	unsigned long flagv = 0;
> -	int i = 0;
> -
> -	for (i = 60; i; --i) {
> -		struct scsi_device *dev;
> -		struct scsi_cmnd *command;
> -		int active = 0;
> -
> -		__shost_for_each_device(dev, aac->scsi_host_ptr) {
> -			spin_lock_irqsave(&dev->list_lock, flagv);
> -			list_for_each_entry(command, &dev->cmd_list, list) {
> -				if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
> -					active++;
> -					break;
> -				}
> -			}
> -			spin_unlock_irqrestore(&dev->list_lock, flagv);
> -			if (active)
> -				break;
> -
> -		}
> -		/*
> -		 * We can exit If all the commands are complete
> -		 */
> -		if (active == 0)
> -			break;
> -		ssleep(1);
> -	}
> -}
> -
>   /**
>    *	aac_send_shutdown		-	shutdown an adapter
>    *	@dev: Adapter to shutdown
> @@ -326,7 +294,7 @@ int aac_send_shutdown(struct aac_dev * dev)
>   		mutex_unlock(&dev->ioctl_mutex);
>   	}
>   
> -	aac_wait_for_io_completion(dev);
> +	scsi_host_quiesce(dev->scsi_host_ptr);
>   
>   	fibctx = aac_fib_alloc(dev);
>   	if (!fibctx)
> @@ -352,6 +320,7 @@ int aac_send_shutdown(struct aac_dev * dev)
>   	if (aac_is_src(dev) &&
>   	     dev->msi_enabled)
>   		aac_set_intx_mode(dev);
> +	scsi_host_resume(dev->scsi_host_ptr);
>   	return status;
>   }

Can aac_wait_for_io_completion() be called from inside the aacraid SCSI 
host reset handler? Is it safe to call scsi_host_quiesce() from inside a 
host reset handler? Sorry that I sent you in the wrong direction with a 
previous comment.

Bart.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/11] scsi: add scsi_host_flush_commands() helper
  2019-11-20 16:19   ` Bart Van Assche
@ 2019-11-21 15:46     ` Hannes Reinecke
  0 siblings, 0 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-21 15:46 UTC (permalink / raw)
  To: Bart Van Assche, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi

On 11/20/19 5:19 PM, Bart Van Assche wrote:
> On 11/20/19 2:31 AM, Hannes Reinecke wrote:
>> +static bool flush_cmds_iter(struct request *rq, void *data, bool
>> reserved)
>> +{
>> +    struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq);
>> +    int status = *(int *)data;
>> +
>> +    if (reserved)
>> +        return true;
> 
> Since the SCSI core does not support reserving tags, this early return
> is dead code. Additionally, I'm not sure this early return would be
> correct if reserved tag support would be added to the SCSI core. How
> about leaving out this early return?
> 
Yeah, all right.

>> +    scsi_dma_unmap(scmd);
>> +    scmd->result = status << 16;
>> +    scmd->scsi_done(scmd);
>> +    return true;
>> +}
>> +
>> +/**
>> + * scsi_host_flush_commands -- Terminate all running commands
>                                ^^
> Should this have been a single hyphen?
> 
Maybe.

Will be sending an updated version.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      Teamlead Storage & Networking
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 247165 (AG München), GF: Felix Imendörffer

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete
  2019-11-20 10:31 ` [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete Hannes Reinecke
  2019-11-20 16:23   ` Bart Van Assche
@ 2019-11-26  8:29   ` Balsundar.P
  2019-11-28 11:45   ` Balsundar.P
  2 siblings, 0 replies; 30+ messages in thread
From: Balsundar.P @ 2019-11-26  8:29 UTC (permalink / raw)
  To: hare, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

Thanks, Hannes
We are in the process of reviewing patches and will get back to you on this shortly

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, November 20, 2019 16:01
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Balsundar P <balsundar.p@microsemi.com>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Instead of waiting for all I/O to complete by monitoring the request tags we can as well call scsi_host_quiesce() and drop the hand-crafted helpers.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/comminit.c | 35 ++---------------------------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index f75878d773cf..a01dca86eb37 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -272,38 +272,6 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem,
        q->entries = qsize;
 }

-static void aac_wait_for_io_completion(struct aac_dev *aac) -{
-       unsigned long flagv = 0;
-       int i = 0;
-
-       for (i = 60; i; --i) {
-               struct scsi_device *dev;
-               struct scsi_cmnd *command;
-               int active = 0;
-
-               __shost_for_each_device(dev, aac->scsi_host_ptr) {
-                       spin_lock_irqsave(&dev->list_lock, flagv);
-                       list_for_each_entry(command, &dev->cmd_list, list) {
-                               if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
-                                       active++;
-                                       break;
-                               }
-                       }
-                       spin_unlock_irqrestore(&dev->list_lock, flagv);
-                       if (active)
-                               break;
-
-               }
-               /*
-                * We can exit If all the commands are complete
-                */
-               if (active == 0)
-                       break;
-               ssleep(1);
-       }
-}
-
 /**
  *     aac_send_shutdown               -       shutdown an adapter
  *     @dev: Adapter to shutdown
@@ -326,7 +294,7 @@ int aac_send_shutdown(struct aac_dev * dev)
                mutex_unlock(&dev->ioctl_mutex);
        }

-       aac_wait_for_io_completion(dev);
+       scsi_host_quiesce(dev->scsi_host_ptr);

        fibctx = aac_fib_alloc(dev);
        if (!fibctx)
@@ -352,6 +320,7 @@ int aac_send_shutdown(struct aac_dev * dev)
        if (aac_is_src(dev) &&
             dev->msi_enabled)
                aac_set_intx_mode(dev);
+       scsi_host_resume(dev->scsi_host_ptr);
        return status;
 }

--
2.16.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/11] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete()
  2019-11-20 10:31 ` [PATCH 01/11] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete() Hannes Reinecke
@ 2019-11-26 16:54   ` Christoph Hellwig
  0 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2019-11-26 16:54 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Adaptec OEM Raid Solutions

On Wed, Nov 20, 2019 at 11:31:04AM +0100, Hannes Reinecke wrote:
> Rename the badly named function into adpt_i2o_scsi_complete(),
> and make it a void function as the return value is never used.
> This also fixes a potential use-after free as the return value
> might be evaluated from the command result after the command
> has been freed.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/11] scsi: add scsi_host_flush_commands() helper
  2019-11-20 10:31 ` [PATCH 02/11] scsi: add scsi_host_flush_commands() helper Hannes Reinecke
  2019-11-20 16:19   ` Bart Van Assche
@ 2019-11-26 16:55   ` Christoph Hellwig
  2019-11-26 18:25     ` Hannes Reinecke
  1 sibling, 1 reply; 30+ messages in thread
From: Christoph Hellwig @ 2019-11-26 16:55 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley, linux-scsi

flush is such a heavіly overloaded term.  What about
scsi_host_complete_all_commands?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 03/11] dpt_i2o: use scsi_host_flush_commands() to abort outstanding commands
  2019-11-20 10:31 ` [PATCH 03/11] dpt_i2o: use scsi_host_flush_commands() to abort outstanding commands Hannes Reinecke
@ 2019-11-26 16:55   ` Christoph Hellwig
  0 siblings, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2019-11-26 16:55 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Adaptec OEM Raid Solutions

Looks good modulo the naming nitpick:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache
  2019-11-20 10:31 ` [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache Hannes Reinecke
@ 2019-11-26 17:02   ` Christoph Hellwig
  2019-11-28 11:40   ` Balsundar.P
  1 sibling, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2019-11-26 17:02 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Balsundar P, Adaptec OEM Raid Solutions

On Wed, Nov 20, 2019 at 11:31:07AM +0100, Hannes Reinecke wrote:
> There is no need to wait for outstanding write commands on synchronize
> cache; the block layer is responsible for I/O scheduling, no need
> to out-guess it on the driver layer.

So I think this doesn't make any sense as it doesn't fit the SCSI
SYNCRONIZE CACHE or Linux flush semantics, but i'd really like to hear
from the Microsemi folks.

FYI, below is the rather inconclusive commit from the history tree that
added this code originally:

---
From 45b95e26fd0e7dd6c38e424ee650becc15fe5975 Mon Sep 17 00:00:00 2001
From: Mark Haverkamp <markh@osdl.org>
Date: Sat, 22 Jan 2005 21:12:43 -0600
Subject: [PATCH] aacraid 2.6: add scsi synchronize cache support.

This is an update from the Adaptec driver that adds support for the scsi
synchronize cache command.  It essentially blocks further commands until
data has been flushed to the disks.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
---
 drivers/scsi/aacraid/aachba.c  | 113 +++++++++++++++++++++++++++++++++
 drivers/scsi/aacraid/aacraid.h |  24 +++++++
 2 files changed, 137 insertions(+)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 514caa9adc2c..782776243b96 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1029,6 +1029,114 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
 	return 0;
 }
 
+static void synchronize_callback(void *context, struct fib *fibptr)
+{
+	struct aac_synchronize_reply *synchronizereply;
+	struct scsi_cmnd *cmd;
+
+	cmd = context;
+
+	dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", 
+				smp_processor_id(), jiffies));
+	BUG_ON(fibptr == NULL);
+
+
+	synchronizereply = fib_data(fibptr);
+	if (le32_to_cpu(synchronizereply->status) == CT_OK)
+		cmd->result = DID_OK << 16 | 
+			COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
+	else {
+		struct scsi_device *sdev = cmd->device;
+		struct aac_dev *dev = (struct aav_dev *)sdev->host->hostdata;
+		u32 cid = ID_LUN_TO_CONTAINER(sdev->id, sdev->lun);
+		printk(KERN_WARNING 
+		     "synchronize_callback: synchronize failed, status = %d\n",
+		     synchronizereply->status);
+		cmd->result = DID_OK << 16 | 
+			COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
+		set_sense((u8 *)&dev->fsa_dev[cid].sense_data,
+				    HARDWARE_ERROR,
+				    SENCODE_INTERNAL_TARGET_FAILURE,
+				    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
+				    0, 0);
+		memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
+		  min(sizeof(dev->fsa_dev[cid].sense_data), 
+			  sizeof(cmd->sense_buffer)));
+	}
+
+	fib_complete(fibptr);
+	fib_free(fibptr);
+	aac_io_done(cmd);
+}
+
+static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
+{
+	int status;
+	struct fib *cmd_fibcontext;
+	struct aac_synchronize *synchronizecmd;
+	struct scsi_cmnd *cmd;
+	struct scsi_device *sdev = scsicmd->device;
+	int active = 0;
+	unsigned long flags;
+
+	/*
+	 * Wait for all commands to complete to this specific
+	 * target (block).
+	 */
+	spin_lock_irqsave(&sdev->list_lock, flags);
+	list_for_each_entry(cmd, &sdev->cmd_list, list)
+		if (cmd != scsicmd && cmd->serial_number != 0) {
+			++active;
+			break;
+		}
+
+	spin_unlock_irqrestore(&sdev->list_lock, flags);
+
+	/*
+	 *	Yield the processor (requeue for later)
+	 */
+	if (active)
+		return SCSI_MLQUEUE_DEVICE_BUSY;
+
+	/*
+	 *	Alocate and initialize a Fib
+	 */
+	if (!(cmd_fibcontext = 
+	    fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata))) 
+		return SCSI_MLQUEUE_HOST_BUSY;
+
+	fib_init(cmd_fibcontext);
+
+	synchronizecmd = fib_data(cmd_fibcontext);
+	synchronizecmd->command = cpu_to_le32(VM_ContainerConfig);
+	synchronizecmd->type = cpu_to_le32(CT_FLUSH_CACHE);
+	synchronizecmd->cid = cpu_to_le32(cid);
+	synchronizecmd->count = 
+	     cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data));
+
+	/*
+	 *	Now send the Fib to the adapter
+	 */
+	status = fib_send(ContainerCommand,
+		  cmd_fibcontext,
+		  sizeof(struct aac_synchronize),
+		  FsaNormal,
+		  0, 1,
+		  (fib_callback)synchronize_callback,
+		  (void *)scsicmd);
+
+	/*
+	 *	Check that the command queued to the controller
+	 */
+	if (status == -EINPROGRESS)
+		return 0;
+
+	printk(KERN_WARNING 
+		"aac_synchronize: fib_send failed with status: %d.\n", status);
+	fib_complete(cmd_fibcontext);
+	fib_free(cmd_fibcontext);
+	return SCSI_MLQUEUE_HOST_BUSY;
+}
 
 /**
  *	aac_scsi_cmd()		-	Process SCSI command
@@ -1274,6 +1382,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 			ret = aac_write(scsicmd, cid);
 			spin_lock_irq(host->host_lock);
 			return ret;
+
+		case SYNCHRONIZE_CACHE:
+			/* Issue FIB to tell Firmware to flush it's cache */
+			return aac_synchronize(scsicmd, cid);
+			
 		default:
 			/*
 			 *	Unhandled commands
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 987222ef30e1..7309129568b6 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1069,6 +1069,30 @@ struct aac_write_reply
 	u32		committed;
 };
 
+#define CT_FLUSH_CACHE 129
+struct aac_synchronize {
+	u32		command;	/* VM_ContainerConfig */
+	u32		type;		/* CT_FLUSH_CACHE */
+	u32		cid;
+	u32		parm1;
+	u32		parm2;
+	u32		parm3;
+	u32		parm4;
+	u32		count;	/* sizeof(((struct aac_synchronize_reply *)NULL)->data) */
+};
+
+struct aac_synchronize_reply {
+	u32		dummy0;
+	u32		dummy1;
+	u32		status;	/* CT_OK */
+	u32		parm1;
+	u32		parm2;
+	u32		parm3;
+	u32		parm4;
+	u32		parm5;
+	u8		data[16];
+};
+
 struct aac_srb
 {
 	u32		function;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands
  2019-11-20 10:31 ` [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands Hannes Reinecke
@ 2019-11-26 17:02   ` Christoph Hellwig
  2019-11-28 11:41   ` Balsundar.P
  1 sibling, 0 replies; 30+ messages in thread
From: Christoph Hellwig @ 2019-11-26 17:02 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Balsundar P, Adaptec OEM Raid Solutions

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/11] scsi: add scsi_host_flush_commands() helper
  2019-11-26 16:55   ` Christoph Hellwig
@ 2019-11-26 18:25     ` Hannes Reinecke
  0 siblings, 0 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-26 18:25 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Martin K. Petersen, James Bottomley, linux-scsi

On 11/26/19 5:55 PM, Christoph Hellwig wrote:
> flush is such a heavіly overloaded term.  What about
> scsi_host_complete_all_commands?
> 
Sure. As it happens I've been struggling with the function name, too,
so any meaningful name is good with me.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache
  2019-11-20 10:31 ` [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache Hannes Reinecke
  2019-11-26 17:02   ` Christoph Hellwig
@ 2019-11-28 11:40   ` Balsundar.P
  1 sibling, 0 replies; 30+ messages in thread
From: Balsundar.P @ 2019-11-28 11:40 UTC (permalink / raw)
  To: hare, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

Acked-by: Balsundar P < Balsundar.P@microchip.com>

Before flushing the cache, raid firmware will ensure no commands are active.
This patch can be applied.

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, November 20, 2019 16:01
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Balsundar P <balsundar.p@microsemi.com>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

There is no need to wait for outstanding write commands on synchronize cache; the block layer is responsible for I/O scheduling, no need to out-guess it on the driver layer.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/aachba.c | 76 ++-----------------------------------------
 1 file changed, 2 insertions(+), 74 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index e36608ce937a..cfa14e15d5f0 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2601,9 +2601,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)  static void synchronize_callback(void *context, struct fib *fibptr)  {
        struct aac_synchronize_reply *synchronizereply;
-       struct scsi_cmnd *cmd;
-
-       cmd = context;
+       struct scsi_cmnd *cmd = context;

        if (!aac_valid_context(cmd, fibptr))
                return;
@@ -2644,77 +2642,8 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
        int status;
        struct fib *cmd_fibcontext;
        struct aac_synchronize *synchronizecmd;
-       struct scsi_cmnd *cmd;
        struct scsi_device *sdev = scsicmd->device;
-       int active = 0;
        struct aac_dev *aac;
-       u64 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) |
-               (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
-       u32 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
-       unsigned long flags;
-
-       /*
-        * Wait for all outstanding queued commands to complete to this
-        * specific target (block).
-        */
-       spin_lock_irqsave(&sdev->list_lock, flags);
-       list_for_each_entry(cmd, &sdev->cmd_list, list)
-               if (cmd->SCp.phase == AAC_OWNER_FIRMWARE) {
-                       u64 cmnd_lba;
-                       u32 cmnd_count;
-
-                       if (cmd->cmnd[0] == WRITE_6) {
-                               cmnd_lba = ((cmd->cmnd[1] & 0x1F) << 16) |
-                                       (cmd->cmnd[2] << 8) |
-                                       cmd->cmnd[3];
-                               cmnd_count = cmd->cmnd[4];
-                               if (cmnd_count == 0)
-                                       cmnd_count = 256;
-                       } else if (cmd->cmnd[0] == WRITE_16) {
-                               cmnd_lba = ((u64)cmd->cmnd[2] << 56) |
-                                       ((u64)cmd->cmnd[3] << 48) |
-                                       ((u64)cmd->cmnd[4] << 40) |
-                                       ((u64)cmd->cmnd[5] << 32) |
-                                       ((u64)cmd->cmnd[6] << 24) |
-                                       (cmd->cmnd[7] << 16) |
-                                       (cmd->cmnd[8] << 8) |
-                                       cmd->cmnd[9];
-                               cmnd_count = (cmd->cmnd[10] << 24) |
-                                       (cmd->cmnd[11] << 16) |
-                                       (cmd->cmnd[12] << 8) |
-                                       cmd->cmnd[13];
-                       } else if (cmd->cmnd[0] == WRITE_12) {
-                               cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
-                                       (cmd->cmnd[3] << 16) |
-                                       (cmd->cmnd[4] << 8) |
-                                       cmd->cmnd[5];
-                               cmnd_count = (cmd->cmnd[6] << 24) |
-                                       (cmd->cmnd[7] << 16) |
-                                       (cmd->cmnd[8] << 8) |
-                                       cmd->cmnd[9];
-                       } else if (cmd->cmnd[0] == WRITE_10) {
-                               cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
-                                       (cmd->cmnd[3] << 16) |
-                                       (cmd->cmnd[4] << 8) |
-                                       cmd->cmnd[5];
-                               cmnd_count = (cmd->cmnd[7] << 8) |
-                                       cmd->cmnd[8];
-                       } else
-                               continue;
-                       if (((cmnd_lba + cmnd_count) < lba) ||
-                         (count && ((lba + count) < cmnd_lba)))
-                               continue;
-                       ++active;
-                       break;
-               }
-
-       spin_unlock_irqrestore(&sdev->list_lock, flags);
-
-       /*
-        *      Yield the processor (requeue for later)
-        */
-       if (active)
-               return SCSI_MLQUEUE_DEVICE_BUSY;

        aac = (struct aac_dev *)sdev->host->hostdata;
        if (aac->in_reset)
@@ -2723,8 +2652,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
        /*
         *      Allocate and initialize a Fib
         */
-       if (!(cmd_fibcontext = aac_fib_alloc(aac)))
-               return SCSI_MLQUEUE_HOST_BUSY;
+       cmd_fibcontext = aac_fib_alloc_tag(aac, scsicmd);

        aac_fib_init(cmd_fibcontext);

--
2.16.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands
  2019-11-20 10:31 ` [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands Hannes Reinecke
  2019-11-26 17:02   ` Christoph Hellwig
@ 2019-11-28 11:41   ` Balsundar.P
  1 sibling, 0 replies; 30+ messages in thread
From: Balsundar.P @ 2019-11-28 11:41 UTC (permalink / raw)
  To: hare, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

Acked-by: Balsundar P < Balsundar.P@microchip.com>

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, November 20, 2019 16:01
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Balsundar P <balsundar.p@microsemi.com>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Use scsi_host_flush_commands() to terminate all outstanding commands instead, and change the command result for terminated commands to the more common 'DID_RESET' instead of 'QUEUE_FULL'.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/aacraid/commsup.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 5a8a999606ea..e413b784a8d0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1478,8 +1478,6 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
        int retval;
        struct Scsi_Host *host;
        struct scsi_device *dev;
-       struct scsi_cmnd *command;
-       struct scsi_cmnd *command_list;
        int jafo = 0;
        int bled;
        u64 dmamask;
@@ -1607,26 +1605,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
         * This is where the assumption that the Adapter is quiesced
         * is important.
         */
-       command_list = NULL;
-       __shost_for_each_device(dev, host) {
-               unsigned long flags;
-               spin_lock_irqsave(&dev->list_lock, flags);
-               list_for_each_entry(command, &dev->cmd_list, list)
-                       if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
-                               command->SCp.buffer = (struct scatterlist *)command_list;
-                               command_list = command;
-                       }
-               spin_unlock_irqrestore(&dev->list_lock, flags);
-       }
-       while ((command = command_list)) {
-               command_list = (struct scsi_cmnd *)command->SCp.buffer;
-               command->SCp.buffer = NULL;
-               command->result = DID_OK << 16
-                 | COMMAND_COMPLETE << 8
-                 | SAM_STAT_TASK_SET_FULL;
-               command->SCp.phase = AAC_OWNER_ERROR_HANDLER;
-               command->scsi_done(command);
-       }
+       scsi_host_flush_commands(host, DID_RESET);
+
        /*
         * Any Device that was already marked offline needs to be marked
         * running
--
2.16.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper
  2019-11-20 10:31 ` [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper Hannes Reinecke
  2019-11-20 16:14   ` Bart Van Assche
@ 2019-11-28 11:41   ` Balsundar.P
  1 sibling, 0 replies; 30+ messages in thread
From: Balsundar.P @ 2019-11-28 11:41 UTC (permalink / raw)
  To: hare, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

Acked-by: Balsundar P < Balsundar.P@microchip.com>

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, November 20, 2019 16:01
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Balsundar P <balsundar.p@microsemi.com>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Use the midlayer helper scsi_host_flush_commands() to flush all outstanding commands.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/linit.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index ee6bc2f9b80a..847dac80defa 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1977,26 +1977,6 @@ static void aac_remove_one(struct pci_dev *pdev)
        }
 }

-static void aac_flush_ios(struct aac_dev *aac) -{
-       int i;
-       struct scsi_cmnd *cmd;
-
-       for (i = 0; i < aac->scsi_host_ptr->can_queue; i++) {
-               cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data;
-               if (cmd && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) {
-                       scsi_dma_unmap(cmd);
-
-                       if (aac->handle_pci_error)
-                               cmd->result = DID_NO_CONNECT << 16;
-                       else
-                               cmd->result = DID_RESET << 16;
-
-                       cmd->scsi_done(cmd);
-               }
-       }
-}
-
 static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
                                        enum pci_channel_state error)  { @@ -2013,7 +1993,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,

                scsi_block_requests(aac->scsi_host_ptr);
                aac_cancel_rescan_worker(aac);
-               aac_flush_ios(aac);
+               scsi_host_flush_commands(aac->scsi_host_ptr, 
+ DID_NO_CONNECT);
                aac_release_resources(aac);

                pci_disable_pcie_error_reporting(pdev);
@@ -2023,7 +2003,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
        case pci_channel_io_perm_failure:
                aac->handle_pci_error = 1;

-               aac_flush_ios(aac);
+               scsi_host_flush_commands(aac->scsi_host_ptr, 
+ DID_NO_CONNECT);
                return PCI_ERS_RESULT_DISCONNECT;
        }

--
2.16.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 10/11] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs()
  2019-11-20 10:31 ` [PATCH 10/11] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs() Hannes Reinecke
@ 2019-11-28 11:42   ` Balsundar.P
  0 siblings, 0 replies; 30+ messages in thread
From: Balsundar.P @ 2019-11-28 11:42 UTC (permalink / raw)
  To: hare, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

Acked-by: Balsundar P < Balsundar.P@microchip.com>

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, November 20, 2019 16:01
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Balsundar P <balsundar.p@microsemi.com>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 10/11] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs()

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Use the scsi midlayer helper to traverse the number of outstanding commands. This also eliminates the last usage for the cmd_list functionality so we can drop it.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/linit.c | 81 ++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 40 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 847dac80defa..b7b189672118 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -622,54 +622,56 @@ static int aac_ioctl(struct scsi_device *sdev, unsigned int cmd,
        return aac_do_ioctl(dev, cmd, arg);  }

-static int get_num_of_incomplete_fibs(struct aac_dev *aac)
+struct fib_count_data {
+       int mlcnt;
+       int llcnt;
+       int ehcnt;
+       int fwcnt;
+       int krlcnt;
+};
+
+static bool fib_count_iter(struct scsi_cmnd *scmnd, void *data, bool 
+reserved)
 {
+       struct fib_count_data *fib_count = data;

-       unsigned long flags;
-       struct scsi_device *sdev = NULL;
+       switch (scmnd->SCp.phase) {
+       case AAC_OWNER_FIRMWARE:
+               fib_count->fwcnt++;
+               break;
+       case AAC_OWNER_ERROR_HANDLER:
+               fib_count->ehcnt++;
+               break;
+       case AAC_OWNER_LOWLEVEL:
+               fib_count->llcnt++;
+               break;
+       case AAC_OWNER_MIDLEVEL:
+               fib_count->mlcnt++;
+               break;
+       default:
+               fib_count->krlcnt++;
+               break;
+       }
+       return true;
+}
+
+/* Called during SCSI EH, so we don't need to block requests */ static 
+int get_num_of_incomplete_fibs(struct aac_dev *aac) {
        struct Scsi_Host *shost = aac->scsi_host_ptr;
-       struct scsi_cmnd *scmnd = NULL;
        struct device *ctrl_dev;
+       struct fib_count_data fcnt = { };

-       int mlcnt  = 0;
-       int llcnt  = 0;
-       int ehcnt  = 0;
-       int fwcnt  = 0;
-       int krlcnt = 0;
-
-       __shost_for_each_device(sdev, shost) {
-               spin_lock_irqsave(&sdev->list_lock, flags);
-               list_for_each_entry(scmnd, &sdev->cmd_list, list) {
-                       switch (scmnd->SCp.phase) {
-                       case AAC_OWNER_FIRMWARE:
-                               fwcnt++;
-                               break;
-                       case AAC_OWNER_ERROR_HANDLER:
-                               ehcnt++;
-                               break;
-                       case AAC_OWNER_LOWLEVEL:
-                               llcnt++;
-                               break;
-                       case AAC_OWNER_MIDLEVEL:
-                               mlcnt++;
-                               break;
-                       default:
-                               krlcnt++;
-                               break;
-                       }
-               }
-               spin_unlock_irqrestore(&sdev->list_lock, flags);
-       }
+       scsi_host_busy_iter(shost, fib_count_iter, &fcnt);

        ctrl_dev = &aac->pdev->dev;

-       dev_info(ctrl_dev, "outstanding cmd: midlevel-%d\n", mlcnt);
-       dev_info(ctrl_dev, "outstanding cmd: lowlevel-%d\n", llcnt);
-       dev_info(ctrl_dev, "outstanding cmd: error handler-%d\n", ehcnt);
-       dev_info(ctrl_dev, "outstanding cmd: firmware-%d\n", fwcnt);
-       dev_info(ctrl_dev, "outstanding cmd: kernel-%d\n", krlcnt);
+       dev_info(ctrl_dev, "outstanding cmd: midlevel-%d\n", fcnt.mlcnt);
+       dev_info(ctrl_dev, "outstanding cmd: lowlevel-%d\n", fcnt.llcnt);
+       dev_info(ctrl_dev, "outstanding cmd: error handler-%d\n", fcnt.ehcnt);
+       dev_info(ctrl_dev, "outstanding cmd: firmware-%d\n", fcnt.fwcnt);
+       dev_info(ctrl_dev, "outstanding cmd: kernel-%d\n", fcnt.krlcnt);

-       return mlcnt + llcnt + ehcnt + fwcnt;
+       return fcnt.mlcnt + fcnt.llcnt + fcnt.ehcnt + fcnt.fwcnt;
 }

 static int aac_eh_abort(struct scsi_cmnd* cmd) @@ -1675,7 +1677,6 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        shost->irq = pdev->irq;
        shost->unique_id = unique_id;
        shost->max_cmd_len = 16;
-       shost->use_cmd_list = 1;

        if (aac_cfg_major == AAC_CHARDEV_NEEDS_REINIT)
                aac_init_char();
--
2.16.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete
  2019-11-20 10:31 ` [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete Hannes Reinecke
  2019-11-20 16:23   ` Bart Van Assche
  2019-11-26  8:29   ` Balsundar.P
@ 2019-11-28 11:45   ` Balsundar.P
  2019-11-28 12:09     ` Hannes Reinecke
  2 siblings, 1 reply; 30+ messages in thread
From: Balsundar.P @ 2019-11-28 11:45 UTC (permalink / raw)
  To: hare, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

NAK

After applying this patch, while IOs were running on physical drive, 
issued controller reset from management utility.
Observed below call trace. It is from scsi_device_quiesce().

Nov 27 19:24:21 ubuntu kernel: [ 1330.799311] INFO: task arcconf:2386 blocked for more than 120 seconds.
Nov 27 19:24:21 ubuntu kernel: [ 1330.799841]       Not tainted 5.4.0-rc1+ #2
Nov 27 19:24:21 ubuntu kernel: [ 1330.800235] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Nov 27 19:24:21 ubuntu kernel: [ 1330.800678] arcconf         D    0  2386   2173 0x00004000
Nov 27 19:24:21 ubuntu kernel: [ 1330.800682] Call Trace:
Nov 27 19:24:21 ubuntu kernel: [ 1330.800699]  __schedule+0x291/0x6f0
Nov 27 19:24:21 ubuntu kernel: [ 1330.800703]  schedule+0x33/0xa0
Nov 27 19:24:21 ubuntu kernel: [ 1330.800710]  blk_mq_freeze_queue_wait+0x4b/0xb0
Nov 27 19:24:21 ubuntu kernel: [ 1330.800717]  ? wait_woken+0x80/0x80
Nov 27 19:24:21 ubuntu kernel: [ 1330.800721]  blk_mq_freeze_queue+0x1a/0x20
Nov 27 19:24:21 ubuntu kernel: [ 1330.800727]  scsi_device_quiesce+0x5d/0xb0
Nov 27 19:24:21 ubuntu kernel: [ 1330.800730]  scsi_host_quiesce+0x41/0x60
Nov 27 19:24:21 ubuntu kernel: [ 1330.800742]  aac_send_shutdown+0x7c/0x180 [aacraid]
Nov 27 19:24:21 ubuntu kernel: [ 1330.800749]  aac_reset_adapter+0x29f/0x760 [aacraid]
Nov 27 19:24:21 ubuntu kernel: [ 1330.800757]  ? security_capable+0x3f/0x60
Nov 27 19:24:21 ubuntu kernel: [ 1330.800762]  aac_store_reset_adapter+0x41/0x60 [aacraid]
Nov 27 19:24:21 ubuntu kernel: [ 1330.800770]  dev_attr_store+0x17/0x30
Nov 27 19:24:21 ubuntu kernel: [ 1330.800777]  sysfs_kf_write+0x3c/0x50
Nov 27 19:24:21 ubuntu kernel: [ 1330.800779]  kernfs_fop_write+0x125/0x1a0
Nov 27 19:24:21 ubuntu kernel: [ 1330.800785]  __vfs_write+0x1b/0x40
Nov 27 19:24:21 ubuntu kernel: [ 1330.800789]  vfs_write+0xb1/0x1a0
Nov 27 19:24:21 ubuntu kernel: [ 1330.800792]  ksys_write+0xa7/0xe0
Nov 27 19:24:21 ubuntu kernel: [ 1330.800795]  __x64_sys_write+0x1a/0x20
Nov 27 19:24:21 ubuntu kernel: [ 1330.800802]  do_syscall_64+0x57/0x190
Nov 27 19:24:21 ubuntu kernel: [ 1330.800806]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
Nov 27 19:24:21 ubuntu kernel: [ 1330.800810] RIP: 0033:0x7f67cfb7c2b7
Nov 27 19:24:21 ubuntu kernel: [ 1330.800819] Code: Bad RIP value.
Nov 27 19:24:21 ubuntu kernel: [ 1330.800821] RSP: 002b:00007ffeb23ca8c0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
Nov 27 19:24:21 ubuntu kernel: [ 1330.800823] RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00007f67cfb7c2b7
Nov 27 19:24:21 ubuntu kernel: [ 1330.800825] RDX: 0000000000000002 RSI: 00007ffeb23ca8f0 RDI: 0000000000000006
Nov 27 19:24:21 ubuntu kernel: [ 1330.800826] RBP: 00007ffeb23ca8f0 R08: 0000000000000000 R09: 0000000000000000
Nov 27 19:24:21 ubuntu kernel: [ 1330.800828] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000002
Nov 27 19:24:21 ubuntu kernel: [ 1330.800829] R13: 00007ffeb23cad20 R14: 00007ffeb23cadf0 R15: 00007ffeb23cac60

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, November 20, 2019 16:01
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Balsundar P <balsundar.p@microsemi.com>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Instead of waiting for all I/O to complete by monitoring the request tags we can as well call scsi_host_quiesce() and drop the hand-crafted helpers.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/aacraid/comminit.c | 35 ++---------------------------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index f75878d773cf..a01dca86eb37 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -272,38 +272,6 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem,
        q->entries = qsize;
 }

-static void aac_wait_for_io_completion(struct aac_dev *aac) -{
-       unsigned long flagv = 0;
-       int i = 0;
-
-       for (i = 60; i; --i) {
-               struct scsi_device *dev;
-               struct scsi_cmnd *command;
-               int active = 0;
-
-               __shost_for_each_device(dev, aac->scsi_host_ptr) {
-                       spin_lock_irqsave(&dev->list_lock, flagv);
-                       list_for_each_entry(command, &dev->cmd_list, list) {
-                               if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
-                                       active++;
-                                       break;
-                               }
-                       }
-                       spin_unlock_irqrestore(&dev->list_lock, flagv);
-                       if (active)
-                               break;
-
-               }
-               /*
-                * We can exit If all the commands are complete
-                */
-               if (active == 0)
-                       break;
-               ssleep(1);
-       }
-}
-
 /**
  *     aac_send_shutdown               -       shutdown an adapter
  *     @dev: Adapter to shutdown
@@ -326,7 +294,7 @@ int aac_send_shutdown(struct aac_dev * dev)
                mutex_unlock(&dev->ioctl_mutex);
        }

-       aac_wait_for_io_completion(dev);
+       scsi_host_quiesce(dev->scsi_host_ptr);

        fibctx = aac_fib_alloc(dev);
        if (!fibctx)
@@ -352,6 +320,7 @@ int aac_send_shutdown(struct aac_dev * dev)
        if (aac_is_src(dev) &&
             dev->msi_enabled)
                aac_set_intx_mode(dev);
+       scsi_host_resume(dev->scsi_host_ptr);
        return status;
 }

--
2.16.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete
  2019-11-28 11:45   ` Balsundar.P
@ 2019-11-28 12:09     ` Hannes Reinecke
  2019-12-04 15:02       ` Hannes Reinecke
  0 siblings, 1 reply; 30+ messages in thread
From: Hannes Reinecke @ 2019-11-28 12:09 UTC (permalink / raw)
  To: Balsundar.P, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

On 11/28/19 12:45 PM, Balsundar.P@microchip.com wrote:
> NAK
> 
> After applying this patch, while IOs were running on physical drive, 
> issued controller reset from management utility.
> Observed below call trace. It is from scsi_device_quiesce().
> 
> Nov 27 19:24:21 ubuntu kernel: [ 1330.799311] INFO: task arcconf:2386 blocked for more than 120 seconds.
> Nov 27 19:24:21 ubuntu kernel: [ 1330.799841]       Not tainted 5.4.0-rc1+ #2
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800235] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800678] arcconf         D    0  2386   2173 0x00004000
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800682] Call Trace:
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800699]  __schedule+0x291/0x6f0
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800703]  schedule+0x33/0xa0
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800710]  blk_mq_freeze_queue_wait+0x4b/0xb0
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800717]  ? wait_woken+0x80/0x80
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800721]  blk_mq_freeze_queue+0x1a/0x20
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800727]  scsi_device_quiesce+0x5d/0xb0
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800730]  scsi_host_quiesce+0x41/0x60
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800742]  aac_send_shutdown+0x7c/0x180 [aacraid]
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800749]  aac_reset_adapter+0x29f/0x760 [aacraid]
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800757]  ? security_capable+0x3f/0x60
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800762]  aac_store_reset_adapter+0x41/0x60 [aacraid]
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800770]  dev_attr_store+0x17/0x30
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800777]  sysfs_kf_write+0x3c/0x50
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800779]  kernfs_fop_write+0x125/0x1a0
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800785]  __vfs_write+0x1b/0x40
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800789]  vfs_write+0xb1/0x1a0
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800792]  ksys_write+0xa7/0xe0
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800795]  __x64_sys_write+0x1a/0x20
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800802]  do_syscall_64+0x57/0x190
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800806]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800810] RIP: 0033:0x7f67cfb7c2b7
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800819] Code: Bad RIP value.
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800821] RSP: 002b:00007ffeb23ca8c0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800823] RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00007f67cfb7c2b7
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800825] RDX: 0000000000000002 RSI: 00007ffeb23ca8f0 RDI: 0000000000000006
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800826] RBP: 00007ffeb23ca8f0 R08: 0000000000000000 R09: 0000000000000000
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800828] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000002
> Nov 27 19:24:21 ubuntu kernel: [ 1330.800829] R13: 00007ffeb23cad20 R14: 00007ffeb23cadf0 R15: 00007ffeb23cac60
> 
Thanks for testing.
I'll have a look at the call trace and will come back to you with an
updated version.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      Teamlead Storage & Networking
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete
  2019-11-28 12:09     ` Hannes Reinecke
@ 2019-12-04 15:02       ` Hannes Reinecke
  0 siblings, 0 replies; 30+ messages in thread
From: Hannes Reinecke @ 2019-12-04 15:02 UTC (permalink / raw)
  To: Balsundar.P, martin.petersen
  Cc: hch, james.bottomley, linux-scsi, balsundar.p, aacraid

On 11/28/19 1:09 PM, Hannes Reinecke wrote:
> On 11/28/19 12:45 PM, Balsundar.P@microchip.com wrote:
>> NAK
>>
>> After applying this patch, while IOs were running on physical drive, 
>> issued controller reset from management utility.
>> Observed below call trace. It is from scsi_device_quiesce().
>>
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.799311] INFO: task arcconf:2386 blocked for more than 120 seconds.
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.799841]       Not tainted 5.4.0-rc1+ #2
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800235] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800678] arcconf         D    0  2386   2173 0x00004000
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800682] Call Trace:
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800699]  __schedule+0x291/0x6f0
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800703]  schedule+0x33/0xa0
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800710]  blk_mq_freeze_queue_wait+0x4b/0xb0
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800717]  ? wait_woken+0x80/0x80
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800721]  blk_mq_freeze_queue+0x1a/0x20
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800727]  scsi_device_quiesce+0x5d/0xb0
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800730]  scsi_host_quiesce+0x41/0x60
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800742]  aac_send_shutdown+0x7c/0x180 [aacraid]
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800749]  aac_reset_adapter+0x29f/0x760 [aacraid]
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800757]  ? security_capable+0x3f/0x60
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800762]  aac_store_reset_adapter+0x41/0x60 [aacraid]
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800770]  dev_attr_store+0x17/0x30
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800777]  sysfs_kf_write+0x3c/0x50
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800779]  kernfs_fop_write+0x125/0x1a0
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800785]  __vfs_write+0x1b/0x40
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800789]  vfs_write+0xb1/0x1a0
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800792]  ksys_write+0xa7/0xe0
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800795]  __x64_sys_write+0x1a/0x20
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800802]  do_syscall_64+0x57/0x190
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800806]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800810] RIP: 0033:0x7f67cfb7c2b7
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800819] Code: Bad RIP value.
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800821] RSP: 002b:00007ffeb23ca8c0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800823] RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00007f67cfb7c2b7
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800825] RDX: 0000000000000002 RSI: 00007ffeb23ca8f0 RDI: 0000000000000006
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800826] RBP: 00007ffeb23ca8f0 R08: 0000000000000000 R09: 0000000000000000
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800828] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000002
>> Nov 27 19:24:21 ubuntu kernel: [ 1330.800829] R13: 00007ffeb23cad20 R14: 00007ffeb23cadf0 R15: 00007ffeb23cac60
>>
> Thanks for testing.
> I'll have a look at the call trace and will come back to you with an
> updated version.
> 
After testing I've discovered that we can't use freeze_queue here.
Point is, when resetting the HBA there will be commands outstanding
(which will keep the q_usage_counter to non-zero), but we should _not_
terminate those commands as I/O processing will be resumed after reset.
Hence the blk_mq_freeze_queue_wait() will never complete.

So for the next iteration I've reverted back to use a busy iterator, as
we just need to complete the commands currently held by the firmware;
all other commands can (and should) be left alone.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      Teamlead Storage & Networking
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2019-12-04 15:02 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 10:31 [PATCHv5 00/11] scsi: remove legacy cmd_list implementation Hannes Reinecke
2019-11-20 10:31 ` [PATCH 01/11] dpt_i2o: rename adpt_i2o_to_scsi() to adpt_i2o_scsi_complete() Hannes Reinecke
2019-11-26 16:54   ` Christoph Hellwig
2019-11-20 10:31 ` [PATCH 02/11] scsi: add scsi_host_flush_commands() helper Hannes Reinecke
2019-11-20 16:19   ` Bart Van Assche
2019-11-21 15:46     ` Hannes Reinecke
2019-11-26 16:55   ` Christoph Hellwig
2019-11-26 18:25     ` Hannes Reinecke
2019-11-20 10:31 ` [PATCH 03/11] dpt_i2o: use scsi_host_flush_commands() to abort outstanding commands Hannes Reinecke
2019-11-26 16:55   ` Christoph Hellwig
2019-11-20 10:31 ` [PATCH 04/11] aacraid: Do not wait for outstanding write commands on synchronize_cache Hannes Reinecke
2019-11-26 17:02   ` Christoph Hellwig
2019-11-28 11:40   ` Balsundar.P
2019-11-20 10:31 ` [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands Hannes Reinecke
2019-11-26 17:02   ` Christoph Hellwig
2019-11-28 11:41   ` Balsundar.P
2019-11-20 10:31 ` [PATCH 06/11] aacraid: replace aac_flush_ios() with midlayer helper Hannes Reinecke
2019-11-20 16:14   ` Bart Van Assche
2019-11-28 11:41   ` Balsundar.P
2019-11-20 10:31 ` [PATCH 07/11] scsi: add scsi_host_quiesce()/scsi_host_resume() helper Hannes Reinecke
2019-11-20 10:31 ` [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete Hannes Reinecke
2019-11-20 16:23   ` Bart Van Assche
2019-11-26  8:29   ` Balsundar.P
2019-11-28 11:45   ` Balsundar.P
2019-11-28 12:09     ` Hannes Reinecke
2019-12-04 15:02       ` Hannes Reinecke
2019-11-20 10:31 ` [PATCH 09/11] scsi: add scsi_host_busy_iter() Hannes Reinecke
2019-11-20 10:31 ` [PATCH 10/11] aacraid: use scsi_host_busy_iter() in get_num_of_incomplete_fibs() Hannes Reinecke
2019-11-28 11:42   ` Balsundar.P
2019-11-20 10:31 ` [PATCH 11/11] scsi: Remove cmd_list functionality Hannes Reinecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).