All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, thenzl@redhat.com,
	jejb@linux.vnet.ibm.com, kashyap.desai@broadcom.com,
	sumit.saxena@broadcom.com, hare@suse.com,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Subject: [PATCH 14/39] megaraid_sas: enhance debug logs in OCR context
Date: Mon,  6 Feb 2017 01:59:47 -0800	[thread overview]
Message-ID: <1486375212-17329-15-git-send-email-shivasharan.srikanteshwara@broadcom.com> (raw)
In-Reply-To: <1486375212-17329-1-git-send-email-shivasharan.srikanteshwara@broadcom.com>

Add additional logging from driver in OCR context.
Add debug logs for partial completion of IOs is iodone context.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas.h        |  3 +++
 drivers/scsi/megaraid/megaraid_sas_base.c   | 38 ++++++++++++++++++++++++++---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 35 +++++++++++++++++++++++++-
 3 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index 6e7cb0b..ac2aed3 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1405,6 +1405,9 @@ struct megasas_ctrl_info {
 
 #define VD_EXT_DEBUG 0
 
+/* Driver's internal Logging levels*/
+#define OCR_LOGS    (1 << 0)
+
 #define SCAN_PD_CHANNEL	0x1
 #define SCAN_VD_CHANNEL	0x2
 
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 3e74f0f..d386f69 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -2739,6 +2739,24 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
 }
 
 /**
+ * megasas_dump_frame -	This function will dump MPT/MFI frame
+ */
+static inline void
+megasas_dump_frame(void *mpi_request, int sz)
+{
+	int i;
+	__le32 *mfp = (__le32 *)mpi_request;
+
+	printk(KERN_INFO "IO request frame:\n\t");
+	for (i = 0; i < sz; i++) {
+		if (i && ((i % 8) == 0))
+			printk("\n\t");
+		printk("%08x ", le32_to_cpu(mfp[i]));
+	}
+	printk("\n");
+}
+
+/**
  * megasas_reset_bus_host -	Bus & host reset handler entry point
  */
 static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
@@ -2748,12 +2766,26 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
 
 	instance = (struct megasas_instance *)scmd->device->host->hostdata;
 
+	scmd_printk(KERN_INFO, scmd,
+		"Controller reset is requested due to IO timeout\n"
+		"SCSI command pointer: (%p)\t SCSI host state: %d\t"
+		" SCSI host busy: %d\t FW outstanding: %d\n",
+		scmd, scmd->device->host->shost_state,
+		atomic_read((atomic_t *)&scmd->device->host->host_busy),
+		atomic_read(&instance->fw_outstanding));
+
 	/*
 	 * First wait for all commands to complete
 	 */
-	if (instance->ctrl_context)
-		ret = megasas_reset_fusion(scmd->device->host, 1);
-	else
+	if (instance->ctrl_context) {
+		struct megasas_cmd_fusion *cmd;
+		cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr;
+		if (cmd)
+			megasas_dump_frame(cmd->io_request,
+				sizeof(struct MPI2_RAID_SCSI_IO_REQUEST));
+		ret = megasas_reset_fusion(scmd->device->host,
+				SCSIIO_TIMEOUT_OCR);
+	} else
 		ret = megasas_generic_reset(scmd);
 
 	return ret;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 75c4ad1..8dd4944 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1442,8 +1442,10 @@ map_cmd_status(struct fusion_context *fusion,
 	struct scsi_cmnd *scmd, u8 status, u8 ext_status,
 			u32 data_length, u8 *sense)
 {
+	u8 cmd_type;
 	int resid;
 
+	cmd_type = megasas_cmd_type(scmd);
 	switch (status) {
 
 	case MFI_STAT_OK:
@@ -1474,6 +1476,13 @@ map_cmd_status(struct fusion_context *fusion,
 		 */
 		resid = (scsi_bufflen(scmd) - data_length);
 		scsi_set_resid(scmd, resid);
+
+		if (resid &&
+			((cmd_type == READ_WRITE_LDIO) ||
+			(cmd_type == READ_WRITE_SYSPDIO)))
+			scmd_printk(KERN_INFO, scmd, "BRCM Debug mfi stat 0x%x, data len"
+				" requested/completed 0x%x/0x%x\n",
+				status, scsi_bufflen(scmd), data_length);
 		break;
 
 	case MFI_STAT_LD_OFFLINE:
@@ -3473,6 +3482,14 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 			       " will reset adapter scsi%d.\n",
 				instance->host->host_no);
 			megasas_complete_cmd_dpc_fusion((unsigned long)instance);
+			if (instance->requestorId && reason) {
+				dev_warn(&instance->pdev->dev, "SR-IOV Found FW in FAULT"
+				" state while polling during"
+				" I/O timeout handling for %d\n",
+				instance->host->host_no);
+				*convert = 1;
+			}
+
 			retval = 1;
 			goto out;
 		}
@@ -3492,7 +3509,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 		}
 
 		/* If SR-IOV VF mode & I/O timeout, check for HB timeout */
-		if (instance->requestorId && reason) {
+		if (instance->requestorId && (reason == SCSIIO_TIMEOUT_OCR)) {
 			if (instance->hb_host_mem->HB.fwCounter !=
 			    instance->hb_host_mem->HB.driverCounter) {
 				instance->hb_host_mem->HB.driverCounter =
@@ -3908,6 +3925,9 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd)
 	instance = (struct megasas_instance *)scmd->device->host->hostdata;
 	fusion = instance->ctrl_context;
 
+	scmd_printk(KERN_INFO, scmd, "task abort called for scmd(%p)\n", scmd);
+	scsi_print_command(scmd);
+
 	if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) {
 		dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL,"
 		"SCSI host:%d\n", instance->host->host_no);
@@ -3988,6 +4008,9 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
 	instance = (struct megasas_instance *)scmd->device->host->hostdata;
 	fusion = instance->ctrl_context;
 
+	sdev_printk(KERN_INFO, scmd->device,
+		    "target reset called for scmd(%p)\n", scmd);
+
 	if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) {
 		dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL,"
 		"SCSI host:%d\n", instance->host->host_no);
@@ -4147,6 +4170,9 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 		if (convert)
 			reason = 0;
 
+		if (megasas_dbg_lvl & OCR_LOGS)
+			dev_info(&instance->pdev->dev, "\nPending SCSI commands:\n");
+
 		/* Now return commands back to the OS */
 		for (i = 0 ; i < instance->max_scsi_cmds; i++) {
 			cmd_fusion = fusion->cmd_list[i];
@@ -4157,6 +4183,13 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 			}
 			scmd_local = cmd_fusion->scmd;
 			if (cmd_fusion->scmd) {
+				if (megasas_dbg_lvl & OCR_LOGS) {
+					sdev_printk(KERN_INFO,
+						cmd_fusion->scmd->device, "SMID: 0x%x\n",
+						cmd_fusion->index);
+					scsi_print_command(cmd_fusion->scmd);
+				}
+
 				scmd_local->result =
 					megasas_check_mpio_paths(instance,
 							scmd_local);
-- 
2.8.3

  parent reply	other threads:[~2017-02-06 10:02 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06  9:59 [PATCH 00/39] megaraid_sas: Updates for scsi-next Shivasharan S
2017-02-06  9:59 ` [PATCH 01/39] Revert "scsi: megaraid_sas: Enable or Disable Fast path based on the PCI Threshold Bandwidth" Shivasharan S
2017-02-06 10:07   ` Shivasharan Srikanteshwara
2017-02-06 10:24   ` Hannes Reinecke
2017-02-06 13:08   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 02/39] megaraid_sas: cpu select rework Shivasharan S
2017-02-06 10:25   ` Hannes Reinecke
2017-02-06 13:08   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 03/39] megaraid_sas: raid 1 fast path code optimize Shivasharan S
2017-02-06 10:26   ` Hannes Reinecke
2017-02-06 13:12   ` Tomas Henzl
2017-02-06 13:27     ` Kashyap Desai
2017-02-06 13:38       ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 04/39] megaraid_sas: 32 bit descriptor fire cmd optimization Shivasharan S
2017-02-06 10:23   ` Hannes Reinecke
2017-02-06 10:38     ` Shivasharan Srikanteshwara
2017-02-06 10:38     ` Shivasharan Srikanteshwara
2017-02-06 13:40   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 05/39] megaraid_sas: Refactor MEGASAS_IS_LOGICAL macro using sdev Shivasharan S
2017-02-06 10:29   ` Hannes Reinecke
2017-02-06 13:44   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 06/39] megaraid_sas: RAID map is accessed for SYS PDs when use_seqnum_jbod_fp is not set Shivasharan S
2017-02-06 10:40   ` Hannes Reinecke
2017-02-06 13:16     ` Shivasharan Srikanteshwara
2017-02-06  9:59 ` [PATCH 07/39] megaraid_sas: Use DID_REQUEUE Shivasharan S
2017-02-06 10:41   ` Hannes Reinecke
2017-02-06 13:46   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 08/39] megaraid_sas: megasas_get_request_descriptor always return valid desc Shivasharan S
2017-02-06 10:43   ` Hannes Reinecke
2017-02-06 13:44     ` Shivasharan Srikanteshwara
2017-02-06 23:54       ` Martin K. Petersen
2017-02-07  0:02         ` Martin K. Petersen
2017-02-06 14:06   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 09/39] megaraid_sas: NVME Interface detection and prop settings Shivasharan S
2017-02-06 10:47   ` Hannes Reinecke
2017-02-06 13:55     ` Shivasharan Srikanteshwara
2017-02-06  9:59 ` [PATCH 10/39] megaraid_sas: NVME interface target prop added Shivasharan S
2017-02-06 10:15   ` Shivasharan Srikanteshwara
2017-02-06 10:48   ` Hannes Reinecke
2017-02-06 14:14   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 11/39] " Shivasharan S
2017-02-06 10:16   ` Shivasharan Srikanteshwara
2017-02-06 10:34   ` Shivasharan Srikanteshwara
2017-02-06 10:41   ` kbuild test robot
2017-02-06 10:51   ` Hannes Reinecke
2017-02-06 14:37   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 12/39] megaraid_sas: raid 1 write performance for large io Shivasharan S
2017-02-06 10:54   ` Hannes Reinecke
2017-02-06 14:39   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 13/39] megaraid_sas : set residual bytes count during IO compeltion Shivasharan S
2017-02-06 10:54   ` Hannes Reinecke
2017-02-06 14:39   ` Tomas Henzl
2017-02-06 23:52   ` Martin K. Petersen
2017-02-07 11:07     ` Kashyap Desai
2017-02-07 22:19       ` Martin K. Petersen
2017-02-06  9:59 ` Shivasharan S [this message]
2017-02-06 10:55   ` [PATCH 14/39] megaraid_sas: enhance debug logs in OCR context Hannes Reinecke
2017-02-06 14:44   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 15/39] megaraid_sas: add print in device removal path Shivasharan S
2017-02-06 10:55   ` Hannes Reinecke
2017-02-06 14:46   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 16/39] megaraid_sas: reduce size of fusion_context and use vmalloc if kmalloc fails Shivasharan S
2017-02-06 11:18   ` Hannes Reinecke
2017-02-06 15:40   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 17/39] megaraid_sas: In validate raid map, raid capability is not converted to cpu format for all lds Shivasharan S
2017-02-06 11:18   ` Hannes Reinecke
2017-02-06 15:42   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 18/39] megaraid_sas: MR_TargetIdToLdGet u8 to u16 and avoid invalid raid-map access Shivasharan S
2017-02-06 11:20   ` Hannes Reinecke
2017-02-07 11:54     ` Shivasharan Srikanteshwara
2017-02-06  9:59 ` [PATCH 19/39] megaraid_sas: Big endian RDPQ mode fix Shivasharan S
2017-02-06 11:21   ` Hannes Reinecke
2017-02-06 15:44   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 20/39] megaraid_sas: big endian support changes Shivasharan S
2017-02-06 11:22   ` Hannes Reinecke
2017-02-06 15:46   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 21/39] megaraid_sas: avoid unaligned access in ioctl path Shivasharan S
2017-02-06 11:22   ` Hannes Reinecke
2017-02-06 15:48   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 22/39] megaraid_sas: latest controller OCR capability from FW before sending shutdown DCMD Shivasharan S
2017-02-06 11:23   ` Hannes Reinecke
2017-02-06 15:50   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 23/39] megaraid_sas: set pd_after_lb from MR_BuildRaidContext and initialize pDevHandle to MR_DEVHANDLE_INVALID Shivasharan S
2017-02-06 11:23   ` Hannes Reinecke
2017-02-06 15:51   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 24/39] megaraid_sas: Change max_cmd from u32 to u16 in all functions Shivasharan S
2017-02-06 11:24   ` Hannes Reinecke
2017-02-06 15:51   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 25/39] megaraid_sas: update can_queue only if the new value is less Shivasharan S
2017-02-06 11:24   ` Hannes Reinecke
2017-02-06 15:52   ` Tomas Henzl
2017-02-06  9:59 ` [PATCH 26/39] megaraid_sas: max_fw_cmds are decremented twice, remove duplicate Shivasharan S
2017-02-06 11:24   ` Hannes Reinecke
2017-02-06 15:53   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 27/39] megaraid_sas: megasas_return_cmd does not memset IO frame to zero Shivasharan S
2017-02-06 11:25   ` Hannes Reinecke
2017-02-06 15:57   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 28/39] megaraid_sas: Remove unused pd_index from megasas_build_ld_nonrw_fusion Shivasharan S
2017-02-06 11:25   ` Hannes Reinecke
2017-02-06 15:58   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 29/39] megaraid_sas: Do not set fp_possible if TM capable for non-RW syspdIO, change fp_possible to bool Shivasharan S
2017-02-06 11:26   ` Hannes Reinecke
2017-02-06 15:58   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 30/39] megaraid_sas: During OCR, if get_ctrl_info fails do not continue with OCR Shivasharan S
2017-02-06 11:26   ` Hannes Reinecke
2017-02-06 15:59   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 31/39] megaraid_sas: Change build_mpt_mfi_pass_thru to return void Shivasharan S
2017-02-06 11:27   ` Hannes Reinecke
2017-02-06 16:00   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 32/39] megaraid_sas: Bail out the driver load if ld_list_query fails Shivasharan S
2017-02-06 11:28   ` Hannes Reinecke
2017-02-06 16:01   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 33/39] megaraid_sas: call flush_scheduled_work during controller shutdown/detach Shivasharan S
2017-02-06 11:28   ` Hannes Reinecke
2017-02-06 16:05   ` Tomas Henzl
2017-02-06 17:18     ` Kashyap Desai
2017-02-07  8:50     ` Kashyap Desai
2017-02-06 10:00 ` [PATCH 34/39] megaraid_sas: Use synchronize_irq to wait for IRQs to complete Shivasharan S
2017-02-06 11:29   ` Hannes Reinecke
2017-02-06 16:07   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 35/39] megaraid_sas: Increase internal command pool Shivasharan S
2017-02-06 11:29   ` Hannes Reinecke
2017-02-06 16:08   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 36/39] megaraid_sas: Cleanup VD_EXT_DEBUG and SPAN_DEBUG related debug prints Shivasharan S
2017-02-06 11:30   ` Hannes Reinecke
2017-02-06 16:09   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 37/39] megaraid_sas: Indentation and smatch warning fixes Shivasharan S
2017-02-06 11:30   ` Hannes Reinecke
2017-02-06 16:13   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 38/39] megaraid_sas: Change RAID_1_10_RMW_CMDS to RAID_1_PEER_CMDS and set value to 2 Shivasharan S
2017-02-06 11:31   ` Hannes Reinecke
2017-02-06 16:14   ` Tomas Henzl
2017-02-06 10:00 ` [PATCH 39/39] megaraid_sas: driver version upgrade Shivasharan S
2017-02-06 11:31   ` Hannes Reinecke
2017-02-06 16:14   ` Tomas Henzl

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=1486375212-17329-15-git-send-email-shivasharan.srikanteshwara@broadcom.com \
    --to=shivasharan.srikanteshwara@broadcom.com \
    --cc=hare@suse.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sumit.saxena@broadcom.com \
    --cc=thenzl@redhat.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.