From: sashiko-bot@kernel.org
To: "Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2] PCI: qcom: Add register dump support for PCIe Link Down events
Date: Sat, 05 Sep 2026 01:39:38 +0000 [thread overview]
Message-ID: <20260905013938.C43E81F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260905-regdump-v2-1-f7d34f9d4f46@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Concurrent access to indirect SD-EQ registers is not protected by a lock, creating a race condition that can corrupt the captured diagnostic state.
--
commit a1f2aa73e3c568121015c7315eea5b09feeae5b7
Author: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
PCI: qcom: Add register dump support for PCIe Link Down events
This commit adds support for dumping key PCIe controller registers when a Link
Down event occurs to aid in root-causing failures. The dump is output directly
to dmesg or devcoredump, and is also exposed on-demand via a regdump debugfs
file.
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index b58a607b713f5..ba41a0eb43dc5 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
[ ... ]
> @@ -1760,6 +1819,287 @@ static int qcom_pcie_set_max_opp(struct device *dev)
[ ... ]
> +static size_t qcom_pcie_fill_dump_buf(struct qcom_pcie *pcie, char *buf,
> + size_t buf_size)
> +{
> + struct dw_pcie *pci = pcie->pci;
[ ... ]
> + /*
> + * Gen5 (32 GT/s) local/remote pre/post cursor status, read through the
> + * SD-EQ registers inside the DWC RAS-DES vendor-specific extended
> + * capability. For each lane, write the lane selector into
> + * PCIE_RAS_DES_SD_EQ_CONTROL1 then read back
> + * PCIE_RAS_DES_SD_EQ_STATUS2/3, which carry the local/remote pre/post
> + * cursor values.
> + */
> + if (pcie_get_link_speed(pci->max_link_speed) == PCIE_SPEED_32_0GT) {
> + u16 rasdes_cap = dw_pcie_find_rasdes_capability(pci);
> +
> + if (rasdes_cap) {
> + int num_lanes = dw_pcie_link_get_max_link_width(pci);
> + int lane;
> +
> + for (lane = 0; lane < num_lanes; lane++) {
> + dw_pcie_writel_dbi(pci,
> + rasdes_cap + PCIE_RAS_DES_SD_EQ_CONTROL1,
> + lane & PCIE_RAS_DES_SD_EQ_CONTROL1_LANE_SEL);
> +
> + val = dw_pcie_readl_dbi(pci,
> + rasdes_cap + PCIE_RAS_DES_SD_EQ_STATUS2);
[Severity: Medium]
Are these indirect SD-EQ register accesses in qcom_pcie_fill_dump_buf() safe
from concurrent access?
If multiple processes read the regdump debugfs file simultaneously, or if a
user reads the debugfs file concurrently with a PCIe Link Down event (which
triggers the same dump logic from qcom_pcie_global_irq_thread()), these
write-then-read sequences could interleave.
This race could cause one or both threads to read the status registers for the
wrong lane, corrupting the captured diagnostic state. Should this access be
protected by a lock?
> + len += qcom_pcie_dump_lane_reg_val(buf + len, buf_size - len, &col,
> + lane,
> + rasdes_cap + PCIE_RAS_DES_SD_EQ_STATUS2,
> + val);
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260905-regdump-v2-1-f7d34f9d4f46@oss.qualcomm.com?part=1
prev parent reply other threads:[~2026-09-05 1:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 1:29 [PATCH v2] PCI: qcom: Add register dump support for PCIe Link Down events Krishna Chaitanya Chundru
2026-09-05 1:39 ` sashiko-bot [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=20260905013938.C43E81F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=krishna.chundru@oss.qualcomm.com \
--cc=linux-pci@vger.kernel.org \
--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