From: "Ionut Nechita (Wind River)" <ionut.nechita@windriver.com>
To: Alex Williamson <alex@shazbot.org>
Cc: Ionut Nechita <ionut.nechita@windriver.com>,
Samiullah Khawaja <skhawaja@google.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Kevin Tian <kevin.tian@intel.com>, Jason Gunthorpe <jgg@ziepe.ca>,
Anthony Pighin <anthony.pighin@nokia.com>,
Dave Jiang <dave.jiang@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
kvm@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] vfio/pci: Only lock the upstream bridge if the reset may need it
Date: Fri, 20 Nov 2026 10:51:07 +0200 [thread overview]
Message-ID: <20261120085109.84155-1-ionut.nechita@windriver.com> (raw)
In-Reply-To: <20261119143237.4bf54796@shazbot.org>
From: Ionut Nechita <ionut.nechita@windriver.com>
On Thu, 19 Nov 2026 14:32:37 -0800, Alex Williamson wrote:
> After exploring Ionut's patch[1], what I propose above is probably
> wrong. We don't have any guarantees that the sibling topology is
> static and this bus-reset-possible function presents it as immutable.
Hi Alex,
Thanks for looking at it. The reproducer hits exactly that case. On
the N3000 the FEC PF and its VFs share a bus, behind the PEX 8747
switch on the card:
0000:b0:11.0 [10b5:8747] upstream bridge
0000:b8:00.0 [8086:0d8f] PF, vfio-pci, reset_method: flr bus
0000:b8:00.1 [8086:0d90] VF, vfio-pci
0000:b8:00.2 [8086:0d90] VF, vfio-pci
"bus" is listed because it was probed when the PF was alone on the
bus. While the VFs exist pci_parent_bus_reset() returns -ENOTTY for
the PF; the sriov_numvfs=0 write that is queued ahead of the PF reset
on the PF device lock removes them, and by the time the reset gets
the lock a bus reset is possible again.
> bool pci_reset_function_needs_bridge_lock(struct pci_dev *dev)
> {
> return pci_upstream_bridge(dev) &&
> !(dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) && !dev->is_virtfn;
> }
This looks right to me for the VF side, but it doesn't change this
case: the reset is on the PF, which is not a VF and has no
PCI_DEV_FLAGS_NO_BUS_RESET, so the bridge is still locked, even
though the PF has FLR and the reset will most likely be an FLR. My
patch is about what happens when the bridge is locked: today
pci_reset_function() blocks config access to the bridge before it
waits for the device lock of @dev, and that wait can last until the
vfio user releases the VF. Taking both device locks first and
blocking config access only around the reset keeps lspci working
meanwhile.
So I think the two are complementary, and I'm happy to rebase on top
of the helper if it goes in first. I've sent the follow-up for
__pci_bus_lock(), which has the same pattern for bus and slot resets,
separately.
For completeness, the same scenario on a Granite Rapids-D vRAN Boost
(VRB2) accelerator, an RCiEP on a root bus, has no bridge to lock at
all. There the visible symptom was reads of sriov_numvfs on the PF
sleeping behind the SR-IOV disable, which I've also sent a separate
patch for.
Thanks,
Ionut
next prev parent reply other threads:[~2026-11-20 8:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 23:57 Samiullah Khawaja
2026-11-19 0:37 ` Alex Williamson
2026-11-19 22:32 ` Alex Williamson
2026-11-20 8:51 ` Ionut Nechita (Wind River) [this message]
2026-11-20 22:21 ` Samiullah Khawaja
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=20261120085109.84155-1-ionut.nechita@windriver.com \
--to=ionut.nechita@windriver.com \
--cc=alex@shazbot.org \
--cc=anthony.pighin@nokia.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=skhawaja@google.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
all inboxes | Powered by JetHome®