[PATCH 1/2] scsi: mpi3mr: Poll a reply queue that an interrupt found busy

From: Usama Arif

Date: Wed Sep 30 2026 - 13:51:52 EST


mpi3mr_process_op_reply_q() returns without looking at the queue when
another context owns it. Task management polls all reply queues with
interrupts enabled, and a submitter drains the reply queue when the request
queue is full, so either can own the queue when an interrupt comes in. If
the owner made its last check just before the reply arrived, the handler
finds the queue busy and, unless enable_irq_poll happens to be set,
returns. Nobody looks at the reply until the next interrupt on that queue
or the command timeout.

Let's set enable_irq_poll when the queue is busy, so that mpi3mr_isr()
hands over to the IRQ thread, which polls until it has processed the
reply. The flag cannot be cleared before mpi3mr_isr() reads it, as the
thread only writes it while the interrupt is disabled.

Fixes: 463429f8dd5c ("scsi: mpi3mr: Add support for threaded ISR")
Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
---
drivers/scsi/mpi3mr/mpi3mr_fw.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index f0d3cd398dd00..102f84667a5cf 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -588,8 +588,11 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,

reply_qidx = op_reply_q->qid - 1;

- if (!atomic_add_unless(&op_reply_q->in_use, 1, 1))
+ if (!atomic_add_unless(&op_reply_q->in_use, 1, 1)) {
+ /* The owner may have missed a reply, let the thread poll */
+ WRITE_ONCE(op_reply_q->enable_irq_poll, true);
return 0;
+ }

exp_phase = op_reply_q->ephase;
reply_ci = op_reply_q->ci;
--
2.53.0-Meta