From: Mira Limbeck <m.limbeck@proxmox.com>
To: Ranjan Kumar <ranjan.kumar@broadcom.com>,
linux-scsi@vger.kernel.org, martin.petersen@oracle.com
Cc: sathya.prakash@broadcom.com, chandrakanth.patil@broadcom.com,
dlemoal@kernel.org, david.laight.linux@gmail.com,
stable@vger.kernel.org, Keith Busch <kbusch@kernel.org>,
Friedrich Weber <f.weber@proxmox.com>
Subject: Re: [PATCH v4] mpt3sas: Limit NVMe request size to 2 MiB
Date: Wed, 15 Apr 2026 19:43:30 +0200 [thread overview]
Message-ID: <596fba41-38be-47bb-b436-bc74b7237816@proxmox.com> (raw)
In-Reply-To: <20260414110811.85156-1-ranjan.kumar@broadcom.com>
On 4/14/26 1:13 PM, Ranjan Kumar wrote:
> The HBA firmware reports NVMe MDTS values based on the underlying drive
> capability. However, because the driver allocates a fixed 4K buffer for
> the PRP list, accommodating at most 512 entries, the driver supports a
> maximum I/O transfer size of 2 MiB.
>
> Limit max_hw_sectors to the smaller of the reported MDTS and the
> 2 MiB driver limit to prevent issuing oversized I/O that may lead
> to a kernel oops.
>
> Cc: stable@vger.kernel.org
> Fixes: 9b8b84879d4a ("block: Increase BLK_DEF_MAX_SECTORS_CAP")
> Reported-by: Mira Limbeck <m.limbeck@proxmox.com>
> Closes: https://lore.kernel.org/r/291f78bf-4b4a-40dd-867d-053b36c564b3@proxmox.com
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b8b84879d4a
> Suggested-by: Keith Busch <kbusch@kernel.org>
> Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
> ---
> drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index 6ff788557294..12caffeed3a0 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> @@ -2738,8 +2738,20 @@ scsih_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim)
> pcie_device->enclosure_level,
> pcie_device->connector_name);
>
> + /*
> + * The HBA firmware passes the NVMe drive's MDTS
> + * (Maximum Data Transfer Size) up to the driver. However,
> + * the driver hardcodes a 4K buffer size for the PRP list,
> + * accommodating at most 512 entries. This strictly limits
> + * the maximum supported NVMe I/O transfer to 2 MiB.
> + *
> + * Cap max_hw_sectors to the smaller of the drive's reported
> + * MDTS or the 2 MiB driver limit to prevent kernel oopses.
> + */
> + lim->max_hw_sectors = SZ_2M >> SECTOR_SHIFT;
> if (pcie_device->nvme_mdts)
> - lim->max_hw_sectors = pcie_device->nvme_mdts / 512;
> + lim->max_hw_sectors = min(lim->max_hw_sectors,
> + pcie_device->nvme_mdts >> SECTOR_SHIFT);
>
> pcie_device_put(pcie_device);
> spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
Thank you for providing this patch.
We tested it on our test machine on top of 7.0-rc7.
Without the patch, we saw the same call traces as before. With this patch applied no such call traces were logged.
So looks like it fixes the issue in our case.
I can't say much to the patch itself, but I can provide a tested-by.
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
prev parent reply other threads:[~2026-04-15 17:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 11:08 [PATCH v4] mpt3sas: Limit NVMe request size to 2 MiB Ranjan Kumar
2026-04-15 17:43 ` Mira Limbeck [this message]
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=596fba41-38be-47bb-b436-bc74b7237816@proxmox.com \
--to=m.limbeck@proxmox.com \
--cc=chandrakanth.patil@broadcom.com \
--cc=david.laight.linux@gmail.com \
--cc=dlemoal@kernel.org \
--cc=f.weber@proxmox.com \
--cc=kbusch@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ranjan.kumar@broadcom.com \
--cc=sathya.prakash@broadcom.com \
--cc=stable@vger.kernel.org \
/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