Skip to contentSkip to conversation

mpi3mr: Bug fixes

PATCH Applied Chandrakanth patil 2 participants 7 messages Nov 26, 2023 – Dec 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover mpi3mr: Bug fixes

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(-)
Signature · 1 line
2.39.3
#1 lore raw

PATCH 1/4 mpi3mr: Refresh sdev queue depth after controller reset

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

---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_os.c +8 -2
index 91a22e6e5c3f..561fe0857bc0 100644
@@ -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);
+	}
 	}
 }
 
Signature · 1 line
2.39.3
#2 lore raw

PATCH 2/4 mpi3mr: Cleanup block devices post controller reset

In reply to Chandrakanth patil

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

---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_os.c +7 -2
index 561fe0857bc0..872d4b809d08 100644
@@ -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);
 		}
 	}
 
Signature · 1 line
2.39.3
#3 lore raw

PATCH 3/4 mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State

In reply to Chandrakanth patil

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.

---
 drivers/scsi/mpi3mr/mpi3mr_app.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/scsi/mpi3mr/mpi3mr_app.c +16 -0
index 08645a99ad6b..9dacbb8570c9 100644
@@ -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));
Signature · 1 line
2.39.3
#4 lore raw

PATCH 4/4 mpi3mr: Fetch correct device dev handle for status reply descriptor

In reply to Chandrakanth patil

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

---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/mpi3mr/mpi3mr_os.c +1 -0
index 872d4b809d08..1bffd629c124 100644
@@ -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) &&
Signature · 1 line
2.39.3
#6 lore raw
In reply to Chandrakanth patil
Quoted 10 lines · Chandrakanth patil

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering