From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Anthony Pighin (Nokia)" <anthony.pighin@nokia.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Alex Williamson <alex@shazbot.org>,
Nathan Chen <nathanc@nvidia.com>,
Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH] PCI: Lock upstream bridge for pci_try_reset_function()
Date: Wed, 14 Jan 2026 10:24:04 +0200 (EET) [thread overview]
Message-ID: <260dbdbf-fde6-8445-2c9b-07758d78b3fc@linux.intel.com> (raw)
In-Reply-To: <BN0PR08MB69514F34E3CA505AE910F2F8838EA@BN0PR08MB6951.namprd08.prod.outlook.com>
On Tue, 13 Jan 2026, Anthony Pighin (Nokia) wrote:
> Address this issue:
> [ 125.942583] pcieport 0000:00:00.0: unlocked secondary bus reset via:
> pci_reset_bus_function+0x188/0x1b8
Timestamp is unnecessary for understanding this issue and can be removed.
> which flows from a VFIO_GROUP_GET_DEVICE_FD ioctl when a PCI device is
> being added to a VFIO group.
>
> Commit 920f6468924f ("Warn on missing cfg_access_lock during secondary
> bus reset") added a warning if the PCI configuration space was not
> locked during a secondary bus reset request. That was in response to
> commit 7e89efc6e9e4 ("Lock upstream bridge for pci_reset_function()")
> such that remaining paths would be made more visible.
It would be more logical to start the entire changelog with something
like:
The commit 7e89efc6e9e4 ("Lock upstream bridge for pci_reset_function()")
added locking of the upstream bridge the the reset function. To catch
paths that are not properly locked, the commit 920f6468924f ("Warn on
missing cfg_access_lock during secondary bus reset") added a warning
if the PCI configuration space was not locked during a secondary bus reset
request.
And only then explain how it triggers in this particular case + quote the
warning.
> Address the pci_try_reset_function() path.
"Address" is very vague. Please state explicitly that you add missing
bridge locking and add a Fixes tag.
> Signed-off-by: Anthony Pighin <anthony.pighin@nokia.com>
> ---
> drivers/pci/pci.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 13dbb405dc31..ff3f2df7e9c8 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5196,19 +5196,34 @@ EXPORT_SYMBOL_GPL(pci_reset_function_locked);
> */
> int pci_try_reset_function(struct pci_dev *dev)
> {
> + struct pci_dev *bridge;
> int rc;
>
> if (!pci_reset_supported(dev))
> return -ENOTTY;
>
> - if (!pci_dev_trylock(dev))
> + /*
> + * If there's no upstream bridge, no locking is needed since there is
> + * no upstream bridge configuration to hold consistent.
> + */
> + bridge = pci_upstream_bridge(dev);
> + if (bridge && !pci_dev_trylock(bridge))
> return -EAGAIN;
>
> + if (!pci_dev_trylock(dev)) {
> + rc = -EAGAIN;
> + goto out_unlock_bridge;
> + }
> +
> pci_dev_save_and_disable(dev);
> rc = __pci_reset_function_locked(dev);
> pci_dev_restore(dev);
> pci_dev_unlock(dev);
>
> +out_unlock_bridge:
> + if (bridge)
> + pci_dev_unlock(bridge);
> +
> return rc;
> }
> EXPORT_SYMBOL_GPL(pci_try_reset_function);
> --
> 2.43.0
>
--
i.
prev parent reply other threads:[~2026-01-14 8:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 21:21 [PATCH] PCI: Lock upstream bridge for pci_try_reset_function() Anthony Pighin (Nokia)
2026-01-13 23:37 ` Alex Williamson
2026-01-14 8:24 ` Ilpo Järvinen [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=260dbdbf-fde6-8445-2c9b-07758d78b3fc@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=alex@shazbot.org \
--cc=anthony.pighin@nokia.com \
--cc=jgg@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=nathanc@nvidia.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