From: sashiko-bot@kernel.org
To: "Runyu Xiao" <runyu.xiao@seu.edu.cn>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: be2iscsi: use rollback index when freeing MSI-X vectors
Date: Mon, 24 Aug 2026 09:40:06 +0000 [thread overview]
Message-ID: <20260824094006.91F9C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824092712.2130707-1-runyu.xiao@seu.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Flawed MSI-X fallback logic completely breaks the driver on MSI-X allocation failure and disables multiqueue on success.
--
--- Patch [1]: [PATCH] scsi: be2iscsi: use rollback index when freeing MSI-X vectors ---
commit 8e4e7a262620af574aa50d93aa71fefbc719c7d1
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
scsi: be2iscsi: use rollback index when freeing MSI-X vectors
beiscsi_init_irqs() unwinds previously registered MSI-X handlers with
free_irq(pci_irq_vector(pcidev, i), &phwi_context->be_eq[j]). The IRQ
number should match the rollback slot j, not the current loop index i.
Using i passes the wrong IRQ/dev_id pair and leaves earlier handlers
registered on failure.
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index fd18d4d3d219b..9833ab06b299a 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -878,7 +878,7 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
> return 0;
> free_msix_irqs:
> for (j = i - 1; j >= 0; j--) {
> - free_irq(pci_irq_vector(pcidev, i), &phwi_context->be_eq[j]);
> + free_irq(pci_irq_vector(pcidev, j), &phwi_context->be_eq[j]);
> kfree(phba->msi_name[j]);
> }
> return ret;
[Severity: High]
This isn't a bug introduced by this patch, but the MSI-X fallback logic
completely breaks the driver on MSI-X allocation failure and disables
multiqueue on success.
In be2iscsi_enable_msix(), if pci_alloc_irq_vectors_affinity() fails (returns
< 0), the code incorrectly sets phba->num_cpus = nvec - 1:
drivers/scsi/be2iscsi/be_main.c:be2iscsi_enable_msix() {
...
if (pci_alloc_irq_vectors_affinity(phba->pcidev, 2, nvec,
PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, &desc) < 0) {
phba->num_cpus = nvec - 1;
return;
}
}
phba->num_cpus = 1;
}
The driver then falls back to INTx and provisions multiple event queues, but
the INTx handler be_isr() is hardcoded to only process be_eq[0]:
drivers/scsi/be2iscsi/be_main.c:be_isr() {
...
pbe_eq = &phwi_context->be_eq[0];
eq = &phwi_context->be_eq[0].q;
...
}
Any I/O submitted to other queues will time out and hang. Conversely, if
allocation succeeds (returns > 0), the code skips the error branch and
unconditionally executes phba->num_cpus = 1, artificially restricting the
driver to 1 I/O queue and effectively disabling multiqueue.
Is it possible to correct the logic so the driver does not hang on fallback
and properly utilizes multiqueue on success?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260824092712.2130707-1-runyu.xiao@seu.edu.cn?part=1
next prev parent reply other threads:[~2026-08-24 9:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 9:27 [PATCH] scsi: be2iscsi: use rollback index when freeing MSI-X vectors Runyu Xiao
2026-08-24 9:40 ` sashiko-bot [this message]
2026-08-24 11:32 ` [PATCH v2] " Runyu Xiao
2026-08-24 11:48 ` sashiko-bot
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=20260824094006.91F9C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=runyu.xiao@seu.edu.cn \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox