All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org
Cc: David.Carroll@microsemi.com, Gana.Sridaran@microsemi.com,
	Scott.Benesh@microsemi.com, Prasad.Munirathnam@microsemi.com
Subject: [PATCH V2 07/19] aacraid: Log count info of scsi cmds before reset
Date: Wed, 10 May 2017 09:39:41 -0700	[thread overview]
Message-ID: <1494434393-17261-8-git-send-email-RaghavaAditya.Renukunta@microsemi.com> (raw)
In-Reply-To: <1494434393-17261-1-git-send-email-RaghavaAditya.Renukunta@microsemi.com>

Log the location of the scsi cmds before triggering a reset. This
information is useful for debugging.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>

---
Changes in V2:
None

 drivers/scsi/aacraid/linit.c | 90 ++++++++++++++++++++++++++------------------
 1 file changed, 53 insertions(+), 37 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index f6a11af..0a8d303 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -624,6 +624,56 @@ static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg)
 	return aac_do_ioctl(dev, cmd, arg);
 }
 
+static int get_num_of_incomplete_fibs(struct aac_dev *aac)
+{
+
+	unsigned long flags;
+	struct scsi_device *sdev = NULL;
+	struct Scsi_Host *shost = aac->scsi_host_ptr;
+	struct scsi_cmnd *scmnd = NULL;
+	struct device *ctrl_dev;
+
+	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);
+	}
+
+	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);
+
+	return mlcnt + llcnt + ehcnt + fwcnt;
+}
+
 static int aac_eh_abort(struct scsi_cmnd* cmd)
 {
 	struct scsi_device * dev = cmd->device;
@@ -853,8 +903,6 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
 			pr_err("%s: Host adapter reset request timed out\n",
 			AAC_DRIVERNAME);
 	} else {
-		struct scsi_cmnd *command;
-		unsigned long flags;
 
 		/* Mark the assoc. FIB to not complete, eh handler does this */
 		for (count = 0;
@@ -873,41 +921,9 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
 		pr_err("%s: Host adapter reset request. SCSI hang ?\n",
 					AAC_DRIVERNAME);
 
-		count = aac_check_health(aac);
-		if (count)
-			return count;
-		/*
-		 * Wait for all commands to complete to this specific
-		 * target (block maximum 60 seconds).
-		 */
-		for (count = 60; count; --count) {
-			int active = aac->in_reset;
-
-			if (active == 0)
-			__shost_for_each_device(dev, host) {
-				spin_lock_irqsave(&dev->list_lock, flags);
-				list_for_each_entry(command, &dev->cmd_list,
-					list) {
-					if ((command != cmd) &&
-					(command->SCp.phase ==
-					AAC_OWNER_FIRMWARE)) {
-						active++;
-						break;
-					}
-				}
-				spin_unlock_irqrestore(&dev->list_lock, flags);
-				if (active)
-					break;
-
-			}
-			/*
-			 * We can exit If all the commands are complete
-			 */
-			if (active == 0)
-				return SUCCESS;
-			ssleep(1);
-		}
-		pr_err("%s: SCSI bus appears hung\n", AAC_DRIVERNAME);
+		count = get_num_of_incomplete_fibs(aac);
+		if (count == 0)
+			return SUCCESS;
 
 		/*
 		 * This adapter needs a blind reset, only do so for
-- 
2.7.4

  parent reply	other threads:[~2017-05-10  6:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 16:39 [PATCH V2 00/19] aacraid: Patchset with reset rework and misc fixes Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 01/19] aacraid: Remove __GFP_DMA for raw srb memory Raghava Aditya Renukunta
2017-05-10 15:36   ` Dave Carroll
2017-05-10 16:39 ` [PATCH V2 02/19] aacraid: Fix DMAR issues with iommu=pt Raghava Aditya Renukunta
2017-05-10 15:37   ` Dave Carroll
2017-05-10 16:39 ` [PATCH V2 03/19] aacraid: Added 32 and 64 queue depth for arc natives Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 04/19] aacraid: Set correct Queue Depth for HBA1000 RAW disks Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 05/19] aacraid: Remove reset support from check_health Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 06/19] aacraid: Change wait time for fib completion Raghava Aditya Renukunta
2017-05-10 16:39 ` Raghava Aditya Renukunta [this message]
2017-05-10 16:39 ` [PATCH V2 08/19] aacraid: Print ctrl status before eh reset Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 09/19] aacraid: Using single reset mask for IOP reset Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 10/19] aacraid: Rework " Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 11/19] aacraid: Add periodic checks to see IOP reset status Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 12/19] aacraid: Rework SOFT reset code Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 13/19] aacraid: Rework aac_src_restart Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 14/19] aacraid: Use correct function to get ctrl health Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 15/19] aacraid: Make sure ioctl returns on controller reset Raghava Aditya Renukunta
2017-05-10 15:40   ` Dave Carroll
2017-05-10 16:39 ` [PATCH V2 16/19] aacraid: Enable ctrl reset for both hba and arc Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 17/19] aacraid : Add reset debugging statements Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 18/19] aacraid: Remove reference to Series-9 Raghava Aditya Renukunta
2017-05-10 16:39 ` [PATCH V2 19/19] aacraid: Update driver version to 50834 Raghava Aditya Renukunta
2017-05-12  3:07 ` [PATCH V2 00/19] aacraid: Patchset with reset rework and misc fixes Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494434393-17261-8-git-send-email-RaghavaAditya.Renukunta@microsemi.com \
    --to=raghavaaditya.renukunta@microsemi.com \
    --cc=David.Carroll@microsemi.com \
    --cc=Gana.Sridaran@microsemi.com \
    --cc=Prasad.Munirathnam@microsemi.com \
    --cc=Scott.Benesh@microsemi.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.