From: Ranjan Kumar <ranjan.kumar@broadcom.com>
To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com
Cc: sathya.prakash@broadcom.com, chandrakanth.patil@broadcom.com,
Ranjan Kumar <ranjan.kumar@broadcom.com>
Subject: [PATCH v1 1/3] mpi3mr: Reset controller on invalid I/O completion
Date: Fri, 20 Mar 2026 14:33:24 +0530 [thread overview]
Message-ID: <20260320090326.47544-2-ranjan.kumar@broadcom.com> (raw)
In-Reply-To: <20260320090326.47544-1-ranjan.kumar@broadcom.com>
Operational replies without a valid scsi_cmnd indicate an invalid
I/O completion and a potentially inconsistent controller state.
Track this condition and allow the watchdog to trigger a soft
reset to safely recover.
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
---
drivers/scsi/mpi3mr/mpi3mr.h | 3 +++
drivers/scsi/mpi3mr/mpi3mr_fw.c | 7 +++++++
drivers/scsi/mpi3mr/mpi3mr_os.c | 11 +++++++++--
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h
index 6e962092577d..da141c185eef 100644
--- a/drivers/scsi/mpi3mr/mpi3mr.h
+++ b/drivers/scsi/mpi3mr/mpi3mr.h
@@ -323,6 +323,7 @@ enum mpi3mr_reset_reason {
MPI3MR_RESET_FROM_CFG_REQ_TIMEOUT = 29,
MPI3MR_RESET_FROM_SAS_TRANSPORT_TIMEOUT = 30,
MPI3MR_RESET_FROM_TRIGGER = 31,
+ MPI3MR_RESET_FROM_INVALID_COMPLETION = 32,
};
#define MPI3MR_RESET_REASON_OSTYPE_LINUX 1
@@ -1183,6 +1184,7 @@ struct scmd_priv {
* @num_tb_segs: Number of Segments in Trace buffer
* @trace_buf_pool: DMA pool for Segmented trace buffer segments
* @trace_buf: Trace buffer segments memory descriptor
+ * @invalid_io_comp: Invalid IO completion
*/
struct mpi3mr_ioc {
struct list_head list;
@@ -1394,6 +1396,7 @@ struct mpi3mr_ioc {
u32 num_tb_segs;
struct dma_pool *trace_buf_pool;
struct segments *trace_buf;
+ u8 invalid_io_comp;
};
diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index 04d4a2aea7d7..58360666fb78 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -996,6 +996,7 @@ static const struct {
{ MPI3MR_RESET_FROM_FIRMWARE, "firmware asynchronous reset" },
{ MPI3MR_RESET_FROM_CFG_REQ_TIMEOUT, "configuration request timeout"},
{ MPI3MR_RESET_FROM_SAS_TRANSPORT_TIMEOUT, "timeout of a SAS transport layer request" },
+ { MPI3MR_RESET_FROM_INVALID_COMPLETION, "invalid cmd completion" },
};
/**
@@ -2880,6 +2881,11 @@ static void mpi3mr_watchdog_work(struct work_struct *work)
return;
}
+ if (mrioc->invalid_io_comp) {
+ mpi3mr_soft_reset_handler(mrioc, MPI3MR_RESET_FROM_INVALID_COMPLETION, 1);
+ return;
+ }
+
if (atomic_read(&mrioc->admin_pend_isr)) {
ioc_err(mrioc, "Unprocessed admin ISR instance found\n"
"flush admin replies\n");
@@ -5647,6 +5653,7 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc,
ssleep(MPI3MR_RESET_TOPOLOGY_SETTLE_TIME);
out:
+ mrioc->invalid_io_comp = 0;
if (!retval) {
mrioc->diagsave_timeout = 0;
mrioc->reset_in_progress = 0;
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 8e5abf620718..59d43f768ae6 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -3462,8 +3462,15 @@ void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc,
}
scmd = mpi3mr_scmd_from_host_tag(mrioc, host_tag, qidx);
if (!scmd) {
- panic("%s: Cannot Identify scmd for host_tag 0x%x\n",
- mrioc->name, host_tag);
+ ioc_err(mrioc, "Cannot Identify scmd for host_tag 0x%x", host_tag);
+ ioc_err(mrioc,
+ "reply_desc_type(%d) host_tag(%d(0x%04x)): qid(%d): command issued to\n"
+ "handle(0x%04x) returned with ioc_status(0x%04x), log_info(0x%08x),\n"
+ "scsi_state(0x%02x), scsi_status(0x%02x), xfer_count(%d), resp_data(0x%08x)\n",
+ reply_desc_type, host_tag, host_tag, qidx+1, dev_handle, ioc_status,
+ ioc_loginfo, scsi_state, scsi_status, xfer_count,
+ resp_data);
+ mrioc->invalid_io_comp = 1;
goto out;
}
priv = scsi_cmd_priv(scmd);
--
2.47.3
next prev parent reply other threads:[~2026-03-20 9:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 9:03 [PATCH v1 0/3] mpi3mr: Enhancements for mpi3mr Ranjan Kumar
2026-03-20 9:03 ` Ranjan Kumar [this message]
2026-03-20 9:03 ` [PATCH v1 2/3] mpi3mr: Add queue-full tracking for operational request queues Ranjan Kumar
2026-03-20 9:03 ` [PATCH v1 3/3] mpi3mr: Add retry mechanism for IOC shutdown with timeout reset Ranjan Kumar
2026-03-27 21:11 ` [PATCH v1 0/3] mpi3mr: Enhancements for mpi3mr Martin K. Petersen
2026-04-03 2:05 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260320090326.47544-2-ranjan.kumar@broadcom.com \
--to=ranjan.kumar@broadcom.com \
--cc=chandrakanth.patil@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sathya.prakash@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.