mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@linux.alibaba.com>
To: Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Feng Tang <feng.tang@linux.alibaba.com>,
	Anju Zheng <zaj01616726@alibaba-inc.com>
Subject: [PATCH RFC] PCI: Add warning about possible danger for pcie_bus_perf mode
Date: Wed, 25 Nov 2026 23:58:29 +0800	[thread overview]
Message-ID: <20261125155829.77269-1-feng.tang@linux.alibaba.com> (raw)

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)


                 reply	other threads:[~2026-11-25 15:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261125155829.77269-1-feng.tang@linux.alibaba.com \
    --to=feng.tang@linux.alibaba.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=zaj01616726@alibaba-inc.com \
    /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

all inboxes | Powered by JetHome®