All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/15] megaraid_sas: Updates for scsi-next
@ 2017-07-05 12:00 Shivasharan S
  2017-07-05 12:00 ` [PATCH v2 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; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, kashyap.desai, sumit.saxena, hare,
	hch, Shivasharan S

Changes from v1:
- Patch 4: Updated patch description
- Patch 9: Cleanup ld_drv_map in case ld_map allocation fails

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   |  45 +++++--
 drivers/scsi/megaraid/megaraid_sas_fp.c     |  40 +++----
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 174 ++++++++++++++++++----------
 4 files changed, 163 insertions(+), 101 deletions(-)

-- 
2.8.3

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

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

 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>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
 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 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
 	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);
 }
 
 /**
-- 
1.8.3.1

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

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

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

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
 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))
-- 
1.8.3.1

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

* [PATCH v2 03/15] megaraid_sas: Use synchronize_irq in target reset case
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
  2017-07-05 12:00 ` [PATCH v2 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command Shivasharan S
  2017-07-05 12:00 ` [PATCH v2 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-10 13:50   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 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; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.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 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
 		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 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
 		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);
 
-- 
1.8.3.1

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

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

Fix - megasas_wait_for_outstanding_fusion checks for pending commands every
1second. But megasas_complete_cmd_dpc_fusion is only called every 5seconds.
If the commands are already completed by firmware, there is an additional
delay of 5seconds before driver will process completion for these commands.

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);
 	}
-- 
1.8.3.1

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

* [PATCH v2 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (3 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-10 14:00   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 06/15] megaraid_sas: Fix endianness issues in DCMD handling Shivasharan S
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.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 !=
-- 
1.8.3.1

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

* [PATCH v2 06/15] megaraid_sas: Fix endianness issues in DCMD handling
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (4 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-10 14:05   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic Shivasharan S
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.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 @@ static int megasas_set_crash_dump_params_ioctl(struct megasas_cmd *cmd)
 	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 @@ static int megasas_set_crash_dump_params_ioctl(struct megasas_cmd *cmd)
 	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 @@ static int megasas_set_crash_dump_params_ioctl(struct megasas_cmd *cmd)
 		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;
 	}
 
-- 
1.8.3.1

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

* [PATCH v2 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (5 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 06/15] megaraid_sas: Fix endianness issues in DCMD handling Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-10 14:08   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
 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 @@ static void megasas_release_mfi(struct megasas_instance *instance)
 		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
-- 
1.8.3.1

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

* [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case only
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (6 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-18 11:06   ` Shivasharan Srikanteshwara
  2017-07-18 11:51   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
                   ` (6 subsequent siblings)
  14 siblings, 2 replies; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.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 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
 	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 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
 	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 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
 	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 {
-- 
1.8.3.1

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

* [PATCH v2 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (7 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-10 13:44   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 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, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/megaraid/megaraid_sas.h        |   1 -
 drivers/scsi/megaraid/megaraid_sas_base.c   |  12 ++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 121 ++++++++++++++++++----------
 3 files changed, 88 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..ff4a3a8 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1257,6 +1257,80 @@ static int megasas_create_sg_sense_fusion(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);
+				goto ld_drv_map_alloc_fail;
+			}
+		}
+	}
+
+	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__);
+			goto ld_map_alloc_fail;
+		}
+	}
+
+	return 0;
+
+ld_map_alloc_fail:
+	for (i = 0; i < 2; i++) {
+		if (fusion->ld_map[i])
+			dma_free_coherent(&instance->pdev->dev,
+					  fusion->max_map_sz,
+					  fusion->ld_map[i],
+					  fusion->ld_map_phys[i]);
+	}
+
+ld_drv_map_alloc_fail:
+	for (i = 0; i < 2; i++) {
+		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);
+		}
+	}
+
+	return -ENOMEM;
+}
+
+/**
  * megasas_init_adapter_fusion -	Initializes the FW
  * @instance:		Adapter soft state
  *
@@ -1375,45 +1449,14 @@ static int megasas_create_sg_sense_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 +3408,13 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
 {
 	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 +3426,10 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
 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;
-- 
1.8.3.1

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

* [PATCH v2 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (8 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-11 13:42   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 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; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index c63ef88..1d5ca5e 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 {
-- 
1.8.3.1

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

* [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (9 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-11 13:57   ` Tomas Henzl
  2017-07-11 13:58   ` Christoph Hellwig
  2017-07-05 12:00 ` [PATCH v2 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true Shivasharan S
                   ` (3 subsequent siblings)
  14 siblings, 2 replies; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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 1d5ca5e..c13b605 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);
 
 }
 
@@ -5915,6 +5916,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
 	 */
-- 
1.8.3.1

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

* [PATCH v2 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (10 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-11 13:57   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path Shivasharan S
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.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 @@
 #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 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 	 */
 	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 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 				"rowDataSize = 0x%0x,"
 				"but there is _NO_ UnevenSpanSupport\n",
 				MR_LdSpanPtrGet(ld, 0, map)->spanRowDataSize);
-			return FALSE;
+			return false;
 		}
 	}
 
@@ -988,7 +978,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 			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 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 				(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 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 					       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 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 					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 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
 				    start_strip + stripIdx, ref_in_start_stripe,
 				    io_info, pRAID_Context, map);
 			if (!retval)
-				return TRUE;
+				return true;
 		}
 	}
-	return TRUE;
+	return true;
 }
 
 /*
-- 
1.8.3.1

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

* [PATCH v2 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (11 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-11 14:07   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size Shivasharan S
  2017-07-05 12:00 ` [PATCH v2 15/15] megaraid_sas: driver version upgrade Shivasharan S
  14 siblings, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index ff4a3a8..dc4aada 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -910,7 +910,6 @@ static int megasas_create_sg_sense_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 @@ static int megasas_create_sg_sense_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;
 }
 
@@ -4308,9 +4311,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
@@ -4356,6 +4356,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))
@@ -4367,11 +4371,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,
@@ -4381,6 +4380,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:
-- 
1.8.3.1

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

* [PATCH v2 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (12 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-11 14:08   ` Tomas Henzl
  2017-07-05 12:00 ` [PATCH v2 15/15] megaraid_sas: driver version upgrade Shivasharan S
  14 siblings, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.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 c13b605..d760023 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -2796,7 +2796,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
-- 
1.8.3.1

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

* [PATCH v2 15/15] megaraid_sas: driver version upgrade
  2017-07-05 12:00 [PATCH v2 00/15] megaraid_sas: Updates for scsi-next Shivasharan S
                   ` (13 preceding siblings ...)
  2017-07-05 12:00 ` [PATCH v2 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size Shivasharan S
@ 2017-07-05 12:00 ` Shivasharan S
  2017-07-11 14:09   ` Tomas Henzl
  14 siblings, 1 reply; 41+ messages in thread
From: Shivasharan S @ 2017-07-05 12:00 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>
Reviewed-by: Hannes Reinecke <hare@suse.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
-- 
1.8.3.1

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

* Re: [PATCH v2 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
  2017-07-05 12:00 ` [PATCH v2 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map Shivasharan S
@ 2017-07-10 13:44   ` Tomas Henzl
  2017-07-11 10:49     ` Shivasharan Srikanteshwara
  0 siblings, 1 reply; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 13:44 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas.h        |   1 -
>  drivers/scsi/megaraid/megaraid_sas_base.c   |  12 ++-
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 121 ++++++++++++++++++----------
>  3 files changed, 88 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..ff4a3a8 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -1257,6 +1257,80 @@ static int megasas_create_sg_sense_fusion(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;

Hi, does this assignment^ mean, that you need a fusion->ld_drv_map[0;1] = NULL setting
before this for cycle as well or is it just superfluos ?
 

> +
> +		fusion->ld_drv_map[i] = (void *)
> +			__get_free_pages(__GFP_ZERO | GFP_KERNEL,
> +					 fusion->drv_map_pages);

The subject says - 'use vmalloc for ... and driver's local RAID map'
in the code here you use vmalloc only if __get_free_pages fails
is this intended ? (maybe an explanation in the mail body would be nice) 

tomash

> +
> +		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);
> +				goto ld_drv_map_alloc_fail;
> +			}
> +		}
> +	}
> +
> +	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__);
> +			goto ld_map_alloc_fail;
> +		}
> +	}
> +
> +	return 0;
> +
> +ld_map_alloc_fail:
> +	for (i = 0; i < 2; i++) {
> +		if (fusion->ld_map[i])
> +			dma_free_coherent(&instance->pdev->dev,
> +					  fusion->max_map_sz,
> +					  fusion->ld_map[i],
> +					  fusion->ld_map_phys[i]);
> +	}
> +
> +ld_drv_map_alloc_fail:
> +	for (i = 0; i < 2; i++) {
> +		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);
> +		}
> +	}
> +
> +	return -ENOMEM;
> +}
> +
> +/**
>   * megasas_init_adapter_fusion -	Initializes the FW
>   * @instance:		Adapter soft state
>   *
> @@ -1375,45 +1449,14 @@ static int megasas_create_sg_sense_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 +3408,13 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
>  {
>  	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 +3426,10 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
>  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] 41+ messages in thread

* Re: [PATCH v2 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command
  2017-07-05 12:00 ` [PATCH v2 01/15] megaraid_sas: mismatch of allocated MFI frame size and length exposed in MFI MPT pass through command Shivasharan S
@ 2017-07-10 13:46   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 13:46 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, 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>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

> ---
>  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 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
>  	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);
>  }
>  
>  /**

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

* Re: [PATCH v2 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs
  2017-07-05 12:00 ` [PATCH v2 02/15] megaraid_sas: set minimum value of resetwaittime to be 1 secs Shivasharan S
@ 2017-07-10 13:47   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 13:47 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Setting resetwaittime to 0 during a FW fault will result in driver
> not calling the OCR.
>
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 03/15] megaraid_sas: Use synchronize_irq in target reset case
  2017-07-05 12:00 ` [PATCH v2 03/15] megaraid_sas: Use synchronize_irq in target reset case Shivasharan S
@ 2017-07-10 13:50   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 13:50 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, 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>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands
  2017-07-05 12:00 ` [PATCH v2 04/15] megaraid_sas: Call megasas_complete_cmd_dpc_fusion every 1 second while there are pending commands Shivasharan S
@ 2017-07-10 13:51   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 13:51 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Fix - megasas_wait_for_outstanding_fusion checks for pending commands every
> 1second. But megasas_complete_cmd_dpc_fusion is only called every 5seconds.
> If the commands are already completed by firmware, there is an additional
> delay of 5seconds before driver will process completion for these commands.
>
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR
  2017-07-05 12:00 ` [PATCH v2 05/15] megaraid_sas: Do not re-fire shutdown DCMD after OCR Shivasharan S
@ 2017-07-10 14:00   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 14:00 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 06/15] megaraid_sas: Fix endianness issues in DCMD handling
  2017-07-05 12:00 ` [PATCH v2 06/15] megaraid_sas: Fix endianness issues in DCMD handling Shivasharan S
@ 2017-07-10 14:05   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 14:05 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic
  2017-07-05 12:00 ` [PATCH v2 07/15] megaraid_sas: Check valid aen class range to avoid kernel panic Shivasharan S
@ 2017-07-10 14:08   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-10 14:08 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* RE: [PATCH v2 09/15] megaraid_sas: use vmalloc for crash dump buffers and driver's local RAID map
  2017-07-10 13:44   ` Tomas Henzl
@ 2017-07-11 10:49     ` Shivasharan Srikanteshwara
  2017-07-11 13:21       ` Tomas Henzl
  0 siblings, 1 reply; 41+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-11 10:49 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: Monday, July 10, 2017 7:15 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 v2 09/15] megaraid_sas: use vmalloc for crash dump
> buffers and driver's local RAID map
>
> On 5.7.2017 14:00, Shivasharan S wrote:
> > Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> > Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> > Reviewed-by: Hannes Reinecke <hare@suse.com>
> > ---
> >  drivers/scsi/megaraid/megaraid_sas.h        |   1 -
> >  drivers/scsi/megaraid/megaraid_sas_base.c   |  12 ++-
> >  drivers/scsi/megaraid/megaraid_sas_fusion.c | 121
> > ++++++++++++++++++----------
> >  3 files changed, 88 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..ff4a3a8 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > @@ -1257,6 +1257,80 @@ static int
> > megasas_create_sg_sense_fusion(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;
>
> Hi, does this assignment^ mean, that you need a fusion->ld_drv_map[0;1] =
> NULL setting before this for cycle as well or is it just superfluos ?
>
Hi Tomas,
Initializing ld_map[i] = NULL is not necessary but that got carried over
from
earlier code. We do not need to set fusion->ld_drv_map[0:1] to NULL here as
fusion_context is memset to zero during allocation.

>
> > +
> > +		fusion->ld_drv_map[i] = (void *)
> > +			__get_free_pages(__GFP_ZERO | GFP_KERNEL,
> > +					 fusion->drv_map_pages);
>
> The subject says - 'use vmalloc for ... and driver's local RAID map'
> in the code here you use vmalloc only if __get_free_pages fails is this
> intended ?
> (maybe an explanation in the mail body would be nice)
>
> tomash
>
I will send out v3 of the series with a more detailed commit description.
The use of __get_free_pages first for driver's local RAID map is intentional
as this
structure is frequently accessed. But we do not want to fail device probe
due
to unavailability of contiguous memory.

Thanks,
Shivasharan

> > +
> > +		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);
> > +				goto ld_drv_map_alloc_fail;
> > +			}
> > +		}
> > +	}
> > +
> > +	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__);
> > +			goto ld_map_alloc_fail;
> > +		}
> > +	}
> > +
> > +	return 0;
> > +
> > +ld_map_alloc_fail:
> > +	for (i = 0; i < 2; i++) {
> > +		if (fusion->ld_map[i])
> > +			dma_free_coherent(&instance->pdev->dev,
> > +					  fusion->max_map_sz,
> > +					  fusion->ld_map[i],
> > +					  fusion->ld_map_phys[i]);
> > +	}
> > +
> > +ld_drv_map_alloc_fail:
> > +	for (i = 0; i < 2; i++) {
> > +		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);
> > +		}
> > +	}
> > +
> > +	return -ENOMEM;
> > +}
> > +
> > +/**
> >   * megasas_init_adapter_fusion -	Initializes the FW
> >   * @instance:		Adapter soft state
> >   *
> > @@ -1375,45 +1449,14 @@ static int
> megasas_create_sg_sense_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 +3408,13 @@ irqreturn_t megasas_isr_fusion(int irq, void
> > *devp)  {
> >  	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 +3426,10 @@ irqreturn_t megasas_isr_fusion(int irq, void
> > *devp)  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] 41+ messages in thread

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

On 11.7.2017 12:49, Shivasharan Srikanteshwara wrote:
>> -----Original Message-----
>> From: Tomas Henzl [mailto:thenzl@redhat.com]
>> Sent: Monday, July 10, 2017 7:15 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 v2 09/15] megaraid_sas: use vmalloc for crash dump
>> buffers and driver's local RAID map
>>
>> On 5.7.2017 14:00, Shivasharan S wrote:
>>> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
>>> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
>>> Reviewed-by: Hannes Reinecke <hare@suse.com>
>>> ---
>>>  drivers/scsi/megaraid/megaraid_sas.h        |   1 -
>>>  drivers/scsi/megaraid/megaraid_sas_base.c   |  12 ++-
>>>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 121
>>> ++++++++++++++++++----------
>>>  3 files changed, 88 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..ff4a3a8 100644
>>> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>>> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>>> @@ -1257,6 +1257,80 @@ static int
>>> megasas_create_sg_sense_fusion(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;
>> Hi, does this assignment^ mean, that you need a fusion->ld_drv_map[0;1] =
>> NULL setting before this for cycle as well or is it just superfluos ?
>>
> Hi Tomas,
> Initializing ld_map[i] = NULL is not necessary but that got carried over
> from
> earlier code. We do not need to set fusion->ld_drv_map[0:1] to NULL here as
> fusion_context is memset to zero during allocation.
>
>>> +
>>> +		fusion->ld_drv_map[i] = (void *)
>>> +			__get_free_pages(__GFP_ZERO | GFP_KERNEL,
>>> +					 fusion->drv_map_pages);
>> The subject says - 'use vmalloc for ... and driver's local RAID map'
>> in the code here you use vmalloc only if __get_free_pages fails is this
>> intended ?
>> (maybe an explanation in the mail body would be nice)
>>
>> tomash
>>
> I will send out v3 of the series with a more detailed commit description.
> The use of __get_free_pages first for driver's local RAID map is intentional
> as this
> structure is frequently accessed. But we do not want to fail device probe
> due
> to unavailability of contiguous memory.

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead
  2017-07-05 12:00 ` [PATCH v2 10/15] megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in case adapter is dead Shivasharan S
@ 2017-07-11 13:42   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-11 13:42 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch, stable

On 5.7.2017 14:00, 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
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-05 12:00 ` [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode Shivasharan S
@ 2017-07-11 13:57   ` Tomas Henzl
  2017-07-11 13:58   ` Christoph Hellwig
  1 sibling, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-11 13:57 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, 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>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true
  2017-07-05 12:00 ` [PATCH v2 12/15] megaraid_sas: replace internal FALSE/TRUE definitions with false/true Shivasharan S
@ 2017-07-11 13:57   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-11 13:57 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-05 12:00 ` [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode Shivasharan S
  2017-07-11 13:57   ` Tomas Henzl
@ 2017-07-11 13:58   ` Christoph Hellwig
  2017-07-11 15:47     ` Kashyap Desai
  1 sibling, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2017-07-11 13:58 UTC (permalink / raw)
  To: Shivasharan S
  Cc: linux-scsi, martin.petersen, thenzl, jejb, kashyap.desai,
	sumit.saxena, hare, hch

On Wed, Jul 05, 2017 at 05:00:25AM -0700, 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.

Please no scsi-mq specifics.  just do this unconditionally.

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

* Re: [PATCH v2 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path
  2017-07-05 12:00 ` [PATCH v2 13/15] megaraid_sas: modified few prints in OCR and IOC INIT path Shivasharan S
@ 2017-07-11 14:07   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-11 14:07 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size
  2017-07-05 12:00 ` [PATCH v2 14/15] megaraid_sas: call megasas_dump_frame with correct IO frame size Shivasharan S
@ 2017-07-11 14:08   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-11 14:08 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* Re: [PATCH v2 15/15] megaraid_sas: driver version upgrade
  2017-07-05 12:00 ` [PATCH v2 15/15] megaraid_sas: driver version upgrade Shivasharan S
@ 2017-07-11 14:09   ` Tomas Henzl
  0 siblings, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-11 14:09 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, Shivasharan S wrote:
> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash

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

* RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-11 13:58   ` Christoph Hellwig
@ 2017-07-11 15:47     ` Kashyap Desai
  2017-07-12  8:21       ` Shivasharan Srikanteshwara
  2017-07-19  8:42       ` Shivasharan Srikanteshwara
  0 siblings, 2 replies; 41+ messages in thread
From: Kashyap Desai @ 2017-07-11 15:47 UTC (permalink / raw)
  To: Christoph Hellwig, Shivasharan Srikanteshwara
  Cc: linux-scsi, martin.petersen, thenzl, jejb, Sumit Saxena, hare

> -----Original Message-----
> From: Christoph Hellwig [mailto:hch@lst.de]
> Sent: Tuesday, July 11, 2017 7:28 PM
> To: Shivasharan S
> Cc: linux-scsi@vger.kernel.org; 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 v2 11/15] megaraid_sas: Set device queue_depth same
as
> HBA can_queue value in scsi-mq mode
>
> On Wed, Jul 05, 2017 at 05:00:25AM -0700, 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.
>
> Please no scsi-mq specifics.  just do this unconditionally.

Chris -  Intent for mq specific check is mainly because of sequential work
load for HDD is having penalty due to mq scheduler issue.
We did this exercise prior to mq-deadline support.

Making generic change for non-mq and mq was good, but we may see some user
may not like to see regression.
E.a In case of, QD = 32 for SATA PD file system creation may be faster
compare to large QD. There may be a soft merger at block layer due to
queue depth throttling. Eventually, FS creation goes fast due to IO
merges, but same will not be true if we change queue depth logic (means,
increase device queue depth to HBA QD.)

We have choice to completely remove this patch and ask users to do sysfs
settings in case of scsi-mq performance issue for HDD sequential work
load.
Having this patch, we want to provide better QD settings as default from
driver.


Thanks, Kashyap

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

* RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-11 15:47     ` Kashyap Desai
@ 2017-07-12  8:21       ` Shivasharan Srikanteshwara
  2017-07-19  8:42       ` Shivasharan Srikanteshwara
  1 sibling, 0 replies; 41+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-12  8:21 UTC (permalink / raw)
  To: Kashyap Desai, Christoph Hellwig
  Cc: linux-scsi, martin.petersen, thenzl, jejb, Sumit Saxena, hare

> -----Original Message-----
> From: Kashyap Desai [mailto:kashyap.desai@broadcom.com]
> Sent: Tuesday, July 11, 2017 9:18 PM
> To: Christoph Hellwig; Shivasharan Srikanteshwara
> Cc: linux-scsi@vger.kernel.org; martin.petersen@oracle.com;
> thenzl@redhat.com; jejb@linux.vnet.ibm.com; Sumit Saxena; hare@suse.com
> Subject: RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as
> HBA can_queue value in scsi-mq mode
>
> > -----Original Message-----
> > From: Christoph Hellwig [mailto:hch@lst.de]
> > Sent: Tuesday, July 11, 2017 7:28 PM
> > To: Shivasharan S
> > Cc: linux-scsi@vger.kernel.org; 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 v2 11/15] megaraid_sas: Set device queue_depth
> > same
> as
> > HBA can_queue value in scsi-mq mode
> >
> > On Wed, Jul 05, 2017 at 05:00:25AM -0700, 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.
> >
> > Please no scsi-mq specifics.  just do this unconditionally.
>
> Chris -  Intent for mq specific check is mainly because of sequential work
> load
> for HDD is having penalty due to mq scheduler issue.
> We did this exercise prior to mq-deadline support.
>
> Making generic change for non-mq and mq was good, but we may see some
> user may not like to see regression.
> E.a In case of, QD = 32 for SATA PD file system creation may be faster
> compare
> to large QD. There may be a soft merger at block layer due to queue depth
> throttling. Eventually, FS creation goes fast due to IO merges, but same
> will not
> be true if we change queue depth logic (means, increase device queue depth
> to
> HBA QD.)
>
> We have choice to completely remove this patch and ask users to do sysfs
> settings in case of scsi-mq performance issue for HDD sequential work
> load.
> Having this patch, we want to provide better QD settings as default from
> driver.
>
>
> Thanks, Kashyap

Hi Christoph,
As Kashyap mentioned, the performance issues seen were specific to scsi-mq
enabled case when running sequential workloads with HDDs.
Making this generic might result in regressions in some scenarios for
non-mq.
That was the idea behind making the change specific to scsi-mq only.

Let us know if you are ok with having this as is or we could remove
this patch completely and have users manually tune queue depth settings if
they
are seeing performance issues with scsi-mq enabled.

Thanks,
Shivasharan

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

* RE: [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case only
  2017-07-05 12:00 ` [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
@ 2017-07-18 11:06   ` Shivasharan Srikanteshwara
  2017-07-18 11:51   ` Tomas Henzl
  1 sibling, 0 replies; 41+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-18 11:06 UTC (permalink / raw)
  To: linux-scsi
  Cc: martin.petersen, thenzl, jejb, Kashyap Desai, Sumit Saxena, hare, hch

> -----Original Message-----
> From: Shivasharan S [mailto:shivasharan.srikanteshwara@broadcom.com]
> Sent: Wednesday, July 05, 2017 5:30 PM
> To: linux-scsi@vger.kernel.org
> Cc: martin.petersen@oracle.com; thenzl@redhat.com;
> jejb@linux.vnet.ibm.com; kashyap.desai@broadcom.com;
> sumit.saxena@broadcom.com; hare@suse.com; hch@lst.de; Shivasharan S
> Subject: [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case
only
>
> 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>
> Reviewed-by: Hannes Reinecke <hare@suse.com>

Hi Tomas,
Looks like this one patch got missed during your review.
Can you please review if the changes in this patch are fine?

Thanks,
Shivasharan

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

* Re: [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case only
  2017-07-05 12:00 ` [PATCH v2 08/15] megaraid_sas: Use SMID for Task abort case only Shivasharan S
  2017-07-18 11:06   ` Shivasharan Srikanteshwara
@ 2017-07-18 11:51   ` Tomas Henzl
  1 sibling, 0 replies; 41+ messages in thread
From: Tomas Henzl @ 2017-07-18 11:51 UTC (permalink / raw)
  To: Shivasharan S, linux-scsi
  Cc: martin.petersen, jejb, kashyap.desai, sumit.saxena, hare, hch

On 5.7.2017 14:00, 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>
> Reviewed-by: Hannes Reinecke <hare@suse.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 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
>  	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;

This^ change seems to be needless,
but not important.

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

tomash


>  	struct megasas_cmd_fusion *scsi_lookup;
>  	int rc;
>  	struct MPI2_SCSI_TASK_MANAGE_REPLY *mpi_reply;
> @@ -3781,8 +3781,6 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
>  	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 @@ static int megasas_track_scsiio(struct megasas_instance *instance,
>  	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 {

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

* RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-11 15:47     ` Kashyap Desai
  2017-07-12  8:21       ` Shivasharan Srikanteshwara
@ 2017-07-19  8:42       ` Shivasharan Srikanteshwara
  2017-07-20  7:47         ` Christoph Hellwig
  1 sibling, 1 reply; 41+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-19  8:42 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, martin.petersen, thenzl, jejb, Sumit Saxena, hare,
	Kashyap Desai

> -----Original Message-----
> From: Shivasharan Srikanteshwara
> [mailto:shivasharan.srikanteshwara@broadcom.com]
> Sent: Wednesday, July 12, 2017 1:51 PM
> To: Kashyap Desai; 'Christoph Hellwig'
> Cc: 'linux-scsi@vger.kernel.org'; 'martin.petersen@oracle.com';
> 'thenzl@redhat.com'; 'jejb@linux.vnet.ibm.com'; Sumit Saxena;
> 'hare@suse.com'
> Subject: RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as
> HBA can_queue value in scsi-mq mode
>
> > -----Original Message-----
> > From: Kashyap Desai [mailto:kashyap.desai@broadcom.com]
> > Sent: Tuesday, July 11, 2017 9:18 PM
> > To: Christoph Hellwig; Shivasharan Srikanteshwara
> > Cc: linux-scsi@vger.kernel.org; martin.petersen@oracle.com;
> > thenzl@redhat.com; jejb@linux.vnet.ibm.com; Sumit Saxena; hare@suse.com
> > Subject: RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same
> > as
> > HBA can_queue value in scsi-mq mode
> >
> > > -----Original Message-----
> > > From: Christoph Hellwig [mailto:hch@lst.de]
> > > Sent: Tuesday, July 11, 2017 7:28 PM
> > > To: Shivasharan S
> > > Cc: linux-scsi@vger.kernel.org; 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 v2 11/15] megaraid_sas: Set device queue_depth
> > > same
> > as
> > > HBA can_queue value in scsi-mq mode
> > >
> > > On Wed, Jul 05, 2017 at 05:00:25AM -0700, 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.
> > >
> > > Please no scsi-mq specifics.  just do this unconditionally.
> >
> > Chris -  Intent for mq specific check is mainly because of sequential
> > work load
> > for HDD is having penalty due to mq scheduler issue.
> > We did this exercise prior to mq-deadline support.
> >
> > Making generic change for non-mq and mq was good, but we may see some
> > user may not like to see regression.
> > E.a In case of, QD = 32 for SATA PD file system creation may be faster
> compare
> > to large QD. There may be a soft merger at block layer due to queue
> > depth
> > throttling. Eventually, FS creation goes fast due to IO merges, but same
> > will
> not
> > be true if we change queue depth logic (means, increase device queue
> > depth
> to
> > HBA QD.)
> >
> > We have choice to completely remove this patch and ask users to do sysfs
> > settings in case of scsi-mq performance issue for HDD sequential work
> > load.
> > Having this patch, we want to provide better QD settings as default from
> driver.
> >
> >
> > Thanks, Kashyap
>
> Hi Christoph,
> As Kashyap mentioned, the performance issues seen were specific to scsi-mq
> enabled case when running sequential workloads with HDDs.
> Making this generic might result in regressions in some scenarios for
> non-mq.
> That was the idea behind making the change specific to scsi-mq only.
>
> Let us know if you are ok with having this as is or we could remove
> this patch completely and have users manually tune queue depth settings if
> they
> are seeing performance issues with scsi-mq enabled.
>
> Thanks,
> Shivasharan

Hi Christoph,
Can you please let us know your thoughts on this patch?
Are we good to keep the changes as is?

Thanks,
Shivasharan

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

* Re: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-19  8:42       ` Shivasharan Srikanteshwara
@ 2017-07-20  7:47         ` Christoph Hellwig
  2017-07-24 11:29           ` Shivasharan Srikanteshwara
  2017-08-01 13:23           ` Shivasharan Srikanteshwara
  0 siblings, 2 replies; 41+ messages in thread
From: Christoph Hellwig @ 2017-07-20  7:47 UTC (permalink / raw)
  To: Shivasharan Srikanteshwara
  Cc: Christoph Hellwig, linux-scsi, martin.petersen, thenzl, jejb,
	Sumit Saxena, hare, Kashyap Desai

I still don't understand why you don't want to do the same for
the non-mq path.

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

* RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-20  7:47         ` Christoph Hellwig
@ 2017-07-24 11:29           ` Shivasharan Srikanteshwara
  2017-08-01 13:23           ` Shivasharan Srikanteshwara
  1 sibling, 0 replies; 41+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-07-24 11:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, martin.petersen, thenzl, jejb, Sumit Saxena, hare,
	Kashyap Desai

> -----Original Message-----
> From: Christoph Hellwig [mailto:hch@lst.de]
> Sent: Thursday, July 20, 2017 1:18 PM
> To: Shivasharan Srikanteshwara
> Cc: Christoph Hellwig; linux-scsi@vger.kernel.org;
martin.petersen@oracle.com;
> thenzl@redhat.com; jejb@linux.vnet.ibm.com; Sumit Saxena; hare@suse.com;
> Kashyap Desai
> Subject: Re: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same
as
> HBA can_queue value in scsi-mq mode
>
> I still don't understand why you don't want to do the same for the
non-mq path.

Hi Christoph,

Sorry for delay in response.

MQ case -
If there is any block layer requeue happens, we see performance drop. So
we avoid re-queue increasing Device QD = HBA QD. Performance drop due to
block layer re-queue is more in case of HDD (sequential IO converted into
random IO).

Non-MQ case.
If we increase Device QD = HBA QD for no-mq case, we see performance drop
for certain profiles.
For example SATA SSD, previous driver in non-mq set Device QD=32. In this
case, if we have more outstanding IO per device (more than 32), block
layer attempts soft merge and eventually end user experience higher
performance due to block layer attempting soft merge.  Same is not correct
in MQ case, as IO scheduler in MQ adds overhead if at all there is any
throttling or staging due to device QD.

Below is example of single SATA SSD, Sequential Read, BS=4K, IO depth =
256

MQ enable, Device QD = 32 achieves 137K IOPS
MQ enable, Device QD = 916 (HBA QD) achieves 145K IOPS

MQ disable, Device QD = 32 achieves 237K IOPS
MQ disable, Device QD = 916 (HBA QD) achieves 145K IOPS

Ideally we want to keep same QD settings in non-MQ mode, but trying to
avoid as we may face some regression from end user as explained.

Thanks,
Shivasharan

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

* RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same as HBA can_queue value in scsi-mq mode
  2017-07-20  7:47         ` Christoph Hellwig
  2017-07-24 11:29           ` Shivasharan Srikanteshwara
@ 2017-08-01 13:23           ` Shivasharan Srikanteshwara
  1 sibling, 0 replies; 41+ messages in thread
From: Shivasharan Srikanteshwara @ 2017-08-01 13:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, martin.petersen, thenzl, jejb, Sumit Saxena, hare,
	Kashyap Desai

> -----Original Message-----
> From: Shivasharan Srikanteshwara
> [mailto:shivasharan.srikanteshwara@broadcom.com]
> Sent: Monday, July 24, 2017 4:59 PM
> To: 'Christoph Hellwig'
> Cc: 'linux-scsi@vger.kernel.org'; 'martin.petersen@oracle.com';
> 'thenzl@redhat.com'; 'jejb@linux.vnet.ibm.com'; Sumit Saxena;
> 'hare@suse.com'; Kashyap Desai
> Subject: RE: [PATCH v2 11/15] megaraid_sas: Set device queue_depth same
as
> HBA can_queue value in scsi-mq mode
>
> > -----Original Message-----
> > From: Christoph Hellwig [mailto:hch@lst.de]
> > Sent: Thursday, July 20, 2017 1:18 PM
> > To: Shivasharan Srikanteshwara
> > Cc: Christoph Hellwig; linux-scsi@vger.kernel.org;
> > martin.petersen@oracle.com; thenzl@redhat.com;
> > jejb@linux.vnet.ibm.com; Sumit Saxena; hare@suse.com; Kashyap Desai
> > Subject: Re: [PATCH v2 11/15] megaraid_sas: Set device queue_depth
> > same as HBA can_queue value in scsi-mq mode
> >
> > I still don't understand why you don't want to do the same for the
non-mq
> path.
>
> Hi Christoph,
>
> Sorry for delay in response.
>
> MQ case -
> If there is any block layer requeue happens, we see performance drop. So
we
> avoid re-queue increasing Device QD = HBA QD. Performance drop due to
block
> layer re-queue is more in case of HDD (sequential IO converted into
random IO).
>
> Non-MQ case.
> If we increase Device QD = HBA QD for no-mq case, we see performance
drop
> for certain profiles.
> For example SATA SSD, previous driver in non-mq set Device QD=32. In
this case,
> if we have more outstanding IO per device (more than 32), block layer
attempts
> soft merge and eventually end user experience higher performance due to
block
> layer attempting soft merge.  Same is not correct in MQ case, as IO
scheduler in
> MQ adds overhead if at all there is any throttling or staging due to
device QD.
>
> Below is example of single SATA SSD, Sequential Read, BS=4K, IO depth =
256
>
> MQ enable, Device QD = 32 achieves 137K IOPS MQ enable, Device QD = 916
> (HBA QD) achieves 145K IOPS
>
> MQ disable, Device QD = 32 achieves 237K IOPS MQ disable, Device QD =
916
> (HBA QD) achieves 145K IOPS
>
> Ideally we want to keep same QD settings in non-MQ mode, but trying to
avoid
> as we may face some regression from end user as explained.
>
> Thanks,
> Shivasharan

Hi Christoph,
Can you please let us know your thoughts on this?
We understand that the settings should ideally be uniform across non-mq
and mq cases.
But based on the test results above, for non-mq case we are seeing some
difference in performance for certain IO profiles when compared to earlier
releases after increasing queue depth. Same is not the case when mq is
enabled.

Based on these results, we would like to keep this patch as is for this
phase.
We will run the further tests on this and will update for the next phase.

Thanks,
Shivasharan

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

end of thread, other threads:[~2017-08-01 13:23 UTC | newest]

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

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.