From: sashiko-bot@kernel.org
To: "Alexander Gruhlke" <gruhlke@mailbox.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 2/2] PCI: Don't treat ~0 as ready in pci_dev_wait() with RRS SV
Date: Sun, 11 Oct 2026 16:41:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-167316@kernel.org> (raw)
In-Reply-To: <20261011163249.18479-3-gruhlke@mailbox.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] pci: premature wait termination for VFs returning ~0 under RRS SV
--
commit 3101a5ea075ba619cd03d971d4a538bf4788ec75
Author: Alexander Gruhlke <gruhlke@mailbox.org>
PCI: Don't treat ~0 as ready in pci_dev_wait() with RRS SV
With RRS Software Visibility, pci_dev_wait() considers a device ready as
soon as reading the Vendor ID doesn't return the RRS value. Devices
aren't required to respond with RRS while they aren't ready, so the read
may return ~0 and pci_dev_wait() stops waiting too early.
Link: https://lore.kernel.org/r/20250611101442.387378-1-hui.wang@canonical.com
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index aa39b4dd45aea..cf429f64bce0f 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
[ ... ]
> @@ -1331,7 +1332,8 @@ static int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout)
>
> if (root && root->config_rrs_sv) {
> pci_read_config_dword(dev, PCI_VENDOR_ID, &id);
> - if (!pci_bus_rrs_vendor_id(id))
> + if (!pci_bus_rrs_vendor_id(id) &&
> + (!PCI_POSSIBLE_ERROR(id) || dev->is_virtfn))
> break;
[Severity: Medium]
Does this cause pci_dev_wait() to exit prematurely for Virtual Functions
(VFs) that return ~0 under Configuration RRS Software Visibility?
If a VF is not yet ready, its config space might return ~0 (for example, due
to a Request Timeout) instead of the RRS value. The dev->is_virtfn check
causes the wait loop to terminate immediately upon seeing ~0. This seems to
allow unready VFs to appear ready, defeating the reset delay.
Callers might then attempt to initialize the unready VF, leading to config
read/write failures or even triggering PCIe AERs if the unready VF later
responds with RRS to non-Vendor-ID accesses.
While VFs architecturally return ~0 for Vendor ID when they are ready, polling
PCI_COMMAND when the Vendor ID returns ~0 (as done in the non-RRS SV path
below) could resolve this without exiting prematurely.
> } else {
> pci_read_config_dword(dev, PCI_COMMAND, &id);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261011163249.18479-1-gruhlke@mailbox.org?part=2
next prev parent reply other threads:[~2026-10-11 16:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 16:32 [PATCH v2 0/2] PCI: Wait after FLR for devices that don't honor Immediate Readiness Alexander Gruhlke
2026-10-11 16:32 ` [PATCH v2 1/2] PCI: Ignore Immediate Readiness on Samsung 990 PRO NVMe Alexander Gruhlke
2026-10-11 16:39 ` sashiko-bot
2026-10-11 18:00 ` Lukas Wunner
2026-10-11 18:18 ` Alexander Gruhlke
2026-10-11 16:32 ` [PATCH v2 2/2] PCI: Don't treat ~0 as ready in pci_dev_wait() with RRS SV Alexander Gruhlke
2026-10-11 16:41 ` sashiko-bot [this message]
2026-10-11 16:49 ` Alexander Gruhlke
2026-10-11 18:13 ` Lukas Wunner
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=sashiko-outbox-167316@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gruhlke@mailbox.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.