All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] megaraid_sas: Updates for scsi-next
@ 2017-06-30  8:29 Shivasharan S
  2017-06-30  8:29 ` [PATCH 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command Shivasharan S
                   ` (14 more replies)
  0 siblings, 15 replies; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:29 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Shivasharan S (15):
  megaraid_sas: mismatch of allocated MFI frame size and length exposed
    in MFI MPT pass through command
  megaraid_sas: set minimum value of resetwaittime to be 1 secs
  megaraid_sas: Use synchronize_irq in target reset case
  megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second
    while there are pending commands
  megaraid_sas: Do not re-fire shutdown DCMD after OCR
  megaraid_sas: Fix endianness issues in DCMD handling
  megaraid_sas: Check valid aen class range to avoid kernel panic
  megaraid_sas: Use SMID for Task abort case only
  megaraid_sas: use vmalloc for crash dump buffers and driver's local
    RAID map
  megaraid_sas: Return pended IOCTLs with cmd_status
    MFI_STAT_WRONG_STATE in case adapter is dead
  megaraid_sas: Set device queue_depth same as HBA can_queue value in
    scsi-mq mode
  megaraid_sas: replace internal FALSE/TRUE definitions with false/true
  megaraid_sas: modified few prints in OCR and IOC INIT path
  megaraid_sas: call megasas_dump_frame with correct IO frame size
  megaraid_sas: driver version upgrade

 drivers/scsi/megaraid/megaraid_sas.h        |   5 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   |  44 ++++++--
 drivers/scsi/megaraid/megaraid_sas_fp.c     |  40 +++----
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 161 +++++++++++++++++-----------
 4 files changed, 149 insertions(+), 101 deletions(-)

-- 
2.8.3

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

* [PATCH 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
@ 2017-06-30  8:29 ` Shivasharan S
  2017-06-30 13:23   ` Hannes Reinecke
  2017-06-30  8:29 ` [PATCH 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs Shivasharan S
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:29 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S, stable

 Fix - Driver allocated 256 byte MFI frames bytes but while sending MFI
 frame (embedded inside chain frame of MPT frame) to firmware, driver
 sets the length as 4k. This results in DMA read error messages during
 boot.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index f990ab4d..f717fbc 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3283,7 +3283,7 @@ build_mpt_mfi_pass_thru(struct megasas_instance *instance,
 	mpi25_ieee_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
 		MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR;
 
-	mpi25_ieee_chain->Length = cpu_to_le32(instance->max_chain_frame_sz);
+	mpi25_ieee_chain->Length = cpu_to_le32(instance->mfi_frame_size);
 }
 
 /**
-- 
2.8.3

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

* [PATCH 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
  2017-06-30  8:29 ` [PATCH 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command Shivasharan S
@ 2017-06-30  8:29 ` Shivasharan S
  2017-06-30 13:23   ` Hannes Reinecke
  2017-06-30  8:29 ` [PATCH 03/15] megaraid_sas: Use synchronize_irq in target reset case Shivasharan S
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:29 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S, stable

Setting resetwaittime to 0 will result in driver not calling the OCR
during a FW fault state.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 316c3df..395c3aa 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5478,7 +5478,8 @@ static int megasas_init_fw(struct megasas_instance *instance)
 		instance->throttlequeuedepth =
 				MEGASAS_THROTTLE_QUEUE_DEPTH;
 
-	if (resetwaittime > MEGASAS_RESET_WAIT_TIME)
+	if ((resetwaittime < 1) ||
+	    (resetwaittime > MEGASAS_RESET_WAIT_TIME))
 		resetwaittime = MEGASAS_RESET_WAIT_TIME;
 
 	if ((scmd_timeout < 10) || (scmd_timeout > MEGASAS_DEFAULT_CMD_TIMEOUT))
-- 
2.8.3

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

* [PATCH 03/15] megaraid_sas: Use synchronize_irq in target reset case
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
  2017-06-30  8:29 ` [PATCH 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command Shivasharan S
  2017-06-30  8:29 ` [PATCH 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs Shivasharan S
@ 2017-06-30  8:29 ` Shivasharan S
  2017-06-30 13:24   ` Hannes Reinecke
  2017-06-30  8:29 ` [PATCH 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands Shivasharan S
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:29 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Similar to task abort case, use synchronize_irq API in target reset case.
Also, remove redundant call to megasas_complete_cmd_dpc_fusion
after calling megasas_sync_irqs in task abort case.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index f717fbc..5018a3f 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3826,8 +3826,6 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
 		else {
 			instance->instancet->disable_intr(instance);
 			megasas_sync_irqs((unsigned long)instance);
-			megasas_complete_cmd_dpc_fusion
-					((unsigned long)instance);
 			instance->instancet->enable_intr(instance);
 			if (scsi_lookup->scmd == NULL)
 				break;
@@ -3839,9 +3837,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
 		if ((channel == 0xFFFFFFFF) && (id == 0xFFFFFFFF))
 			break;
 		instance->instancet->disable_intr(instance);
-		msleep(1000);
-		megasas_complete_cmd_dpc_fusion
-				((unsigned long)instance);
+		megasas_sync_irqs((unsigned long)instance);
 		rc = megasas_track_scsiio(instance, id, channel);
 		instance->instancet->enable_intr(instance);
 
-- 
2.8.3

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

* [PATCH 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (2 preceding siblings ...)
  2017-06-30  8:29 ` [PATCH 03/15] megaraid_sas: Use synchronize_irq in target reset case Shivasharan S
@ 2017-06-30  8:29 ` Shivasharan S
  2017-06-30 13:25   ` Hannes Reinecke
  2017-06-30  8:29 ` [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR Shivasharan S
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:29 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 5018a3f..0f13c58 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3552,6 +3552,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 			}
 		}
 
+		megasas_complete_cmd_dpc_fusion((unsigned long)instance);
 		outstanding = atomic_read(&instance->fw_outstanding);
 		if (!outstanding)
 			goto out;
@@ -3560,8 +3561,6 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 			dev_notice(&instance->pdev->dev, "[%2d]waiting for %d "
 			       "commands to complete for scsi%d\n", i,
 			       outstanding, instance->host->host_no);
-			megasas_complete_cmd_dpc_fusion(
-				(unsigned long)instance);
 		}
 		msleep(1000);
 	}
-- 
2.8.3

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

* [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (3 preceding siblings ...)
  2017-06-30  8:29 ` [PATCH 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands Shivasharan S
@ 2017-06-30  8:29 ` Shivasharan S
  2017-06-30 13:30   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 06/15] megaraid_sas: Fix endianness issues in DCMD handling Shivasharan S
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:29 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 0f13c58..a308e14 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3618,6 +3618,15 @@ void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
 
 		if (!smid)
 			continue;
+
+		/* Do not refire shutdown command */
+		if (le32_to_cpu(cmd_mfi->frame->dcmd.opcode) ==
+			MR_DCMD_CTRL_SHUTDOWN) {
+			cmd_mfi->frame->dcmd.cmd_status = MFI_STAT_OK;
+			megasas_complete_cmd(instance, cmd_mfi, DID_OK);
+			continue;
+		}
+
 		req_desc = megasas_get_request_descriptor
 					(instance, smid - 1);
 		refire_cmd = req_desc && ((cmd_mfi->frame->dcmd.opcode !=
-- 
2.8.3

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

* [PATCH 06/15] megaraid_sas: Fix endianness issues in DCMD handling
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (4 preceding siblings ...)
  2017-06-30  8:29 ` [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:34   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic Shivasharan S
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 395c3aa..3c50a7b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -6867,6 +6867,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 	void *sense = NULL;
 	dma_addr_t sense_handle;
 	unsigned long *sense_ptr;
+	u32 opcode;
 
 	memset(kbuff_arr, 0, sizeof(kbuff_arr));
 
@@ -6894,15 +6895,16 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 	cmd->frame->hdr.flags &= cpu_to_le16(~(MFI_FRAME_IEEE |
 					       MFI_FRAME_SGL64 |
 					       MFI_FRAME_SENSE64));
+	opcode = le32_to_cpu(cmd->frame->dcmd.opcode);
 
-	if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_SHUTDOWN) {
+	if (opcode == MR_DCMD_CTRL_SHUTDOWN) {
 		if (megasas_get_ctrl_info(instance) != DCMD_SUCCESS) {
 			megasas_return_cmd(instance, cmd);
 			return -1;
 		}
 	}
 
-	if (cmd->frame->dcmd.opcode == MR_DRIVER_SET_APP_CRASHDUMP_MODE) {
+	if (opcode == MR_DRIVER_SET_APP_CRASHDUMP_MODE) {
 		error = megasas_set_crash_dump_params_ioctl(cmd);
 		megasas_return_cmd(instance, cmd);
 		return error;
@@ -6976,8 +6978,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 		cmd->sync_cmd = 0;
 		dev_err(&instance->pdev->dev,
 			"return -EBUSY from %s %d opcode 0x%x cmd->cmd_status_drv 0x%x\n",
-			__func__, __LINE__, cmd->frame->dcmd.opcode,
-			cmd->cmd_status_drv);
+			__func__, __LINE__, opcode,	cmd->cmd_status_drv);
 		return -EBUSY;
 	}
 
-- 
2.8.3

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

* [PATCH 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (5 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 06/15] megaraid_sas: Fix endianness issues in DCMD handling Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:35   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S, stable

An application sending out of range AEN class code for 
registration, will result in kernel panic in MR driver.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 3c50a7b..e490272 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5650,6 +5650,14 @@ megasas_register_aen(struct megasas_instance *instance, u32 seq_num,
 		prev_aen.word =
 			le32_to_cpu(instance->aen_cmd->frame->dcmd.mbox.w[1]);
 
+		if ((curr_aen.members.class < MFI_EVT_CLASS_DEBUG) ||
+		    (curr_aen.members.class > MFI_EVT_CLASS_DEAD)) {
+			dev_info(&instance->pdev->dev,
+				 "%s %d out of range class %d send by application\n",
+				 __func__, __LINE__, curr_aen.members.class);
+			return 0;
+		}
+
 		/*
 		 * A class whose enum value is smaller is inclusive of all
 		 * higher values. If a PROGRESS (= -1) was previously
-- 
2.8.3

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

* [PATCH 08/15] megaraid_sas: Use SMID for Task abort case only
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (6 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:35   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Fix - In TM code, smid_task is valid only in case of task aborts.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index a308e14..c239762 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3754,7 +3754,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
 	struct megasas_cmd_fusion *cmd_fusion;
 	struct megasas_cmd *cmd_mfi;
 	union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;
-	struct fusion_context *fusion;
+	struct fusion_context *fusion = NULL;
 	struct megasas_cmd_fusion *scsi_lookup;
 	int rc;
 	struct MPI2_SCSI_TASK_MANAGE_REPLY *mpi_reply;
@@ -3781,8 +3781,6 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
 	cmd_fusion->request_desc = req_desc;
 	req_desc->Words = 0;
 
-	scsi_lookup = fusion->cmd_list[smid_task - 1];
-
 	mr_request = (struct MR_TASK_MANAGE_REQUEST *) cmd_fusion->io_request;
 	memset(mr_request, 0, sizeof(struct MR_TASK_MANAGE_REQUEST));
 	mpi_request = (struct MPI2_SCSI_TASK_MANAGE_REQUEST *) &mr_request->TmRequest;
@@ -3829,6 +3827,8 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
 	rc = SUCCESS;
 	switch (type) {
 	case MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK:
+		scsi_lookup = fusion->cmd_list[smid_task - 1];
+
 		if (scsi_lookup->scmd == NULL)
 			break;
 		else {
-- 
2.8.3

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

* [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (7 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:36   ` Hannes Reinecke
  2017-06-30 14:30   ` Tomas Henzl
  2017-06-30  8:30 ` [PATCH 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead Shivasharan S
                   ` (5 subsequent siblings)
  14 siblings, 2 replies; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

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

diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index 2b209bb..6d9f111 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -2115,7 +2115,6 @@ struct megasas_instance {
 	u32 *crash_dump_buf;
 	dma_addr_t crash_dump_h;
 	void *crash_buf[MAX_CRASH_DUMP_SIZE];
-	u32 crash_buf_pages;
 	unsigned int    fw_crash_buffer_size;
 	unsigned int    fw_crash_state;
 	unsigned int    fw_crash_buffer_offset;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index e490272..c63ef88 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -49,6 +49,7 @@
 #include <linux/blkdev.h>
 #include <linux/mutex.h>
 #include <linux/poll.h>
+#include <linux/vmalloc.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -6672,9 +6673,14 @@ static void megasas_detach_one(struct pci_dev *pdev)
 						  fusion->max_map_sz,
 						  fusion->ld_map[i],
 						  fusion->ld_map_phys[i]);
-			if (fusion->ld_drv_map[i])
-				free_pages((ulong)fusion->ld_drv_map[i],
-					fusion->drv_map_pages);
+			if (fusion->ld_drv_map[i]) {
+				if (is_vmalloc_addr(fusion->ld_drv_map[i]))
+					vfree(fusion->ld_drv_map[i]);
+				else
+					free_pages((ulong)fusion->ld_drv_map[i],
+						   fusion->drv_map_pages);
+			}
+
 			if (fusion->pd_seq_sync[i])
 				dma_free_coherent(&instance->pdev->dev,
 					pd_seq_map_sz,
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index c239762..2f5212d 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1257,6 +1257,72 @@ megasas_display_intel_branding(struct megasas_instance *instance)
 }
 
 /**
+ * megasas_allocate_raid_maps -	Allocate memory for RAID maps
+ * @instance:				Adapter soft state
+ *
+ * return:				if success: return 0
+ *					failed:  return -ENOMEM
+ */
+static inline int megasas_allocate_raid_maps(struct megasas_instance *instance)
+{
+	struct fusion_context *fusion;
+	int i = 0;
+
+	fusion = instance->ctrl_context;
+
+	fusion->drv_map_pages = get_order(fusion->drv_map_sz);
+
+	for (i = 0; i < 2; i++) {
+		fusion->ld_map[i] = NULL;
+
+		fusion->ld_drv_map[i] = (void *)
+			__get_free_pages(__GFP_ZERO | GFP_KERNEL,
+					 fusion->drv_map_pages);
+
+		if (!fusion->ld_drv_map[i]) {
+			fusion->ld_drv_map[i] = vzalloc(fusion->drv_map_sz);
+
+			if (!fusion->ld_drv_map[i]) {
+				dev_err(&instance->pdev->dev,
+					"Could not allocate memory for local map"
+					" size requested: %d\n",
+					fusion->drv_map_sz);
+
+				if (fusion->ld_drv_map[0]) {
+					if (is_vmalloc_addr(fusion->ld_drv_map[0]))
+						vfree(fusion->ld_drv_map[0]);
+					else
+						free_pages((ulong)fusion->ld_drv_map[0],
+							   fusion->drv_map_pages);
+				}
+				return -ENOMEM;
+			}
+		}
+	}
+
+	for (i = 0; i < 2; i++) {
+		fusion->ld_map[i] = dma_alloc_coherent(&instance->pdev->dev,
+						       fusion->max_map_sz,
+						       &fusion->ld_map_phys[i],
+						       GFP_KERNEL);
+		if (!fusion->ld_map[i]) {
+			dev_err(&instance->pdev->dev,
+				"Could not allocate memory for map info %s:%d\n",
+				__func__, __LINE__);
+
+			if (fusion->ld_map[0])
+				dma_free_coherent(&instance->pdev->dev,
+						  fusion->max_map_sz,
+						  fusion->ld_map[0],
+						  fusion->ld_map_phys[0]);
+			return -ENOMEM;
+		}
+	}
+
+	return 0;
+}
+
+/**
  * megasas_init_adapter_fusion -	Initializes the FW
  * @instance:		Adapter soft state
  *
@@ -1375,45 +1441,14 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
 	instance->r1_ldio_hint_default =  MR_R1_LDIO_PIGGYBACK_DEFAULT;
 	fusion->fast_path_io = 0;
 
-	fusion->drv_map_pages = get_order(fusion->drv_map_sz);
-	for (i = 0; i < 2; i++) {
-		fusion->ld_map[i] = NULL;
-		fusion->ld_drv_map[i] = (void *)__get_free_pages(GFP_KERNEL,
-			fusion->drv_map_pages);
-		if (!fusion->ld_drv_map[i]) {
-			dev_err(&instance->pdev->dev, "Could not allocate "
-				"memory for local map info for %d pages\n",
-				fusion->drv_map_pages);
-			if (i == 1)
-				free_pages((ulong)fusion->ld_drv_map[0],
-					fusion->drv_map_pages);
-			goto fail_ioc_init;
-		}
-		memset(fusion->ld_drv_map[i], 0,
-			((1 << PAGE_SHIFT) << fusion->drv_map_pages));
-	}
-
-	for (i = 0; i < 2; i++) {
-		fusion->ld_map[i] = dma_alloc_coherent(&instance->pdev->dev,
-						       fusion->max_map_sz,
-						       &fusion->ld_map_phys[i],
-						       GFP_KERNEL);
-		if (!fusion->ld_map[i]) {
-			dev_err(&instance->pdev->dev, "Could not allocate memory "
-			       "for map info\n");
-			goto fail_map_info;
-		}
-	}
+	if (megasas_allocate_raid_maps(instance))
+		goto fail_ioc_init;
 
 	if (!megasas_get_map_info(instance))
 		megasas_sync_map_info(instance);
 
 	return 0;
 
-fail_map_info:
-	if (i == 1)
-		dma_free_coherent(&instance->pdev->dev, fusion->max_map_sz,
-				  fusion->ld_map[0], fusion->ld_map_phys[0]);
 fail_ioc_init:
 	megasas_free_cmds_fusion(instance);
 fail_alloc_cmds:
@@ -3365,17 +3400,13 @@ megasas_alloc_host_crash_buffer(struct megasas_instance *instance)
 {
 	unsigned int i;
 
-	instance->crash_buf_pages = get_order(CRASH_DMA_BUF_SIZE);
 	for (i = 0; i < MAX_CRASH_DUMP_SIZE; i++) {
-		instance->crash_buf[i] = (void	*)__get_free_pages(GFP_KERNEL,
-				instance->crash_buf_pages);
+		instance->crash_buf[i] = vzalloc(CRASH_DMA_BUF_SIZE);
 		if (!instance->crash_buf[i]) {
 			dev_info(&instance->pdev->dev, "Firmware crash dump "
 				"memory allocation failed at index %d\n", i);
 			break;
 		}
-		memset(instance->crash_buf[i], 0,
-			((1 << PAGE_SHIFT) << instance->crash_buf_pages));
 	}
 	instance->drv_buf_alloc = i;
 }
@@ -3387,12 +3418,10 @@ megasas_alloc_host_crash_buffer(struct megasas_instance *instance)
 void
 megasas_free_host_crash_buffer(struct megasas_instance *instance)
 {
-	unsigned int i
-;
+	unsigned int i;
 	for (i = 0; i < instance->drv_buf_alloc; i++) {
 		if (instance->crash_buf[i])
-			free_pages((ulong)instance->crash_buf[i],
-					instance->crash_buf_pages);
+			vfree(instance->crash_buf[i]);
 	}
 	instance->drv_buf_index = 0;
 	instance->drv_buf_alloc = 0;
-- 
2.8.3

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

* [PATCH 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (8 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:37   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode Shivasharan S
                   ` (4 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S, stable

Fix - After a kill adapter, since the cmd_status is not set the
IOCTLs will be hung in driver resulting in application hang.
Set cmd_status MFI_STAT_WRONG_STATE when completing pended IOCTLs.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index c63ef88..0230929 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1996,9 +1996,12 @@ static void megasas_complete_outstanding_ioctls(struct megasas_instance *instanc
 			if (cmd_fusion->sync_cmd_idx != (u32)ULONG_MAX) {
 				cmd_mfi = instance->cmd_list[cmd_fusion->sync_cmd_idx];
 				if (cmd_mfi->sync_cmd &&
-					cmd_mfi->frame->hdr.cmd != MFI_CMD_ABORT)
+				    (cmd_mfi->frame->hdr.cmd != MFI_CMD_ABORT)) {
+					cmd_mfi->frame->hdr.cmd_status =
+							MFI_STAT_WRONG_STATE;
 					megasas_complete_cmd(instance,
 							     cmd_mfi, DID_OK);
+				}
 			}
 		}
 	} else {
-- 
2.8.3

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

* [PATCH 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (9 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:39   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true Shivasharan S
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Currently driver sets default queue_depth for VDs at 256 and JBODs based on interface type,
ie., for SAS JBOD QD will be 64, for SATA JBOD QD will be 32.
During performance runs with scsi-mq enabled, we are seeing better results by
setting QD same as HBA queue_depth.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 0230929..c200f1a 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1891,7 +1891,8 @@ static void megasas_set_static_target_properties(struct scsi_device *sdev,
 	if (instance->nvme_page_size && max_io_size_kb)
 		megasas_set_nvme_device_properties(sdev, (max_io_size_kb << 10));
 
-	scsi_change_queue_depth(sdev, device_qd);
+	if (!shost_use_blk_mq(sdev->host))
+		scsi_change_queue_depth(sdev, device_qd);
 
 }
 
@@ -5914,6 +5915,9 @@ static int megasas_io_attach(struct megasas_instance *instance)
 	host->max_lun = MEGASAS_MAX_LUN;
 	host->max_cmd_len = 16;
 
+	if (shost_use_blk_mq(host))
+		host->cmd_per_lun = host->can_queue;
+
 	/*
 	 * Notify the mid-layer about the new controller
 	 */
-- 
2.8.3

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

* [PATCH 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (10 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:40   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path Shivasharan S
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fp.c | 40 +++++++++++++--------------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c
index 62affa7..ecc699a 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -67,16 +67,6 @@ MODULE_PARM_DESC(lb_pending_cmds, "Change raid-1 load balancing outstanding "
 #define ABS_DIFF(a, b)   (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
 #define MR_LD_STATE_OPTIMAL 3
 
-#ifdef FALSE
-#undef FALSE
-#endif
-#define FALSE 0
-
-#ifdef TRUE
-#undef TRUE
-#endif
-#define TRUE 1
-
 #define SPAN_ROW_SIZE(map, ld, index_) (MR_LdSpanPtrGet(ld, index_, map)->spanRowSize)
 #define SPAN_ROW_DATA_SIZE(map_, ld, index_)   (MR_LdSpanPtrGet(ld, index_, map)->spanRowDataSize)
 #define SPAN_INVALID  0xff
@@ -709,7 +699,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
 	u32     pd, arRef, r1_alt_pd;
 	u8      physArm, span;
 	u64     row;
-	u8	retval = TRUE;
+	u8	retval = true;
 	u64	*pdBlock = &io_info->pdBlock;
 	__le16	*pDevHandle = &io_info->devHandle;
 	u8	*pPdInterface = &io_info->pd_interface;
@@ -727,7 +717,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
 	if (raid->level == 6) {
 		logArm = get_arm_from_strip(instance, ld, stripRow, map);
 		if (logArm == -1U)
-			return FALSE;
+			return false;
 		rowMod = mega_mod64(row, SPAN_ROW_SIZE(map, ld, span));
 		armQ = SPAN_ROW_SIZE(map, ld, span) - 1 - rowMod;
 		arm = armQ + 1 + logArm;
@@ -738,7 +728,7 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
 		/* Calculate the arm */
 		physArm = get_arm(instance, ld, span, stripRow, map);
 	if (physArm == 0xFF)
-		return FALSE;
+		return false;
 
 	arRef       = MR_LdSpanArrayGet(ld, span, map);
 	pd          = MR_ArPdGet(arRef, physArm, map);
@@ -812,7 +802,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 	u32         pd, arRef, r1_alt_pd;
 	u8          physArm, span;
 	u64         row;
-	u8	    retval = TRUE;
+	u8	    retval = true;
 	u64	    *pdBlock = &io_info->pdBlock;
 	__le16	    *pDevHandle = &io_info->devHandle;
 	u8	    *pPdInterface = &io_info->pd_interface;
@@ -829,7 +819,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 		u32 rowMod, armQ, arm;
 
 		if (raid->rowSize == 0)
-			return FALSE;
+			return false;
 		/* get logical row mod */
 		rowMod = mega_mod64(row, raid->rowSize);
 		armQ = raid->rowSize-1-rowMod; /* index of Q drive */
@@ -839,7 +829,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 		physArm = (u8)arm;
 	} else  {
 		if (raid->modFactor == 0)
-			return FALSE;
+			return false;
 		physArm = MR_LdDataArmGet(ld,  mega_mod64(stripRow,
 							  raid->modFactor),
 					  map);
@@ -851,7 +841,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 	} else {
 		span = (u8)MR_GetSpanBlock(ld, row, pdBlock, map);
 		if (span == SPAN_INVALID)
-			return FALSE;
+			return false;
 	}
 
 	/* Get the array on which this span is present */
@@ -954,7 +944,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 	 */
 	if (raid->rowDataSize == 0) {
 		if (MR_LdSpanPtrGet(ld, 0, map)->spanRowDataSize == 0)
-			return FALSE;
+			return false;
 		else if (instance->UnevenSpanSupport) {
 			io_info->IoforUnevenSpan = 1;
 		} else {
@@ -963,7 +953,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 				"rowDataSize = 0x%0x,"
 				"but there is _NO_ UnevenSpanSupport\n",
 				MR_LdSpanPtrGet(ld, 0, map)->spanRowDataSize);
-			return FALSE;
+			return false;
 		}
 	}
 
@@ -988,7 +978,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 			dev_info(&instance->pdev->dev, "return from %s %d."
 				"Send IO w/o region lock.\n",
 				__func__, __LINE__);
-			return FALSE;
+			return false;
 		}
 
 		if (raid->spanDepth == 1) {
@@ -1004,7 +994,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 				(unsigned long long)start_row,
 				(unsigned long long)start_strip,
 				(unsigned long long)endStrip);
-			return FALSE;
+			return false;
 		}
 		io_info->start_span	= startlba_span;
 		io_info->start_row	= start_row;
@@ -1038,7 +1028,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 					       raid->capability.
 					       fpWriteAcrossStripe));
 	} else
-		io_info->fpOkForIo = FALSE;
+		io_info->fpOkForIo = false;
 
 	if (numRows == 1) {
 		/* single-strip IOs can always lock only the data needed */
@@ -1124,7 +1114,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 					pRAID_Context, map);
 		/* If IO on an invalid Pd, then FP is not possible.*/
 		if (io_info->devHandle == MR_DEVHANDLE_INVALID)
-			io_info->fpOkForIo = FALSE;
+			io_info->fpOkForIo = false;
 		return retval;
 	} else if (isRead) {
 		uint stripIdx;
@@ -1138,10 +1128,10 @@ MR_BuildRaidContext(struct megasas_instance *instance,
 				    start_strip + stripIdx, ref_in_start_stripe,
 				    io_info, pRAID_Context, map);
 			if (!retval)
-				return TRUE;
+				return true;
 		}
 	}
-	return TRUE;
+	return true;
 }
 
 /*
-- 
2.8.3

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

* [PATCH 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (11 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:40   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size Shivasharan S
  2017-06-30  8:30 ` [PATCH 15/15] megaraid_sas: driver version upgrade Shivasharan S
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 2f5212d..39d0761 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -910,7 +910,6 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
 		ret = 1;
 		goto fail_fw_init;
 	}
-	dev_info(&instance->pdev->dev, "Init cmd success\n");
 
 	ret = 0;
 
@@ -921,6 +920,10 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
 				  sizeof(struct MPI2_IOC_INIT_REQUEST),
 				  IOCInitMessage, ioc_init_handle);
 fail_get_cmd:
+	dev_err(&instance->pdev->dev,
+		"Init cmd return status %s for SCSI host %d\n",
+		ret ? "FAILED" : "SUCCESS", instance->host->host_no);
+
 	return ret;
 }
 
@@ -4300,9 +4302,6 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 			megasas_fusion_update_can_queue(instance, OCR_CONTEXT);
 
 			if (megasas_ioc_init_fusion(instance)) {
-				dev_warn(&instance->pdev->dev,
-				       "megasas_ioc_init_fusion() failed! for "
-				       "scsi%d\n", instance->host->host_no);
 				if (instance->requestorId && !reason)
 					goto fail_kill_adapter;
 				else
@@ -4348,6 +4347,10 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 			instance->instancet->enable_intr(instance);
 			atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL);
 
+			dev_info(&instance->pdev->dev, "Interrupts are enabled and"
+				" controller is OPERATIONAL for scsi:%d\n",
+				instance->host->host_no);
+
 			/* Restart SR-IOV heartbeat */
 			if (instance->requestorId) {
 				if (!megasas_sriov_start_heartbeat(instance, 0))
@@ -4359,11 +4362,6 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 					instance->skip_heartbeat_timer_del = 1;
 			}
 
-			/* Adapter reset completed successfully */
-			dev_warn(&instance->pdev->dev, "Reset "
-			       "successful for scsi%d.\n",
-				instance->host->host_no);
-
 			if (instance->crash_dump_drv_support &&
 				instance->crash_dump_app_support)
 				megasas_set_crash_dump_params(instance,
@@ -4373,6 +4371,12 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 					MR_CRASH_BUF_TURN_OFF);
 
 			retval = SUCCESS;
+
+			/* Adapter reset completed successfully */
+			dev_warn(&instance->pdev->dev,
+				 "Reset successful for scsi%d.\n",
+				 instance->host->host_no);
+
 			goto out;
 		}
 fail_kill_adapter:
-- 
2.8.3

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

* [PATCH 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (12 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:41   ` Hannes Reinecke
  2017-06-30  8:30 ` [PATCH 15/15] megaraid_sas: driver version upgrade Shivasharan S
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index c200f1a..c403e1d 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -2795,7 +2795,7 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
 		cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr;
 		if (cmd)
 			megasas_dump_frame(cmd->io_request,
-				sizeof(struct MPI2_RAID_SCSI_IO_REQUEST));
+				MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE);
 		ret = megasas_reset_fusion(scmd->device->host,
 				SCSIIO_TIMEOUT_OCR);
 	} else
-- 
2.8.3

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

* [PATCH 15/15] megaraid_sas: driver version upgrade
  2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (13 preceding siblings ...)
  2017-06-30  8:30 ` [PATCH 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size Shivasharan S
@ 2017-06-30  8:30 ` Shivasharan S
  2017-06-30 13:41   ` Hannes Reinecke
  14 siblings, 1 reply; 38+ messages in thread
From: Shivasharan S @ 2017-06-30  8:30 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index 6d9f111..a6722c9 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -35,8 +35,8 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION				"07.701.17.00-rc1"
-#define MEGASAS_RELDATE				"March 2, 2017"
+#define MEGASAS_VERSION				"07.702.06.00-rc1"
+#define MEGASAS_RELDATE				"June 21, 2017"
 
 /*
  * Device IDs
-- 
2.8.3

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

* Re: [PATCH 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command
  2017-06-30  8:29 ` [PATCH 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command Shivasharan S
@ 2017-06-30 13:23   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:23 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, stable

On 06/30/2017 10:29 AM, Shivasharan S wrote:
>  Fix - Driver allocated 256 byte MFI frames bytes but while sending MFI
>  frame (embedded inside chain frame of MPT frame) to firmware, driver
>  sets the length as 4k. This results in DMA read error messages during
>  boot.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index f990ab4d..f717fbc 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -3283,7 +3283,7 @@ build_mpt_mfi_pass_thru(struct megasas_instance *instance,
>  	mpi25_ieee_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
>  		MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR;
>  
> -	mpi25_ieee_chain->Length = cpu_to_le32(instance->max_chain_frame_sz);
> +	mpi25_ieee_chain->Length = cpu_to_le32(instance->mfi_frame_size);
>  }
>  
>  /**
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs
  2017-06-30  8:29 ` [PATCH 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs Shivasharan S
@ 2017-06-30 13:23   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:23 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, stable

On 06/30/2017 10:29 AM, Shivasharan S wrote:
> Setting resetwaittime to 0 will result in driver not calling the OCR
> during a FW fault state.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 316c3df..395c3aa 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -5478,7 +5478,8 @@ static int megasas_init_fw(struct megasas_instance *instance)
>  		instance->throttlequeuedepth =
>  				MEGASAS_THROTTLE_QUEUE_DEPTH;
>  
> -	if (resetwaittime > MEGASAS_RESET_WAIT_TIME)
> +	if ((resetwaittime < 1) ||
> +	    (resetwaittime > MEGASAS_RESET_WAIT_TIME))
>  		resetwaittime = MEGASAS_RESET_WAIT_TIME;
>  
>  	if ((scmd_timeout < 10) || (scmd_timeout > MEGASAS_DEFAULT_CMD_TIMEOUT))
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 03/15] megaraid_sas: Use synchronize_irq in target reset case
  2017-06-30  8:29 ` [PATCH 03/15] megaraid_sas: Use synchronize_irq in target reset case Shivasharan S
@ 2017-06-30 13:24   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:24 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:29 AM, Shivasharan S wrote:
> Similar to task abort case, use synchronize_irq API in target reset case.
> Also, remove redundant call to megasas_complete_cmd_dpc_fusion
> after calling megasas_sync_irqs in task abort case.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index f717fbc..5018a3f 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -3826,8 +3826,6 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
>  		else {
>  			instance->instancet->disable_intr(instance);
>  			megasas_sync_irqs((unsigned long)instance);
> -			megasas_complete_cmd_dpc_fusion
> -					((unsigned long)instance);
>  			instance->instancet->enable_intr(instance);
>  			if (scsi_lookup->scmd == NULL)
>  				break;
> @@ -3839,9 +3837,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
>  		if ((channel == 0xFFFFFFFF) && (id == 0xFFFFFFFF))
>  			break;
>  		instance->instancet->disable_intr(instance);
> -		msleep(1000);
> -		megasas_complete_cmd_dpc_fusion
> -				((unsigned long)instance);
> +		megasas_sync_irqs((unsigned long)instance);
>  		rc = megasas_track_scsiio(instance, id, channel);
>  		instance->instancet->enable_intr(instance);
>  
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands
  2017-06-30  8:29 ` [PATCH 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands Shivasharan S
@ 2017-06-30 13:25   ` Hannes Reinecke
  2017-07-04  7:05     ` Shivasharan Srikanteshwara
  0 siblings, 1 reply; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:25 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:29 AM, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 5018a3f..0f13c58 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -3552,6 +3552,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
>  			}
>  		}
>  
> +		megasas_complete_cmd_dpc_fusion((unsigned long)instance);
>  		outstanding = atomic_read(&instance->fw_outstanding);
>  		if (!outstanding)
>  			goto out;
> @@ -3560,8 +3561,6 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
>  			dev_notice(&instance->pdev->dev, "[%2d]waiting for %d "
>  			       "commands to complete for scsi%d\n", i,
>  			       outstanding, instance->host->host_no);
> -			megasas_complete_cmd_dpc_fusion(
> -				(unsigned long)instance);
>  		}
>  		msleep(1000);
>  	}
> 
Please add a changelog why this is necessary.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR
  2017-06-30  8:29 ` [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR Shivasharan S
@ 2017-06-30 13:30   ` Hannes Reinecke
  2017-07-04  7:08     ` Shivasharan Srikanteshwara
  2017-07-05 10:33     ` Shivasharan Srikanteshwara
  0 siblings, 2 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:30 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:29 AM, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 0f13c58..a308e14 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -3618,6 +3618,15 @@ void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
>  
>  		if (!smid)
>  			continue;
> +
> +		/* Do not refire shutdown command */
> +		if (le32_to_cpu(cmd_mfi->frame->dcmd.opcode) ==
> +			MR_DCMD_CTRL_SHUTDOWN) {
> +			cmd_mfi->frame->dcmd.cmd_status = MFI_STAT_OK;
> +			megasas_complete_cmd(instance, cmd_mfi, DID_OK);
> +			continue;
> +		}
> +
>  		req_desc = megasas_get_request_descriptor
>  					(instance, smid - 1);
>  		refire_cmd = req_desc && ((cmd_mfi->frame->dcmd.opcode !=
> 
Please, no.
You already have a selector further down whether to refire the command,
pending on the DRV_DCMD_SKIP_REFIRE flag.
If you always set this flag for the shutdown command you wouldn't need
to touch this at all.
And if you particularly dislike that solution convert the 'refire_cmd ='
statement into a proper switch and blank it out from there.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 06/15] megaraid_sas: Fix endianness issues in DCMD handling
  2017-06-30  8:30 ` [PATCH 06/15] megaraid_sas: Fix endianness issues in DCMD handling Shivasharan S
@ 2017-06-30 13:34   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:34 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic
  2017-06-30  8:30 ` [PATCH 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic Shivasharan S
@ 2017-06-30 13:35   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:35 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, stable

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> An application sending out of range AEN class code for 
> registration, will result in kernel panic in MR driver.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 3c50a7b..e490272 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -5650,6 +5650,14 @@ megasas_register_aen(struct megasas_instance *instance, u32 seq_num,
>  		prev_aen.word =
>  			le32_to_cpu(instance->aen_cmd->frame->dcmd.mbox.w[1]);
>  
> +		if ((curr_aen.members.class < MFI_EVT_CLASS_DEBUG) ||
> +		    (curr_aen.members.class > MFI_EVT_CLASS_DEAD)) {
> +			dev_info(&instance->pdev->dev,
> +				 "%s %d out of range class %d send by application\n",
> +				 __func__, __LINE__, curr_aen.members.class);
> +			return 0;
> +		}
> +
>  		/*
>  		 * A class whose enum value is smaller is inclusive of all
>  		 * higher values. If a PROGRESS (= -1) was previously
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 08/15] megaraid_sas: Use SMID for Task abort case only
  2017-06-30  8:30 ` [PATCH 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
@ 2017-06-30 13:35   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:35 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Fix - In TM code, smid_task is valid only in case of task aborts.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index a308e14..c239762 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -3754,7 +3754,7 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
>  	struct megasas_cmd_fusion *cmd_fusion;
>  	struct megasas_cmd *cmd_mfi;
>  	union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;
> -	struct fusion_context *fusion;
> +	struct fusion_context *fusion = NULL;
>  	struct megasas_cmd_fusion *scsi_lookup;
>  	int rc;
>  	struct MPI2_SCSI_TASK_MANAGE_REPLY *mpi_reply;
> @@ -3781,8 +3781,6 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
>  	cmd_fusion->request_desc = req_desc;
>  	req_desc->Words = 0;
>  
> -	scsi_lookup = fusion->cmd_list[smid_task - 1];
> -
>  	mr_request = (struct MR_TASK_MANAGE_REQUEST *) cmd_fusion->io_request;
>  	memset(mr_request, 0, sizeof(struct MR_TASK_MANAGE_REQUEST));
>  	mpi_request = (struct MPI2_SCSI_TASK_MANAGE_REQUEST *) &mr_request->TmRequest;
> @@ -3829,6 +3827,8 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
>  	rc = SUCCESS;
>  	switch (type) {
>  	case MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK:
> +		scsi_lookup = fusion->cmd_list[smid_task - 1];
> +
>  		if (scsi_lookup->scmd == NULL)
>  			break;
>  		else {
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
  2017-06-30  8:30 ` [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
@ 2017-06-30 13:36   ` Hannes Reinecke
  2017-06-30 14:30   ` Tomas Henzl
  1 sibling, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:36 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas.h        |   1 -
>  drivers/scsi/megaraid/megaraid_sas_base.c   |  12 ++-
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 113 +++++++++++++++++-----------
>  3 files changed, 80 insertions(+), 46 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead
  2017-06-30  8:30 ` [PATCH 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead Shivasharan S
@ 2017-06-30 13:37   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:37 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, stable

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Fix - After a kill adapter, since the cmd_status is not set the
> IOCTLs will be hung in driver resulting in application hang.
> Set cmd_status MFI_STAT_WRONG_STATE when completing pended IOCTLs.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-06-30  8:30 ` [PATCH 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode Shivasharan S
@ 2017-06-30 13:39   ` Hannes Reinecke
  2017-07-04  7:22     ` Shivasharan Srikanteshwara
  0 siblings, 1 reply; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:39 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Currently driver sets default queue_depth for VDs at 256 and JBODs based on interface type,
> ie., for SAS JBOD QD will be 64, for SATA JBOD QD will be 32.
> During performance runs with scsi-mq enabled, we are seeing better results by
> setting QD same as HBA queue_depth.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 0230929..c200f1a 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -1891,7 +1891,8 @@ static void megasas_set_static_target_properties(struct scsi_device *sdev,
>  	if (instance->nvme_page_size && max_io_size_kb)
>  		megasas_set_nvme_device_properties(sdev, (max_io_size_kb << 10));
>  
> -	scsi_change_queue_depth(sdev, device_qd);
> +	if (!shost_use_blk_mq(sdev->host))
> +		scsi_change_queue_depth(sdev, device_qd);
>  
>  }
>  
> @@ -5914,6 +5915,9 @@ static int megasas_io_attach(struct megasas_instance *instance)
>  	host->max_lun = MEGASAS_MAX_LUN;
>  	host->max_cmd_len = 16;
>  
> +	if (shost_use_blk_mq(host))
> +		host->cmd_per_lun = host->can_queue;
> +
>  	/*
>  	 * Notify the mid-layer about the new controller
>  	 */
> 
Is this bit really necessary? It will be adjusted by the above hunk,
would it not?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true
  2017-06-30  8:30 ` [PATCH 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true Shivasharan S
@ 2017-06-30 13:40   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:40 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fp.c | 40 +++++++++++++--------------------
>  1 file changed, 15 insertions(+), 25 deletions(-)
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path
  2017-06-30  8:30 ` [PATCH 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path Shivasharan S
@ 2017-06-30 13:40   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:40 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size
  2017-06-30  8:30 ` [PATCH 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size Shivasharan S
@ 2017-06-30 13:41   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:41 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index c200f1a..c403e1d 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -2795,7 +2795,7 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
>  		cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr;
>  		if (cmd)
>  			megasas_dump_frame(cmd->io_request,
> -				sizeof(struct MPI2_RAID_SCSI_IO_REQUEST));
> +				MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE);
>  		ret = megasas_reset_fusion(scmd->device->host,
>  				SCSIIO_TIMEOUT_OCR);
>  	} else
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 15/15] megaraid_sas: driver version upgrade
  2017-06-30  8:30 ` [PATCH 15/15] megaraid_sas: driver version upgrade Shivasharan S
@ 2017-06-30 13:41   ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-06-30 13:41 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare, hch

On 06/30/2017 10:30 AM, Shivasharan S wrote:
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
> index 6d9f111..a6722c9 100644
> --- a/drivers/scsi/megaraid/megaraid_sas.h
> +++ b/drivers/scsi/megaraid/megaraid_sas.h
> @@ -35,8 +35,8 @@
>  /*
>   * MegaRAID SAS Driver meta data
>   */
> -#define MEGASAS_VERSION				"07.701.17.00-rc1"
> -#define MEGASAS_RELDATE				"March 2, 2017"
> +#define MEGASAS_VERSION				"07.702.06.00-rc1"
> +#define MEGASAS_RELDATE				"June 21, 2017"
>  
>  /*
>   * Device IDs
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
  2017-06-30  8:30 ` [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
  2017-06-30 13:36   ` Hannes Reinecke
@ 2017-06-30 14:30   ` Tomas Henzl
  2017-07-03  7:13     ` Shivasharan Srikanteshwara
  1 sibling, 1 reply; 38+ messages in thread
From: Tomas Henzl @ 2017-06-30 14:30 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 30.6.2017 10:30, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas.h        |   1 -
>  drivers/scsi/megaraid/megaraid_sas_base.c   |  12 ++-
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 113 +++++++++++++++++-----------
>  3 files changed, 80 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
> index 2b209bb..6d9f111 100644
> --- a/drivers/scsi/megaraid/megaraid_sas.h
> +++ b/drivers/scsi/megaraid/megaraid_sas.h
> @@ -2115,7 +2115,6 @@ struct megasas_instance {
>  	u32 *crash_dump_buf;
>  	dma_addr_t crash_dump_h;
>  	void *crash_buf[MAX_CRASH_DUMP_SIZE];
> -	u32 crash_buf_pages;
>  	unsigned int    fw_crash_buffer_size;
>  	unsigned int    fw_crash_state;
>  	unsigned int    fw_crash_buffer_offset;
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index e490272..c63ef88 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -49,6 +49,7 @@
>  #include <linux/blkdev.h>
>  #include <linux/mutex.h>
>  #include <linux/poll.h>
> +#include <linux/vmalloc.h>
>  
>  #include <scsi/scsi.h>
>  #include <scsi/scsi_cmnd.h>
> @@ -6672,9 +6673,14 @@ static void megasas_detach_one(struct pci_dev *pdev)
>  						  fusion->max_map_sz,
>  						  fusion->ld_map[i],
>  						  fusion->ld_map_phys[i]);
> -			if (fusion->ld_drv_map[i])
> -				free_pages((ulong)fusion->ld_drv_map[i],
> -					fusion->drv_map_pages);
> +			if (fusion->ld_drv_map[i]) {
> +				if (is_vmalloc_addr(fusion->ld_drv_map[i]))
> +					vfree(fusion->ld_drv_map[i]);
> +				else
> +					free_pages((ulong)fusion->ld_drv_map[i],
> +						   fusion->drv_map_pages);
> +			}
> +
>  			if (fusion->pd_seq_sync[i])
>  				dma_free_coherent(&instance->pdev->dev,
>  					pd_seq_map_sz,
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index c239762..2f5212d 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -1257,6 +1257,72 @@ megasas_display_intel_branding(struct megasas_instance *instance)
>  }
>  
>  /**
> + * megasas_allocate_raid_maps -	Allocate memory for RAID maps
> + * @instance:				Adapter soft state
> + *
> + * return:				if success: return 0
> + *					failed:  return -ENOMEM
> + */
> +static inline int megasas_allocate_raid_maps(struct megasas_instance *instance)
> +{
> +	struct fusion_context *fusion;
> +	int i = 0;
> +
> +	fusion = instance->ctrl_context;
> +
> +	fusion->drv_map_pages = get_order(fusion->drv_map_sz);
> +
> +	for (i = 0; i < 2; i++) {
> +		fusion->ld_map[i] = NULL;
> +
> +		fusion->ld_drv_map[i] = (void *)
> +			__get_free_pages(__GFP_ZERO | GFP_KERNEL,
> +					 fusion->drv_map_pages);
> +
> +		if (!fusion->ld_drv_map[i]) {
> +			fusion->ld_drv_map[i] = vzalloc(fusion->drv_map_sz);
> +
> +			if (!fusion->ld_drv_map[i]) {
> +				dev_err(&instance->pdev->dev,
> +					"Could not allocate memory for local map"
> +					" size requested: %d\n",
> +					fusion->drv_map_sz);
> +
> +				if (fusion->ld_drv_map[0]) {
> +					if (is_vmalloc_addr(fusion->ld_drv_map[0]))
> +						vfree(fusion->ld_drv_map[0]);
> +					else
> +						free_pages((ulong)fusion->ld_drv_map[0],
> +							   fusion->drv_map_pages);
> +				}
> +				return -ENOMEM;
> +			}
> +		}
> +	}
> +
> +	for (i = 0; i < 2; i++) {
> +		fusion->ld_map[i] = dma_alloc_coherent(&instance->pdev->dev,
> +						       fusion->max_map_sz,
> +						       &fusion->ld_map_phys[i],
> +						       GFP_KERNEL);
> +		if (!fusion->ld_map[i]) {
> +			dev_err(&instance->pdev->dev,
> +				"Could not allocate memory for map info %s:%d\n",
> +				__func__, __LINE__);
> +
> +			if (fusion->ld_map[0])
> +				dma_free_coherent(&instance->pdev->dev,
> +						  fusion->max_map_sz,
> +						  fusion->ld_map[0],
> +						  fusion->ld_map_phys[0]);

Hi Shivasharan,
isn't a fusion->ld_drv_map clean up missing here ?
tomash

> +			return -ENOMEM;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +/**
>   * megasas_init_adapter_fusion -	Initializes the FW
>   * @instance:		Adapter soft state
>   *
> @@ -1375,45 +1441,14 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
>  	instance->r1_ldio_hint_default =  MR_R1_LDIO_PIGGYBACK_DEFAULT;
>  	fusion->fast_path_io = 0;
>  
> -	fusion->drv_map_pages = get_order(fusion->drv_map_sz);
> -	for (i = 0; i < 2; i++) {
> -		fusion->ld_map[i] = NULL;
> -		fusion->ld_drv_map[i] = (void *)__get_free_pages(GFP_KERNEL,
> -			fusion->drv_map_pages);
> -		if (!fusion->ld_drv_map[i]) {
> -			dev_err(&instance->pdev->dev, "Could not allocate "
> -				"memory for local map info for %d pages\n",
> -				fusion->drv_map_pages);
> -			if (i == 1)
> -				free_pages((ulong)fusion->ld_drv_map[0],
> -					fusion->drv_map_pages);
> -			goto fail_ioc_init;
> -		}
> -		memset(fusion->ld_drv_map[i], 0,
> -			((1 << PAGE_SHIFT) << fusion->drv_map_pages));
> -	}
> -
> -	for (i = 0; i < 2; i++) {
> -		fusion->ld_map[i] = dma_alloc_coherent(&instance->pdev->dev,
> -						       fusion->max_map_sz,
> -						       &fusion->ld_map_phys[i],
> -						       GFP_KERNEL);
> -		if (!fusion->ld_map[i]) {
> -			dev_err(&instance->pdev->dev, "Could not allocate memory "
> -			       "for map info\n");
> -			goto fail_map_info;
> -		}
> -	}
> +	if (megasas_allocate_raid_maps(instance))
> +		goto fail_ioc_init;
>  
>  	if (!megasas_get_map_info(instance))
>  		megasas_sync_map_info(instance);
>  
>  	return 0;
>  
> -fail_map_info:
> -	if (i == 1)
> -		dma_free_coherent(&instance->pdev->dev, fusion->max_map_sz,
> -				  fusion->ld_map[0], fusion->ld_map_phys[0]);
>  fail_ioc_init:
>  	megasas_free_cmds_fusion(instance);
>  fail_alloc_cmds:
> @@ -3365,17 +3400,13 @@ megasas_alloc_host_crash_buffer(struct megasas_instance *instance)
>  {
>  	unsigned int i;
>  
> -	instance->crash_buf_pages = get_order(CRASH_DMA_BUF_SIZE);
>  	for (i = 0; i < MAX_CRASH_DUMP_SIZE; i++) {
> -		instance->crash_buf[i] = (void	*)__get_free_pages(GFP_KERNEL,
> -				instance->crash_buf_pages);
> +		instance->crash_buf[i] = vzalloc(CRASH_DMA_BUF_SIZE);
>  		if (!instance->crash_buf[i]) {
>  			dev_info(&instance->pdev->dev, "Firmware crash dump "
>  				"memory allocation failed at index %d\n", i);
>  			break;
>  		}
> -		memset(instance->crash_buf[i], 0,
> -			((1 << PAGE_SHIFT) << instance->crash_buf_pages));
>  	}
>  	instance->drv_buf_alloc = i;
>  }
> @@ -3387,12 +3418,10 @@ megasas_alloc_host_crash_buffer(struct megasas_instance *instance)
>  void
>  megasas_free_host_crash_buffer(struct megasas_instance *instance)
>  {
> -	unsigned int i
> -;
> +	unsigned int i;
>  	for (i = 0; i < instance->drv_buf_alloc; i++) {
>  		if (instance->crash_buf[i])
> -			free_pages((ulong)instance->crash_buf[i],
> -					instance->crash_buf_pages);
> +			vfree(instance->crash_buf[i]);
>  	}
>  	instance->drv_buf_index = 0;
>  	instance->drv_buf_alloc = 0;

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

* RE: [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
  2017-06-30 14:30   ` Tomas Henzl
@ 2017-07-03  7:13     ` Shivasharan Srikanteshwara
  0 siblings, 0 replies; 38+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-03  7:13 UTC (permalink / raw)
  To: Tomas Henzl, linux-scsi
  Cc: martin.petersen, jejb, Kashyap Desai, Sumit Saxena, hare, hch

> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com]
> Sent: Friday, June 30, 2017 8:01 PM
> To: Shivasharan S; linux-scsi@vger.kernel.org
> Cc: martin.petersen@oracle.com; jejb@linux.vnet.ibm.com;
> kashyap.desai@broadcom.com; sumit.saxena@broadcom.com;
> hare@suse.com; hch@lst.de
> Subject: Re: [PATCH 09/15] megaraid_sas: use vmalloc for crash dump
> buffers
> and driver's local RAID map
>
> On 30.6.2017 10:30, Shivasharan S wrote:
> > Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> > Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> > ---
> >  drivers/scsi/megaraid/megaraid_sas.h        |   1 -
> >  drivers/scsi/megaraid/megaraid_sas_base.c   |  12 ++-
> >  drivers/scsi/megaraid/megaraid_sas_fusion.c | 113
> > +++++++++++++++++-----------
> >  3 files changed, 80 insertions(+), 46 deletions(-)
> >
> > diff --git a/drivers/scsi/megaraid/megaraid_sas.h
> > b/drivers/scsi/megaraid/megaraid_sas.h
> > index 2b209bb..6d9f111 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas.h
> > +++ b/drivers/scsi/megaraid/megaraid_sas.h
> > @@ -2115,7 +2115,6 @@ struct megasas_instance {
> >  	u32 *crash_dump_buf;
> >  	dma_addr_t crash_dump_h;
> >  	void *crash_buf[MAX_CRASH_DUMP_SIZE];
> > -	u32 crash_buf_pages;
> >  	unsigned int    fw_crash_buffer_size;
> >  	unsigned int    fw_crash_state;
> >  	unsigned int    fw_crash_buffer_offset;
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> > b/drivers/scsi/megaraid/megaraid_sas_base.c
> > index e490272..c63ef88 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> > @@ -49,6 +49,7 @@
> >  #include <linux/blkdev.h>
> >  #include <linux/mutex.h>
> >  #include <linux/poll.h>
> > +#include <linux/vmalloc.h>
> >
> >  #include <scsi/scsi.h>
> >  #include <scsi/scsi_cmnd.h>
> > @@ -6672,9 +6673,14 @@ static void megasas_detach_one(struct pci_dev
> *pdev)
> >  						  fusion->max_map_sz,
> >  						  fusion->ld_map[i],
> >  						  fusion->ld_map_phys[i]);
> > -			if (fusion->ld_drv_map[i])
> > -				free_pages((ulong)fusion->ld_drv_map[i],
> > -					fusion->drv_map_pages);
> > +			if (fusion->ld_drv_map[i]) {
> > +				if (is_vmalloc_addr(fusion->ld_drv_map[i]))
> > +					vfree(fusion->ld_drv_map[i]);
> > +				else
> > +					free_pages((ulong)fusion-
> >ld_drv_map[i],
> > +						   fusion->drv_map_pages);
> > +			}
> > +
> >  			if (fusion->pd_seq_sync[i])
> >  				dma_free_coherent(&instance->pdev->dev,
> >  					pd_seq_map_sz,
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > index c239762..2f5212d 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > @@ -1257,6 +1257,72 @@ megasas_display_intel_branding(struct
> > megasas_instance *instance)  }
> >
> >  /**
> > + * megasas_allocate_raid_maps -	Allocate memory for RAID maps
> > + * @instance:				Adapter soft state
> > + *
> > + * return:				if success: return 0
> > + *					failed:  return -ENOMEM
> > + */
> > +static inline int megasas_allocate_raid_maps(struct megasas_instance
> > +*instance) {
> > +	struct fusion_context *fusion;
> > +	int i = 0;
> > +
> > +	fusion = instance->ctrl_context;
> > +
> > +	fusion->drv_map_pages = get_order(fusion->drv_map_sz);
> > +
> > +	for (i = 0; i < 2; i++) {
> > +		fusion->ld_map[i] = NULL;
> > +
> > +		fusion->ld_drv_map[i] = (void *)
> > +			__get_free_pages(__GFP_ZERO | GFP_KERNEL,
> > +					 fusion->drv_map_pages);
> > +
> > +		if (!fusion->ld_drv_map[i]) {
> > +			fusion->ld_drv_map[i] = vzalloc(fusion->drv_map_sz);
> > +
> > +			if (!fusion->ld_drv_map[i]) {
> > +				dev_err(&instance->pdev->dev,
> > +					"Could not allocate memory for local
> map"
> > +					" size requested: %d\n",
> > +					fusion->drv_map_sz);
> > +
> > +				if (fusion->ld_drv_map[0]) {
> > +					if (is_vmalloc_addr(fusion-
> >ld_drv_map[0]))
> > +						vfree(fusion->ld_drv_map[0]);
> > +					else
> > +						free_pages((ulong)fusion-
> >ld_drv_map[0],
> > +							   fusion-
> >drv_map_pages);
> > +				}
> > +				return -ENOMEM;
> > +			}
> > +		}
> > +	}
> > +
> > +	for (i = 0; i < 2; i++) {
> > +		fusion->ld_map[i] = dma_alloc_coherent(&instance->pdev-
> >dev,
> > +						       fusion->max_map_sz,
> > +						       &fusion->ld_map_phys[i],
> > +						       GFP_KERNEL);
> > +		if (!fusion->ld_map[i]) {
> > +			dev_err(&instance->pdev->dev,
> > +				"Could not allocate memory for map info
> %s:%d\n",
> > +				__func__, __LINE__);
> > +
> > +			if (fusion->ld_map[0])
> > +				dma_free_coherent(&instance->pdev->dev,
> > +						  fusion->max_map_sz,
> > +						  fusion->ld_map[0],
> > +						  fusion->ld_map_phys[0]);
>
> Hi Shivasharan,
> isn't a fusion->ld_drv_map clean up missing here ?
> tomash
>
Hi Tomas,
I will be sending v2 of the series with this fixed.

Thanks,
Shivasharan

> > +			return -ENOMEM;
> > +		}
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +/**
> >   * megasas_init_adapter_fusion -	Initializes the FW
> >   * @instance:		Adapter soft state
> >   *
> > @@ -1375,45 +1441,14 @@ megasas_init_adapter_fusion(struct
> megasas_instance *instance)
> >  	instance->r1_ldio_hint_default =  MR_R1_LDIO_PIGGYBACK_DEFAULT;
> >  	fusion->fast_path_io = 0;
> >
> > -	fusion->drv_map_pages = get_order(fusion->drv_map_sz);
> > -	for (i = 0; i < 2; i++) {
> > -		fusion->ld_map[i] = NULL;
> > -		fusion->ld_drv_map[i] = (void
> *)__get_free_pages(GFP_KERNEL,
> > -			fusion->drv_map_pages);
> > -		if (!fusion->ld_drv_map[i]) {
> > -			dev_err(&instance->pdev->dev, "Could not allocate "
> > -				"memory for local map info for %d pages\n",
> > -				fusion->drv_map_pages);
> > -			if (i == 1)
> > -				free_pages((ulong)fusion->ld_drv_map[0],
> > -					fusion->drv_map_pages);
> > -			goto fail_ioc_init;
> > -		}
> > -		memset(fusion->ld_drv_map[i], 0,
> > -			((1 << PAGE_SHIFT) << fusion->drv_map_pages));
> > -	}
> > -
> > -	for (i = 0; i < 2; i++) {
> > -		fusion->ld_map[i] = dma_alloc_coherent(&instance->pdev-
> >dev,
> > -						       fusion->max_map_sz,
> > -						       &fusion->ld_map_phys[i],
> > -						       GFP_KERNEL);
> > -		if (!fusion->ld_map[i]) {
> > -			dev_err(&instance->pdev->dev, "Could not allocate
> memory "
> > -			       "for map info\n");
> > -			goto fail_map_info;
> > -		}
> > -	}
> > +	if (megasas_allocate_raid_maps(instance))
> > +		goto fail_ioc_init;
> >
> >  	if (!megasas_get_map_info(instance))
> >  		megasas_sync_map_info(instance);
> >
> >  	return 0;
> >
> > -fail_map_info:
> > -	if (i == 1)
> > -		dma_free_coherent(&instance->pdev->dev, fusion-
> >max_map_sz,
> > -				  fusion->ld_map[0], fusion->ld_map_phys[0]);
> >  fail_ioc_init:
> >  	megasas_free_cmds_fusion(instance);
> >  fail_alloc_cmds:
> > @@ -3365,17 +3400,13 @@ megasas_alloc_host_crash_buffer(struct
> > megasas_instance *instance)  {
> >  	unsigned int i;
> >
> > -	instance->crash_buf_pages = get_order(CRASH_DMA_BUF_SIZE);
> >  	for (i = 0; i < MAX_CRASH_DUMP_SIZE; i++) {
> > -		instance->crash_buf[i] = (void
> 	*)__get_free_pages(GFP_KERNEL,
> > -				instance->crash_buf_pages);
> > +		instance->crash_buf[i] = vzalloc(CRASH_DMA_BUF_SIZE);
> >  		if (!instance->crash_buf[i]) {
> >  			dev_info(&instance->pdev->dev, "Firmware crash dump
> "
> >  				"memory allocation failed at index %d\n", i);
> >  			break;
> >  		}
> > -		memset(instance->crash_buf[i], 0,
> > -			((1 << PAGE_SHIFT) << instance->crash_buf_pages));
> >  	}
> >  	instance->drv_buf_alloc = i;
> >  }
> > @@ -3387,12 +3418,10 @@ megasas_alloc_host_crash_buffer(struct
> > megasas_instance *instance)  void
> > megasas_free_host_crash_buffer(struct megasas_instance *instance)  {
> > -	unsigned int i
> > -;
> > +	unsigned int i;
> >  	for (i = 0; i < instance->drv_buf_alloc; i++) {
> >  		if (instance->crash_buf[i])
> > -			free_pages((ulong)instance->crash_buf[i],
> > -					instance->crash_buf_pages);
> > +			vfree(instance->crash_buf[i]);
> >  	}
> >  	instance->drv_buf_index = 0;
> >  	instance->drv_buf_alloc = 0;
>

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

* RE: [PATCH 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands
  2017-06-30 13:25   ` Hannes Reinecke
@ 2017-07-04  7:05     ` Shivasharan Srikanteshwara
  0 siblings, 0 replies; 38+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-04  7:05 UTC (permalink / raw)
  To: Hannes Reinecke, linux-scsi
  Cc: martin.petersen, thenzl, jejb, Kashyap Desai, Sumit Saxena, hare, hch

> -----Original Message-----
> From: Hannes Reinecke [mailto:hare@suse.de]
> Sent: Friday, June 30, 2017 6:55 PM
> To: Shivasharan S; 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; hch@lst.de
> Subject: Re: [PATCH 04/15] megaraid_sas: Call
> megasas_complete_cmd_dpc_fusion every 1 second while there are pending
> commands
>
> On 06/30/2017 10:29 AM, Shivasharan S wrote:
> > Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> > Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> > ---
> >  drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > index 5018a3f..0f13c58 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > @@ -3552,6 +3552,7 @@ int megasas_wait_for_outstanding_fusion(struct
> megasas_instance *instance,
> >  			}
> >  		}
> >
> > +		megasas_complete_cmd_dpc_fusion((unsigned long)instance);
> >  		outstanding = atomic_read(&instance->fw_outstanding);
> >  		if (!outstanding)
> >  			goto out;
> > @@ -3560,8 +3561,6 @@ int megasas_wait_for_outstanding_fusion(struct
> megasas_instance *instance,
> >  			dev_notice(&instance->pdev->dev, "[%2d]waiting for
> %d "
> >  			       "commands to complete for scsi%d\n", i,
> >  			       outstanding, instance->host->host_no);
> > -			megasas_complete_cmd_dpc_fusion(
> > -				(unsigned long)instance);
> >  		}
> >  		msleep(1000);
> >  	}
> >
> Please add a changelog why this is necessary.
>

Sure Hannes. I will update the commit description with the details
and send out v2 of the series.

> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke		   Teamlead Storage & Networking
> hare@suse.de			               +49 911 74053 688
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284
> (AG
> Nürnberg)

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

* RE: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR
  2017-06-30 13:30   ` Hannes Reinecke
@ 2017-07-04  7:08     ` Shivasharan Srikanteshwara
  2017-07-05 10:33     ` Shivasharan Srikanteshwara
  1 sibling, 0 replies; 38+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-04  7:08 UTC (permalink / raw)
  To: Hannes Reinecke, linux-scsi
  Cc: martin.petersen, thenzl, jejb, Kashyap Desai, Sumit Saxena, hare, hch

> -----Original Message-----
> From: Hannes Reinecke [mailto:hare@suse.de]
> Sent: Friday, June 30, 2017 7:00 PM
> To: Shivasharan S; 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; hch@lst.de
> Subject: Re: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD
> after
> OCR
>
> On 06/30/2017 10:29 AM, Shivasharan S wrote:
> > Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> > Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> > ---
> >  drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > index 0f13c58..a308e14 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > @@ -3618,6 +3618,15 @@ void megasas_refire_mgmt_cmd(struct
> > megasas_instance *instance)
> >
> >  		if (!smid)
> >  			continue;
> > +
> > +		/* Do not refire shutdown command */
> > +		if (le32_to_cpu(cmd_mfi->frame->dcmd.opcode) ==
> > +			MR_DCMD_CTRL_SHUTDOWN) {
> > +			cmd_mfi->frame->dcmd.cmd_status = MFI_STAT_OK;
> > +			megasas_complete_cmd(instance, cmd_mfi, DID_OK);
> > +			continue;
> > +		}
> > +
> >  		req_desc = megasas_get_request_descriptor
> >  					(instance, smid - 1);
> >  		refire_cmd = req_desc && ((cmd_mfi->frame->dcmd.opcode !=
> >
> Please, no.
> You already have a selector further down whether to refire the command,
> pending on the DRV_DCMD_SKIP_REFIRE flag.
> If you always set this flag for the shutdown command you wouldn't need to
> touch this at all.
> And if you particularly dislike that solution convert the 'refire_cmd ='
> statement into a proper switch and blank it out from there.
>

Hi Hannes,
The management commands that get skipped further down in this function
are internally generated by the driver itself so we don’t need to complete
it
back to the application.
In case of shutdown DCMD, it’s an IOCTL command(issued by application)
so we need to return status back to application.
Combining handling of both the cases or using DRV_DCMD_SKIP_REFIRE
will not be as straightforward.

Thanks,
Shivasharan

> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke		   Teamlead Storage & Networking
> hare@suse.de			               +49 911 74053 688
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284
> (AG
> Nürnberg)

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

* RE: [PATCH 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-06-30 13:39   ` Hannes Reinecke
@ 2017-07-04  7:22     ` Shivasharan Srikanteshwara
  0 siblings, 0 replies; 38+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-04  7:22 UTC (permalink / raw)
  To: Hannes Reinecke, linux-scsi
  Cc: martin.petersen, thenzl, jejb, Kashyap Desai, Sumit Saxena, hare, hch

> -----Original Message-----
> From: Hannes Reinecke [mailto:hare@suse.de]
> Sent: Friday, June 30, 2017 7:10 PM
> To: Shivasharan S; 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; hch@lst.de
> Subject: Re: [PATCH 11/15] megaraid_sas: Set device queue_depth same as
> HBA
> can_queue value in scsi-mq mode
>
> On 06/30/2017 10:30 AM, Shivasharan S wrote:
> > Currently driver sets default queue_depth for VDs at 256 and JBODs
> > based on interface type, ie., for SAS JBOD QD will be 64, for SATA JBOD
> > QD will
> be 32.
> > During performance runs with scsi-mq enabled, we are seeing better
> > results by setting QD same as HBA queue_depth.
> >
> > Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> > Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> > ---
> >  drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> > b/drivers/scsi/megaraid/megaraid_sas_base.c
> > index 0230929..c200f1a 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> > @@ -1891,7 +1891,8 @@ static void
> megasas_set_static_target_properties(struct scsi_device *sdev,
> >  	if (instance->nvme_page_size && max_io_size_kb)
> >  		megasas_set_nvme_device_properties(sdev, (max_io_size_kb
> << 10));
> >
> > -	scsi_change_queue_depth(sdev, device_qd);
> > +	if (!shost_use_blk_mq(sdev->host))
> > +		scsi_change_queue_depth(sdev, device_qd);
> >
> >  }
> >
> > @@ -5914,6 +5915,9 @@ static int megasas_io_attach(struct
> megasas_instance *instance)
> >  	host->max_lun = MEGASAS_MAX_LUN;
> >  	host->max_cmd_len = 16;
> >
> > +	if (shost_use_blk_mq(host))
> > +		host->cmd_per_lun = host->can_queue;
> > +
> >  	/*
> >  	 * Notify the mid-layer about the new controller
> >  	 */
> >
> Is this bit really necessary? It will be adjusted by the above hunk, would
> it not?
>

The default cmd_per_lun is now set to 256 (MEGASAS_DEFAULT_CMD_PER_LUN).
In the above snip, we are changing cmd_per_lun to be equal to HBA
queue_depth for multiqueue enabled case.
So any scsi_device getting configured with scsi-mq enabled will have
queue_depth
set to cmd_per_lun value.
The hunk in megasas_set_static_target_properties is to update
the queue_depth for non-mq case only based on value provided by firmware.

Thanks,
Shivasharan

> Cheers,
>
> Hannes
> --
> Dr. Hannes Reinecke		   Teamlead Storage & Networking
> hare@suse.de			               +49 911 74053 688
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284
> (AG
> Nürnberg)

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

* RE: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR
  2017-06-30 13:30   ` Hannes Reinecke
  2017-07-04  7:08     ` Shivasharan Srikanteshwara
@ 2017-07-05 10:33     ` Shivasharan Srikanteshwara
  2017-07-05 10:34       ` Hannes Reinecke
  1 sibling, 1 reply; 38+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-05 10:33 UTC (permalink / raw)
  To: Hannes Reinecke, linux-scsi
  Cc: martin.petersen, thenzl, jejb, Kashyap Desai, Sumit Saxena, hare, hch

> -----Original Message-----
> From: Shivasharan Srikanteshwara
> [mailto:shivasharan.srikanteshwara@broadcom.com]
> Sent: Tuesday, July 04, 2017 12:39 PM
> To: 'Hannes Reinecke'; 'linux-scsi@vger.kernel.org'
> Cc: 'martin.petersen@oracle.com'; 'thenzl@redhat.com';
> 'jejb@linux.vnet.ibm.com'; Kashyap Desai; Sumit Saxena; 'hare@suse.com';
> 'hch@lst.de'
> Subject: RE: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD
> after
> OCR
>
> > -----Original Message-----
> > From: Hannes Reinecke [mailto:hare@suse.de]
> > Sent: Friday, June 30, 2017 7:00 PM
> > To: Shivasharan S; 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; hch@lst.de
> > Subject: Re: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD
> > after OCR
> >
> > On 06/30/2017 10:29 AM, Shivasharan S wrote:
> > > Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> > > Signed-off-by: Shivasharan S
> > > <shivasharan.srikanteshwara@broadcom.com>
> > > ---
> > >  drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > >
> > > diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > > b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > > index 0f13c58..a308e14 100644
> > > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > > @@ -3618,6 +3618,15 @@ void megasas_refire_mgmt_cmd(struct
> > > megasas_instance *instance)
> > >
> > >  		if (!smid)
> > >  			continue;
> > > +
> > > +		/* Do not refire shutdown command */
> > > +		if (le32_to_cpu(cmd_mfi->frame->dcmd.opcode) ==
> > > +			MR_DCMD_CTRL_SHUTDOWN) {
> > > +			cmd_mfi->frame->dcmd.cmd_status = MFI_STAT_OK;
> > > +			megasas_complete_cmd(instance, cmd_mfi, DID_OK);
> > > +			continue;
> > > +		}
> > > +
> > >  		req_desc = megasas_get_request_descriptor
> > >  					(instance, smid - 1);
> > >  		refire_cmd = req_desc && ((cmd_mfi->frame->dcmd.opcode !=
> > >
> > Please, no.
> > You already have a selector further down whether to refire the
> > command, pending on the DRV_DCMD_SKIP_REFIRE flag.
> > If you always set this flag for the shutdown command you wouldn't need
> > to touch this at all.
> > And if you particularly dislike that solution convert the 'refire_cmd ='
> > statement into a proper switch and blank it out from there.
> >
>
> Hi Hannes,
> The management commands that get skipped further down in this function are
> internally generated by the driver itself so we don’t need to complete it
> back to
> the application.
> In case of shutdown DCMD, it’s an IOCTL command(issued by application) so
> we
> need to return status back to application.
> Combining handling of both the cases or using DRV_DCMD_SKIP_REFIRE will
> not
> be as straightforward.
>
> Thanks,
> Shivasharan
>
Hi Hannes,
We will implement the switch case approach during our next submission as
this
the current code is well tested internally and want to avoid regressions.
Are you ok if we keep it this way for now?

Thanks,
Shivasharan

> > Cheers,
> >
> > Hannes
> > --
> > Dr. Hannes Reinecke		   Teamlead Storage & Networking
> > hare@suse.de			               +49 911 74053 688
> > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> > GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB
> > 21284 (AG
> > Nürnberg)

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

* Re: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR
  2017-07-05 10:33     ` Shivasharan Srikanteshwara
@ 2017-07-05 10:34       ` Hannes Reinecke
  0 siblings, 0 replies; 38+ messages in thread
From: Hannes Reinecke @ 2017-07-05 10:34 UTC (permalink / raw)
  To: Shivasharan Srikanteshwara, linux-scsi
  Cc: martin.petersen, thenzl, jejb, Kashyap Desai, Sumit Saxena, hare, hch

On 07/05/2017 12:33 PM, Shivasharan Srikanteshwara wrote:
>> -----Original Message-----
>> From: Shivasharan Srikanteshwara
>> [mailto:shivasharan.srikanteshwara@broadcom.com]
>> Sent: Tuesday, July 04, 2017 12:39 PM
>> To: 'Hannes Reinecke'; 'linux-scsi@vger.kernel.org'
>> Cc: 'martin.petersen@oracle.com'; 'thenzl@redhat.com';
>> 'jejb@linux.vnet.ibm.com'; Kashyap Desai; Sumit Saxena; 'hare@suse.com';
>> 'hch@lst.de'
>> Subject: RE: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD
>> after
>> OCR
>>
>>> -----Original Message-----
>>> From: Hannes Reinecke [mailto:hare@suse.de]
>>> Sent: Friday, June 30, 2017 7:00 PM
>>> To: Shivasharan S; 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; hch@lst.de
>>> Subject: Re: [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD
>>> after OCR
>>>
>>> On 06/30/2017 10:29 AM, Shivasharan S wrote:
>>>> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
>>>> Signed-off-by: Shivasharan S
>>>> <shivasharan.srikanteshwara@broadcom.com>
>>>> ---
>>>>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++++++++
>>>>  1 file changed, 9 insertions(+)
>>>>
>>>> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>>>> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>>>> index 0f13c58..a308e14 100644
>>>> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>>>> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>>>> @@ -3618,6 +3618,15 @@ void megasas_refire_mgmt_cmd(struct
>>>> megasas_instance *instance)
>>>>
>>>>  		if (!smid)
>>>>  			continue;
>>>> +
>>>> +		/* Do not refire shutdown command */
>>>> +		if (le32_to_cpu(cmd_mfi->frame->dcmd.opcode) ==
>>>> +			MR_DCMD_CTRL_SHUTDOWN) {
>>>> +			cmd_mfi->frame->dcmd.cmd_status = MFI_STAT_OK;
>>>> +			megasas_complete_cmd(instance, cmd_mfi, DID_OK);
>>>> +			continue;
>>>> +		}
>>>> +
>>>>  		req_desc = megasas_get_request_descriptor
>>>>  					(instance, smid - 1);
>>>>  		refire_cmd = req_desc && ((cmd_mfi->frame->dcmd.opcode !=
>>>>
>>> Please, no.
>>> You already have a selector further down whether to refire the
>>> command, pending on the DRV_DCMD_SKIP_REFIRE flag.
>>> If you always set this flag for the shutdown command you wouldn't need
>>> to touch this at all.
>>> And if you particularly dislike that solution convert the 'refire_cmd ='
>>> statement into a proper switch and blank it out from there.
>>>
>>
>> Hi Hannes,
>> The management commands that get skipped further down in this function are
>> internally generated by the driver itself so we don’t need to complete it
>> back to
>> the application.
>> In case of shutdown DCMD, it’s an IOCTL command(issued by application) so
>> we
>> need to return status back to application.
>> Combining handling of both the cases or using DRV_DCMD_SKIP_REFIRE will
>> not
>> be as straightforward.
>>
>> Thanks,
>> Shivasharan
>>
> Hi Hannes,
> We will implement the switch case approach during our next submission as
> this
> the current code is well tested internally and want to avoid regressions.
> Are you ok if we keep it this way for now?
> 
Yes, sure.

Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

end of thread, other threads:[~2017-07-05 10:34 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30  8:29 [PATCH 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
2017-06-30  8:29 ` [PATCH 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command Shivasharan S
2017-06-30 13:23   ` Hannes Reinecke
2017-06-30  8:29 ` [PATCH 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs Shivasharan S
2017-06-30 13:23   ` Hannes Reinecke
2017-06-30  8:29 ` [PATCH 03/15] megaraid_sas: Use synchronize_irq in target reset case Shivasharan S
2017-06-30 13:24   ` Hannes Reinecke
2017-06-30  8:29 ` [PATCH 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands Shivasharan S
2017-06-30 13:25   ` Hannes Reinecke
2017-07-04  7:05     ` Shivasharan Srikanteshwara
2017-06-30  8:29 ` [PATCH 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR Shivasharan S
2017-06-30 13:30   ` Hannes Reinecke
2017-07-04  7:08     ` Shivasharan Srikanteshwara
2017-07-05 10:33     ` Shivasharan Srikanteshwara
2017-07-05 10:34       ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 06/15] megaraid_sas: Fix endianness issues in DCMD handling Shivasharan S
2017-06-30 13:34   ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic Shivasharan S
2017-06-30 13:35   ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
2017-06-30 13:35   ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
2017-06-30 13:36   ` Hannes Reinecke
2017-06-30 14:30   ` Tomas Henzl
2017-07-03  7:13     ` Shivasharan Srikanteshwara
2017-06-30  8:30 ` [PATCH 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead Shivasharan S
2017-06-30 13:37   ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode Shivasharan S
2017-06-30 13:39   ` Hannes Reinecke
2017-07-04  7:22     ` Shivasharan Srikanteshwara
2017-06-30  8:30 ` [PATCH 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true Shivasharan S
2017-06-30 13:40   ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path Shivasharan S
2017-06-30 13:40   ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size Shivasharan S
2017-06-30 13:41   ` Hannes Reinecke
2017-06-30  8:30 ` [PATCH 15/15] megaraid_sas: driver version upgrade Shivasharan S
2017-06-30 13:41   ` Hannes Reinecke

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.