* [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode
@ 2026-11-25 15:58 Feng Tang
2026-11-26 8:37 ` Christoph Hellwig
2026-11-26 8:39 ` Niklas Cassel
0 siblings, 2 replies; 6+ messages in thread
From: Feng Tang @ 2026-11-25 15:58 UTC (permalink / raw)
To: Bjorn Helgaas, linux-pci; +Cc: linux-kernel, Feng Tang, Anju Zheng
During stability test, there was a bug that running 'mount' on a type
of commercial NVME disk failed on an arm64 server and raised PCIe RAS
error and panic the kernel later, when using "pci=pcie_bus_perf" kernel
cmdline parameter.
The NVME device has MPS(Max Payload Size) capability of 256 bytes while
its corresponding root port is capable of 512 bytes. When enabling
PCIE_BUS_PERFORMANCE mode, its MPS and MRRS(Max Read Request Size) are
both set to 256, while the root port's are both set to 512. But the
NVME device doesn't comply with PCIe spec (v6.3), Section 7.5.3.4:
"
Max_Read_Request_Size - This field sets the maximum Read Request size
for the Function as a Requester. The Function must not generate Read
Requests with a size exceeding the set value
"
that it sends out Memory Read request with length of 512 bytes, and
when root port replies CplD packet with 512 bytes payload which exceeds
device's MPS, PCIe RAS error is issued.
The problem can be reproduced on some arm64 server and Intel server.
This caused some data damage, and there were quite a few NVME cards of
the same type damaged (though we are not sure these are directly related).
In this case, the kernel is innocent as it does make sure a device's MRRS
setting is no larger than its MPS setting, while the device breaks PCIe
spec. It could still be meaningful to warn about the possible danger.
Reported-by: Anju Zheng <zaj01616726@alibaba-inc.com>
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
---
include/linux/pci.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d31a8d107b1e..e115aa2e962a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1192,6 +1192,18 @@ static inline int pci_has_flag(int flag) { return pci_flags & flag; }
void pcie_bus_configure_settings(struct pci_bus *bus);
+/*
+ * Note: For PCIE_BUS_PERFORMANCE mode, it could be dangerous for a device
+ * that doesn't completely comply with PCIe spec about MPS and MRRS setting,
+ * as it allows the device and its corresponding root port to have different
+ * MPS settings.
+ *
+ * Kernel already makes sure a device's MRRS setting is no larger than its
+ * MPS setting. But there is real world case that some commercial NVME device
+ * sends out Memory Read request with length bigger than its MRRS (equals to
+ * its MPS), and root port replies CplD packet with that bigger length, which
+ * triggers RAS/MCE errors on arm64 and x86 servers, causing data damage.
+ */
enum pcie_bus_config_types {
PCIE_BUS_TUNE_OFF, /* Don't touch MPS at all */
PCIE_BUS_DEFAULT, /* Ensure MPS matches upstream bridge */
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode
2026-11-25 15:58 [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode Feng Tang
@ 2026-11-26 8:37 ` Christoph Hellwig
2026-11-26 9:48 ` Feng Tang
2026-11-26 8:39 ` Niklas Cassel
1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2026-11-26 8:37 UTC (permalink / raw)
To: Feng Tang; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Anju Zheng
On Wed, Nov 25, 2026 at 11:58:29PM +0800, Feng Tang wrote:
> During stability test, there was a bug that running 'mount' on a type
> of commercial NVME disk failed on an arm64 server and raised PCIe RAS
> error and panic the kernel later, when using "pci=pcie_bus_perf" kernel
> cmdline parameter.
>
> The NVME device has MPS(Max Payload Size) capability of 256 bytes while
> its corresponding root port is capable of 512 bytes. When enabling
> PCIE_BUS_PERFORMANCE mode, its MPS and MRRS(Max Read Request Size) are
> both set to 256, while the root port's are both set to 512. But the
> NVME device doesn't comply with PCIe spec (v6.3), Section 7.5.3.4:
Please add a quirk for these devices now that you have identified
this problem.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode
2026-11-25 15:58 [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode Feng Tang
2026-11-26 8:37 ` Christoph Hellwig
@ 2026-11-26 8:39 ` Niklas Cassel
2026-11-26 11:03 ` Feng Tang
1 sibling, 1 reply; 6+ messages in thread
From: Niklas Cassel @ 2026-11-26 8:39 UTC (permalink / raw)
To: Feng Tang; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Anju Zheng
On Wed, Nov 25, 2026 at 11:58:29PM +0800, Feng Tang wrote:
> During stability test, there was a bug that running 'mount' on a type
> of commercial NVME disk failed on an arm64 server and raised PCIe RAS
> error and panic the kernel later, when using "pci=pcie_bus_perf" kernel
> cmdline parameter.
>
> The NVME device has MPS(Max Payload Size) capability of 256 bytes while
> its corresponding root port is capable of 512 bytes. When enabling
> PCIE_BUS_PERFORMANCE mode, its MPS and MRRS(Max Read Request Size) are
> both set to 256, while the root port's are both set to 512. But the
> NVME device doesn't comply with PCIe spec (v6.3), Section 7.5.3.4:
I assume that you are using pcie_bus_perf rather than the default strategy,
because with the default strategy never raises the Root Port above what
firmware programmed, which may be only 128 bytes.
pcie_bus_perf gives a Root Port its own maximum MPS without looking at
the devices below it, and relies on MRRS to keep Completions within the
endpoint's MPS, so a device that ignores its MRRS gets Completions
larger than its MPS.
My series [1] avoids this without pcie_bus_perf: with the default strategy,
it sets each Root Port hierarchy to the largest MPS that all of its devices
support, i.e. 256 bytes for both your Root Port and the NVMe. Since a
Function must not generate TLPs larger than its own Max_Payload_Size, the
Root Port then returns Completions of at most 256 bytes, even for the
512-byte reads your NVMe issues. The NVMe also gets the same 256-byte
payloads as with pcie_bus_perf, so nothing is lost by dropping it: the Root
Port's 512 bytes don't help a link whose only device supports 256.
Would you be able to test the series on that server, without
pci=pcie_bus_perf?
[1] https://lore.kernel.org/linux-pci/20261020122854.1500883-5-cassel@kernel.org/
Kind regards,
Niklas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode
2026-11-26 8:37 ` Christoph Hellwig
@ 2026-11-26 9:48 ` Feng Tang
0 siblings, 0 replies; 6+ messages in thread
From: Feng Tang @ 2026-11-26 9:48 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Anju Zheng
On Thu, Nov 26, 2026 at 12:37:37AM -0800, Christoph Hellwig wrote:
> On Wed, Nov 25, 2026 at 11:58:29PM +0800, Feng Tang wrote:
> > During stability test, there was a bug that running 'mount' on a type
> > of commercial NVME disk failed on an arm64 server and raised PCIe RAS
> > error and panic the kernel later, when using "pci=pcie_bus_perf" kernel
> > cmdline parameter.
> >
> > The NVME device has MPS(Max Payload Size) capability of 256 bytes while
> > its corresponding root port is capable of 512 bytes. When enabling
> > PCIE_BUS_PERFORMANCE mode, its MPS and MRRS(Max Read Request Size) are
> > both set to 256, while the root port's are both set to 512. But the
> > NVME device doesn't comply with PCIe spec (v6.3), Section 7.5.3.4:
>
> Please add a quirk for these devices now that you have identified
> this problem.
Good suggestion! Will work on this.
One naughty point is, during the debug, we have 2 models from the
same vendor, which has the same Vendor ID and Device ID, one is
3.8TB, and the other is 1.9TB. Only the 1.9TB model has this
issue, while the 3.8TB one works fine with "pcie_bus_safe" mode.
'lspci -xvvv' of these 2 models are also almost the same, so there
is no way to tell these 2 models?
Any suggestion? Or we just add the quirks for this VID/DID for safe?
Thanks,
Feng
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode
2026-11-26 8:39 ` Niklas Cassel
@ 2026-11-26 11:03 ` Feng Tang
2026-11-26 11:56 ` Niklas Cassel
0 siblings, 1 reply; 6+ messages in thread
From: Feng Tang @ 2026-11-26 11:03 UTC (permalink / raw)
To: Niklas Cassel; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Anju Zheng
Hi Niklas,
On Thu, Nov 26, 2026 at 09:39:44AM +0100, Niklas Cassel wrote:
> On Wed, Nov 25, 2026 at 11:58:29PM +0800, Feng Tang wrote:
> > During stability test, there was a bug that running 'mount' on a type
> > of commercial NVME disk failed on an arm64 server and raised PCIe RAS
> > error and panic the kernel later, when using "pci=pcie_bus_perf" kernel
> > cmdline parameter.
> >
> > The NVME device has MPS(Max Payload Size) capability of 256 bytes while
> > its corresponding root port is capable of 512 bytes. When enabling
> > PCIE_BUS_PERFORMANCE mode, its MPS and MRRS(Max Read Request Size) are
> > both set to 256, while the root port's are both set to 512. But the
> > NVME device doesn't comply with PCIe spec (v6.3), Section 7.5.3.4:
>
> I assume that you are using pcie_bus_perf rather than the default strategy,
> because with the default strategy never raises the Root Port above what
> firmware programmed, which may be only 128 bytes.
Right, only the 'pcie_bus_perf' mode can reproducde this issue. The
default mode works just fine.
We reproucded it on one arm64 server and one Intel server, the MPS for
the NVME device and root port are both set to 256 bytes in default mode
(no pcie_bus_perf parameter).
> pcie_bus_perf gives a Root Port its own maximum MPS without looking at
> the devices below it, and relies on MRRS to keep Completions within the
> endpoint's MPS, so a device that ignores its MRRS gets Completions
> larger than its MPS.
>
> My series [1] avoids this without pcie_bus_perf: with the default strategy,
> it sets each Root Port hierarchy to the largest MPS that all of its devices
> support, i.e. 256 bytes for both your Root Port and the NVMe. Since a
> Function must not generate TLPs larger than its own Max_Payload_Size, the
> Root Port then returns Completions of at most 256 bytes, even for the
> 512-byte reads your NVMe issues. The NVMe also gets the same 256-byte
> payloads as with pcie_bus_perf, so nothing is lost by dropping it: the Root
> Port's 512 bytes don't help a link whose only device supports 256.
>
> Would you be able to test the series on that server, without
> pci=pcie_bus_perf?
I can give it a try after the quirk work suggested by Christoph Hellwig.
I haven't read through you patch, one question is, since current kernel
already works fine without 'pci=pcie_bus_perf', what' the intention of
this test?
Thanks,
Feng
> [1] https://lore.kernel.org/linux-pci/20261020122854.1500883-5-cassel@kernel.org/
>
> Kind regards,
> Niklas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode
2026-11-26 11:03 ` Feng Tang
@ 2026-11-26 11:56 ` Niklas Cassel
0 siblings, 0 replies; 6+ messages in thread
From: Niklas Cassel @ 2026-11-26 11:56 UTC (permalink / raw)
To: Feng Tang; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Anju Zheng
On Thu, Nov 26, 2026 at 07:03:19PM +0800, Feng Tang wrote:
> Hi Niklas,
>
> On Thu, Nov 26, 2026 at 09:39:44AM +0100, Niklas Cassel wrote:
> > On Wed, Nov 25, 2026 at 11:58:29PM +0800, Feng Tang wrote:
> > > During stability test, there was a bug that running 'mount' on a type
> > > of commercial NVME disk failed on an arm64 server and raised PCIe RAS
> > > error and panic the kernel later, when using "pci=pcie_bus_perf" kernel
> > > cmdline parameter.
> > >
> > > The NVME device has MPS(Max Payload Size) capability of 256 bytes while
> > > its corresponding root port is capable of 512 bytes. When enabling
> > > PCIE_BUS_PERFORMANCE mode, its MPS and MRRS(Max Read Request Size) are
> > > both set to 256, while the root port's are both set to 512. But the
> > > NVME device doesn't comply with PCIe spec (v6.3), Section 7.5.3.4:
> >
> > I assume that you are using pcie_bus_perf rather than the default strategy,
> > because with the default strategy never raises the Root Port above what
> > firmware programmed, which may be only 128 bytes.
>
> Right, only the 'pcie_bus_perf' mode can reproducde this issue. The
> default mode works just fine.
>
> We reproucded it on one arm64 server and one Intel server, the MPS for
> the NVME device and root port are both set to 256 bytes in default mode
> (no pcie_bus_perf parameter).
>
> > pcie_bus_perf gives a Root Port its own maximum MPS without looking at
> > the devices below it, and relies on MRRS to keep Completions within the
> > endpoint's MPS, so a device that ignores its MRRS gets Completions
> > larger than its MPS.
> >
> > My series [1] avoids this without pcie_bus_perf: with the default strategy,
> > it sets each Root Port hierarchy to the largest MPS that all of its devices
> > support, i.e. 256 bytes for both your Root Port and the NVMe. Since a
> > Function must not generate TLPs larger than its own Max_Payload_Size, the
> > Root Port then returns Completions of at most 256 bytes, even for the
> > 512-byte reads your NVMe issues. The NVMe also gets the same 256-byte
> > payloads as with pcie_bus_perf, so nothing is lost by dropping it: the Root
> > Port's 512 bytes don't help a link whose only device supports 256.
> >
> > Would you be able to test the series on that server, without
> > pci=pcie_bus_perf?
>
> I can give it a try after the quirk work suggested by Christoph Hellwig.
>
> I haven't read through you patch, one question is, since current kernel
> already works fine without 'pci=pcie_bus_perf', what' the intention of
> this test?
For this NVMe drive, it won't change anything.
My series matters where the default strategy currently leaves the MPS
lower than what a device and its Root Port support, because it never
raises a Root Port above what firmware programmed. Which is normally
the reason why people use pcie_bus_perf. But unlink my series,
pcie_bus_perf does not reduce the Root Port's MPS to that of the max
supported by the endpoint, after the the MPS has been raised above
what the firmware programmed.
But if you get 256 bytes with the default strategy, which is the limit
of your NVMe device, why are you using pcie_bus_perf?
Perhaps you are using pcie_bus_perf to get a larger MPS for other devices
(other than the NVMe) on these servers. If that is the case, using my
series would allow you to still change to the default policy, and still
get the benefit of pcie_bus_perf (without the downsides of pcie_bus_perf).
Kind regards,
Niklas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-26 11:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 15:58 [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode Feng Tang
2026-11-26 8:37 ` Christoph Hellwig
2026-11-26 9:48 ` Feng Tang
2026-11-26 8:39 ` Niklas Cassel
2026-11-26 11:03 ` Feng Tang
2026-11-26 11:56 ` Niklas Cassel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®