public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] mpi3mr: Bug fixes
@ 2023-11-26  5:31 Chandrakanth patil
  2023-11-26  5:31 ` [PATCH 1/4] mpi3mr: Refresh sdev queue depth after controller reset Chandrakanth patil
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Chandrakanth patil @ 2023-11-26  5:31 UTC (permalink / raw)
  To: linux-scsi, sathya.prakash, sumit.saxena, ranjan.kumar,
	prayas.patel
  Cc: Chandrakanth patil

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

This patchset contains critical bug fixes

Chandrakanth patil (4):
  mpi3mr: Refresh sdev queue depth after controller reset
  mpi3mr: Cleanup block devices post controller reset
  mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable
    State
  mpi3mr: Fetch correct device dev handle for status reply descriptor

 drivers/scsi/mpi3mr/mpi3mr_app.c | 16 ++++++++++++++++
 drivers/scsi/mpi3mr/mpi3mr_os.c  | 20 ++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

-- 
2.39.3


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

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

* [PATCH 1/4] mpi3mr: Refresh sdev queue depth after controller reset
  2023-11-26  5:31 [PATCH 0/4] mpi3mr: Bug fixes Chandrakanth patil
@ 2023-11-26  5:31 ` Chandrakanth patil
  2023-11-26  5:31 ` [PATCH 2/4] mpi3mr: Cleanup block devices post " Chandrakanth patil
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Chandrakanth patil @ 2023-11-26  5:31 UTC (permalink / raw)
  To: linux-scsi, sathya.prakash, sumit.saxena, ranjan.kumar,
	prayas.patel
  Cc: Chandrakanth patil, stable

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

After a controller reset, the firmware may modify the device queue depth.
Therefore, update the device queue depth accordingly.

Cc: <stable@vger.kernel.org> # v5.15+
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Chandrakanth patil <chandrakanth.patil@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 91a22e6e5c3f..561fe0857bc0 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -1070,8 +1070,14 @@ void mpi3mr_rfresh_tgtdevs(struct mpi3mr_ioc *mrioc)
 	tgtdev = NULL;
 	list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) {
 		if ((tgtdev->dev_handle != MPI3MR_INVALID_DEV_HANDLE) &&
-		    !tgtdev->is_hidden && !tgtdev->host_exposed)
-			mpi3mr_report_tgtdev_to_host(mrioc, tgtdev->perst_id);
+		    !tgtdev->is_hidden) {
+			if (!tgtdev->host_exposed)
+				mpi3mr_report_tgtdev_to_host(mrioc,
+							     tgtdev->perst_id);
+			else if (tgtdev->starget)
+				starget_for_each_device(tgtdev->starget,
+							(void *)tgtdev, mpi3mr_update_sdev);
+	}
 	}
 }
 
-- 
2.39.3


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

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

* [PATCH 2/4] mpi3mr: Cleanup block devices post controller reset
  2023-11-26  5:31 [PATCH 0/4] mpi3mr: Bug fixes Chandrakanth patil
  2023-11-26  5:31 ` [PATCH 1/4] mpi3mr: Refresh sdev queue depth after controller reset Chandrakanth patil
@ 2023-11-26  5:31 ` Chandrakanth patil
  2023-11-26  5:31 ` [PATCH 3/4] mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State Chandrakanth patil
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Chandrakanth patil @ 2023-11-26  5:31 UTC (permalink / raw)
  To: linux-scsi, sathya.prakash, sumit.saxena, ranjan.kumar,
	prayas.patel
  Cc: Chandrakanth patil, stable

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

After a controller reset, if the firmware changes the state of devices
to "hide," then remove those devices from the OS.

Cc: <stable@vger.kernel.org> # v6.6+
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Chandrakanth patil <chandrakanth.patil@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 561fe0857bc0..872d4b809d08 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -1047,8 +1047,9 @@ void mpi3mr_rfresh_tgtdevs(struct mpi3mr_ioc *mrioc)
 	list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list,
 	    list) {
 		if ((tgtdev->dev_handle == MPI3MR_INVALID_DEV_HANDLE) &&
-		    tgtdev->host_exposed && tgtdev->starget &&
-		    tgtdev->starget->hostdata) {
+		     tgtdev->is_hidden &&
+		     tgtdev->host_exposed && tgtdev->starget &&
+		     tgtdev->starget->hostdata) {
 			tgt_priv = tgtdev->starget->hostdata;
 			tgt_priv->dev_removed = 1;
 			atomic_set(&tgt_priv->block_io, 0);
@@ -1064,6 +1065,10 @@ void mpi3mr_rfresh_tgtdevs(struct mpi3mr_ioc *mrioc)
 				mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev);
 			mpi3mr_tgtdev_del_from_list(mrioc, tgtdev, true);
 			mpi3mr_tgtdev_put(tgtdev);
+		} else if (tgtdev->is_hidden & tgtdev->host_exposed) {
+			dprint_reset(mrioc, "hiding target device with perst_id(%d)\n",
+				     tgtdev->perst_id);
+			mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev);
 		}
 	}
 
-- 
2.39.3


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

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

* [PATCH 3/4] mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State
  2023-11-26  5:31 [PATCH 0/4] mpi3mr: Bug fixes Chandrakanth patil
  2023-11-26  5:31 ` [PATCH 1/4] mpi3mr: Refresh sdev queue depth after controller reset Chandrakanth patil
  2023-11-26  5:31 ` [PATCH 2/4] mpi3mr: Cleanup block devices post " Chandrakanth patil
@ 2023-11-26  5:31 ` Chandrakanth patil
  2023-11-26  5:31 ` [PATCH 4/4] mpi3mr: Fetch correct device dev handle for status reply descriptor Chandrakanth patil
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Chandrakanth patil @ 2023-11-26  5:31 UTC (permalink / raw)
  To: linux-scsi, sathya.prakash, sumit.saxena, ranjan.kumar,
	prayas.patel
  Cc: Chandrakanth patil, stable

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]

If a controller reset is underway or the controller is in an unrecoverable
state, the PEL enable management command will be returned as EAGAIN or
EFAULT.

Cc: <stable@vger.kernel.org> # v6.1+
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Chandrakanth patil <chandrakanth.patil@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr_app.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c
index 08645a99ad6b..9dacbb8570c9 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_app.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_app.c
@@ -223,6 +223,22 @@ static long mpi3mr_bsg_pel_enable(struct mpi3mr_ioc *mrioc,
 		return rval;
 	}
 
+	if (mrioc->unrecoverable) {
+		dprint_bsg_err(mrioc, "%s: unrecoverable controller\n",
+			       __func__);
+		return -EFAULT;
+	}
+
+	if (mrioc->reset_in_progress) {
+		dprint_bsg_err(mrioc, "%s: reset in progress\n", __func__);
+		return -EAGAIN;
+	}
+
+	if (mrioc->stop_bsgs) {
+		dprint_bsg_err(mrioc, "%s: bsgs are blocked\n", __func__);
+		return -EAGAIN;
+	}
+
 	sg_copy_to_buffer(job->request_payload.sg_list,
 			  job->request_payload.sg_cnt,
 			  &pel_enable, sizeof(pel_enable));
-- 
2.39.3


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

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

* [PATCH 4/4] mpi3mr: Fetch correct device dev handle for status reply descriptor
  2023-11-26  5:31 [PATCH 0/4] mpi3mr: Bug fixes Chandrakanth patil
                   ` (2 preceding siblings ...)
  2023-11-26  5:31 ` [PATCH 3/4] mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State Chandrakanth patil
@ 2023-11-26  5:31 ` Chandrakanth patil
  2023-12-06  2:48 ` [PATCH 0/4] mpi3mr: Bug fixes Martin K. Petersen
  2023-12-14  4:29 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Chandrakanth patil @ 2023-11-26  5:31 UTC (permalink / raw)
  To: linux-scsi, sathya.prakash, sumit.saxena, ranjan.kumar,
	prayas.patel
  Cc: Chandrakanth patil

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

The current dev handle for the status reply is 0xFFFF, which is invalid.
So fetch the correct value.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Chandrakanth patil <chandrakanth.patil@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 872d4b809d08..1bffd629c124 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -3205,6 +3205,7 @@ void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc,
 			tg = stgt_priv_data->throttle_group;
 			throttle_enabled_dev =
 			    stgt_priv_data->io_throttle_enabled;
+			dev_handle = stgt_priv_data->dev_handle;
 		}
 	}
 	if (unlikely((data_len_blks >= mrioc->io_throttle_data_length) &&
-- 
2.39.3


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

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

* Re: [PATCH 0/4] mpi3mr: Bug fixes
  2023-11-26  5:31 [PATCH 0/4] mpi3mr: Bug fixes Chandrakanth patil
                   ` (3 preceding siblings ...)
  2023-11-26  5:31 ` [PATCH 4/4] mpi3mr: Fetch correct device dev handle for status reply descriptor Chandrakanth patil
@ 2023-12-06  2:48 ` Martin K. Petersen
  2023-12-14  4:29 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2023-12-06  2:48 UTC (permalink / raw)
  To: Chandrakanth patil
  Cc: linux-scsi, sathya.prakash, sumit.saxena, ranjan.kumar,
	prayas.patel


Chandrakanth,

> This patchset contains critical bug fixes

Applied to 6.8/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 0/4] mpi3mr: Bug fixes
  2023-11-26  5:31 [PATCH 0/4] mpi3mr: Bug fixes Chandrakanth patil
                   ` (4 preceding siblings ...)
  2023-12-06  2:48 ` [PATCH 0/4] mpi3mr: Bug fixes Martin K. Petersen
@ 2023-12-14  4:29 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2023-12-14  4:29 UTC (permalink / raw)
  To: linux-scsi, sathya.prakash, sumit.saxena, ranjan.kumar,
	prayas.patel, Chandrakanth patil
  Cc: Martin K . Petersen

On Sun, 26 Nov 2023 11:01:30 +0530, Chandrakanth patil wrote:

> This patchset contains critical bug fixes
> 
> Chandrakanth patil (4):
>   mpi3mr: Refresh sdev queue depth after controller reset
>   mpi3mr: Cleanup block devices post controller reset
>   mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable
>     State
>   mpi3mr: Fetch correct device dev handle for status reply descriptor
> 
> [...]

Applied to 6.8/scsi-queue, thanks!

[1/4] mpi3mr: Refresh sdev queue depth after controller reset
      https://git.kernel.org/mkp/scsi/c/e5aab848dfdf
[2/4] mpi3mr: Cleanup block devices post controller reset
      https://git.kernel.org/mkp/scsi/c/c01d515687e3
[3/4] mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State
      https://git.kernel.org/mkp/scsi/c/f8fb3f39148e
[4/4] mpi3mr: Fetch correct device dev handle for status reply descriptor
      https://git.kernel.org/mkp/scsi/c/07ac6adda4d3

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2023-12-14  4:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-26  5:31 [PATCH 0/4] mpi3mr: Bug fixes Chandrakanth patil
2023-11-26  5:31 ` [PATCH 1/4] mpi3mr: Refresh sdev queue depth after controller reset Chandrakanth patil
2023-11-26  5:31 ` [PATCH 2/4] mpi3mr: Cleanup block devices post " Chandrakanth patil
2023-11-26  5:31 ` [PATCH 3/4] mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State Chandrakanth patil
2023-11-26  5:31 ` [PATCH 4/4] mpi3mr: Fetch correct device dev handle for status reply descriptor Chandrakanth patil
2023-12-06  2:48 ` [PATCH 0/4] mpi3mr: Bug fixes Martin K. Petersen
2023-12-14  4:29 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox