All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/5] megaraid_sas: TM command refire leads to controller firmware crash
@ 2020-05-08  8:52 Chandrakanth Patil
  2020-05-13  6:19 ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Chandrakanth Patil @ 2020-05-08  8:52 UTC (permalink / raw)
  To: linux-scsi
  Cc: kashyap.desai, sumit.saxena, kiran-kumar.kasturi, sankar.patra,
	sasikumar.pc, shivasharan.srikanteshwara, anand.lodnoor,
	Chandrakanth Patil, stable

Issue: When TM command times-out driver invokes the controller
reset. Post reset, driver re-fires pended TM commands which leads
to firmware crash.

Fix: Post controller reset, return pended TM commands back to OS.

Cc: stable@vger.kernel.org
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 87f91a38..319f241 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -4180,6 +4180,7 @@ static void megasas_refire_mgmt_cmd(struct megasas_instance *instance,
 	struct fusion_context *fusion;
 	struct megasas_cmd *cmd_mfi;
 	union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;
+	struct MPI2_RAID_SCSI_IO_REQUEST *scsi_io_req;
 	u16 smid;
 	bool refire_cmd = false;
 	u8 result;
@@ -4247,6 +4248,11 @@ static void megasas_refire_mgmt_cmd(struct megasas_instance *instance,
 			result = COMPLETE_CMD;
 		}
 
+		scsi_io_req = (struct MPI2_RAID_SCSI_IO_REQUEST *)
+				cmd_fusion->io_request;
+		if (scsi_io_req->Function == MPI2_FUNCTION_SCSI_TASK_MGMT)
+			result = RETURN_CMD;
+
 		switch (result) {
 		case REFIRE_CMD:
 			megasas_fire_cmd_fusion(instance, req_desc);
@@ -4475,7 +4481,6 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
 	if (!timeleft) {
 		dev_err(&instance->pdev->dev,
 			"task mgmt type 0x%x timed out\n", type);
-		cmd_mfi->flags |= DRV_DCMD_SKIP_REFIRE;
 		mutex_unlock(&instance->reset_mutex);
 		rc = megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR);
 		mutex_lock(&instance->reset_mutex);
-- 
2.9.5


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

* Re: [PATCH 4/5] megaraid_sas: TM command refire leads to controller firmware crash
  2020-05-08  8:52 [PATCH 4/5] megaraid_sas: TM command refire leads to controller firmware crash Chandrakanth Patil
@ 2020-05-13  6:19 ` Hannes Reinecke
  2020-05-16  6:56   ` Chandrakanth Patil
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2020-05-13  6:19 UTC (permalink / raw)
  To: Chandrakanth Patil, linux-scsi
  Cc: kashyap.desai, sumit.saxena, kiran-kumar.kasturi, sankar.patra,
	sasikumar.pc, shivasharan.srikanteshwara, anand.lodnoor, stable

On 5/8/20 10:52 AM, Chandrakanth Patil wrote:
> Issue: When TM command times-out driver invokes the controller
> reset. Post reset, driver re-fires pended TM commands which leads
> to firmware crash.
> 
> Fix: Post controller reset, return pended TM commands back to OS.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
> Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
> ---
>   drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 87f91a38..319f241 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -4180,6 +4180,7 @@ static void megasas_refire_mgmt_cmd(struct megasas_instance *instance,
>   	struct fusion_context *fusion;
>   	struct megasas_cmd *cmd_mfi;
>   	union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;
> +	struct MPI2_RAID_SCSI_IO_REQUEST *scsi_io_req;
>   	u16 smid;
>   	bool refire_cmd = false;
>   	u8 result;
> @@ -4247,6 +4248,11 @@ static void megasas_refire_mgmt_cmd(struct megasas_instance *instance,
>   			result = COMPLETE_CMD;
>   		}
>   
> +		scsi_io_req = (struct MPI2_RAID_SCSI_IO_REQUEST *)
> +				cmd_fusion->io_request;
> +		if (scsi_io_req->Function == MPI2_FUNCTION_SCSI_TASK_MGMT)
> +			result = RETURN_CMD;
> +
>   		switch (result) {
>   		case REFIRE_CMD:
>   			megasas_fire_cmd_fusion(instance, req_desc);
> @@ -4475,7 +4481,6 @@ megasas_issue_tm(struct megasas_instance *instance, u16 device_handle,
>   	if (!timeleft) {
>   		dev_err(&instance->pdev->dev,
>   			"task mgmt type 0x%x timed out\n", type);
> -		cmd_mfi->flags |= DRV_DCMD_SKIP_REFIRE;
>   		mutex_unlock(&instance->reset_mutex);
>   		rc = megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR);
>   		mutex_lock(&instance->reset_mutex);
> 
Why didn't the 'DRV_DCMD_SKIP_REFIRE' work?
And if it doesn't work, can't it be removed completely?

Cheers,

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

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

* RE: [PATCH 4/5] megaraid_sas: TM command refire leads to controller firmware crash
  2020-05-13  6:19 ` Hannes Reinecke
@ 2020-05-16  6:56   ` Chandrakanth Patil
  0 siblings, 0 replies; 3+ messages in thread
From: Chandrakanth Patil @ 2020-05-16  6:56 UTC (permalink / raw)
  To: Hannes Reinecke, linux-scsi
  Cc: Kashyap Desai, Sumit Saxena, Kiran Kumar Kasturi, Sankar Patra,
	Sasikumar PC, Shivasharan Srikanteshwara, Anand Lodnoor, stable

> > Issue: When TM command times-out driver invokes the controller reset.
> > Post reset, driver re-fires pended TM commands which leads to firmware
> > crash.
> >
> > Fix: Post controller reset, return pended TM commands back to OS.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
> > Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
> > ---
> >   drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 ++++++-
> >   1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > index 87f91a38..319f241 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > @@ -4180,6 +4180,7 @@ static void megasas_refire_mgmt_cmd(struct
> megasas_instance *instance,
> >   	struct fusion_context *fusion;
> >   	struct megasas_cmd *cmd_mfi;
> >   	union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc;
> > +	struct MPI2_RAID_SCSI_IO_REQUEST *scsi_io_req;
> >   	u16 smid;
> >   	bool refire_cmd = false;
> >   	u8 result;
> > @@ -4247,6 +4248,11 @@ static void megasas_refire_mgmt_cmd(struct
> megasas_instance *instance,
> >   			result = COMPLETE_CMD;
> >   		}
> >
> > +		scsi_io_req = (struct MPI2_RAID_SCSI_IO_REQUEST *)
> > +				cmd_fusion->io_request;
> > +		if (scsi_io_req->Function == MPI2_FUNCTION_SCSI_TASK_MGMT)
> > +			result = RETURN_CMD;
> > +
> >   		switch (result) {
> >   		case REFIRE_CMD:
> >   			megasas_fire_cmd_fusion(instance, req_desc); @@ -4475,7
> +4481,6
> > @@ megasas_issue_tm(struct megasas_instance *instance, u16
> > device_handle,
> >   	if (!timeleft) {
> >   		dev_err(&instance->pdev->dev,
> >   			"task mgmt type 0x%x timed out\n", type);
> > -		cmd_mfi->flags |= DRV_DCMD_SKIP_REFIRE;
> >   		mutex_unlock(&instance->reset_mutex);
> >   		rc = megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR);
> >   		mutex_lock(&instance->reset_mutex);
> >
> Why didn't the 'DRV_DCMD_SKIP_REFIRE' work?
> And if it doesn't work, can't it be removed completely?

Re-fire logic doesn't check  'DRV_DCMD_SKIP_REFIRE'  flag for TM commands
but it will check the flag for DCMDs
Hence, 'DRV_DCMD_SKIP_REFIRE' flag is only removed for TM commands.

-Chandrakanth Patil

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

end of thread, other threads:[~2020-05-16  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08  8:52 [PATCH 4/5] megaraid_sas: TM command refire leads to controller firmware crash Chandrakanth Patil
2020-05-13  6:19 ` Hannes Reinecke
2020-05-16  6:56   ` Chandrakanth Patil

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.