[PATCH] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector

From: TJ Adams

Date: Mon Nov 16 2026 - 17:48:35 EST


From: Terrence Adams <tadamsjr@xxxxxxxxxx>

When MSI-X interrupt vectors are configured in pm8001_setup_msix(), the
driver requests vector affinity with .pre_vectors = 1 to reserve Vector
0 for non-affinitized housekeeping interrupts.

blk_mq_map_hw_queues() maps hardware queues (hwq 0 to nr_hw_queues - 1)
with an offset of 1, mapping hwq 0 to Vector 1, hwq 1 to Vector 2, etc.

However, pm80xx_chip_get_q_index() retrieves the queue index directly
from blk_mq_unique_tag_to_hwq(tag) without adding 1 for the pre-vector
offset. Consequently, commands on hwq 0 are issued with responseQueue 0
(firing unmanaged Vector 0 on CPU 0), while hwq k fires Vector k (the
CPU affinitized to hwq k-1).

This results in 100% of I/O completion interrupts being delivered to the
wrong CPU core, causing heavy cross-CPU IPIs, cache line bouncing, and
increased kernel and IRQ CPU processing overhead.

Update pm80xx_chip_get_q_index() to accept pm8001_ha and add the
required +1 offset to blk_mq_unique_tag_to_hwq() whenever multi-queue is
enabled (number_of_intr > 1), routing completion interrupts to their
affinitized CPU cores.

Fixes: 42f22fe36d51 ("scsi: pm8001: Expose hardware queues for pm80xx")
Signed-off-by: Terrence Adams <tadamsjr@xxxxxxxxxx>
---
LLM assisted with drafting the fix and commit message.

drivers/scsi/pm8001/pm80xx_hwi.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index d2572dd66071..9cb73d316654 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -4328,14 +4328,18 @@ static int check_enc_sat_cmd(struct sas_task *task)
return ret;
}

-static u32 pm80xx_chip_get_q_index(struct sas_task *task)
+static u32 pm80xx_chip_get_q_index(struct pm8001_hba_info *pm8001_ha,
+ struct sas_task *task)
{
struct request *rq = sas_task_find_rq(task);

if (!rq)
return 0;

- return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(rq));
+ if (pm8001_ha->number_of_intr > 1)
+ return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(rq)) + 1;
+
+ return 0;
}

/**
@@ -4371,7 +4375,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7);
memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
task->ssp_task.cmd->cmd_len);
- q_index = pm80xx_chip_get_q_index(task);
+ q_index = pm80xx_chip_get_q_index(pm8001_ha, task);

/* Check if encryption is set */
if (pm8001_ha->chip->encrypt &&
@@ -4510,7 +4514,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
u32 opc = OPC_INB_SATA_HOST_OPSTART;
memset(&sata_cmd, 0, sizeof(sata_cmd));

- q_index = pm80xx_chip_get_q_index(task);
+ q_index = pm80xx_chip_get_q_index(pm8001_ha, task);

if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) {
ATAP = 0x04; /* no data*/

base-commit: 141b164bbe186423e295b139e40e8e2d11cf1341
--
2.56.0.679.gc527c65306-goog