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] vfio/pci: Lock upstream bridge for vfio_pci_core_disable()
Date: Wed, 14 Jan 2026 10:36:08 +0200 (EET) [thread overview]
Message-ID: <1ccd984a-a852-2e98-12c5-3547581a3eb7@linux.intel.com> (raw)
In-Reply-To: <BN0PR08MB695173DD697AB6E404803FEA838EA@BN0PR08MB6951.namprd08.prod.outlook.com>
On Tue, 13 Jan 2026, Anthony Pighin (Nokia) wrote:
> Fix the following on VFIO detach:
Fix the following warning that occurs during VFIO detach:
> [ 242.271584] pcieport 0000:00:00.0: unlocked secondary bus reset via:
> pci_reset_bus_function+0x188/0x1b8
>
> 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.
>
> Address the vfio_pci_core_disable() path.
Similar comments as to the other patch.
Why these are not submitted in a series (they seem to fix very similar
cases, just for different call chains)?
> Signed-off-by: Anthony Pighin <anthony.pighin@nokia.com>
> ---
> drivers/vfio/pci/vfio_pci_core.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
> index 3a11e6f450f7..aa2c21020ea8 100644
> --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -588,6 +588,7 @@ EXPORT_SYMBOL_GPL(vfio_pci_core_enable);
>
> void vfio_pci_core_disable(struct vfio_pci_core_device *vdev)
> {
> + struct pci_dev *bridge;
> struct pci_dev *pdev = vdev->pdev;
> struct vfio_pci_dummy_resource *dummy_res, *tmp;
> struct vfio_pci_ioeventfd *ioeventfd, *ioeventfd_tmp;
> @@ -694,12 +695,20 @@ void vfio_pci_core_disable(struct vfio_pci_core_device *vdev)
> * We can not use the "try" reset interface here, which will
> * overwrite the previously restored configuration information.
> */
> - if (vdev->reset_works && pci_dev_trylock(pdev)) {
> - if (!__pci_reset_function_locked(pdev))
> - vdev->needs_reset = false;
> - pci_dev_unlock(pdev);
> + if (vdev->reset_works) {
> + bridge = pci_upstream_bridge(pdev);
> + if (bridge && !pci_dev_trylock(bridge))
> + goto out_restore_state;
Misaligned.
> + if (pci_dev_trylock(pdev)) {
> + if (!__pci_reset_function_locked(pdev))
> + vdev->needs_reset = false;
> + pci_dev_unlock(pdev);
> + }
> + if (bridge)
> + pci_dev_unlock(bridge);
> }
>
> +out_restore_state:
> pci_restore_state(pdev);
> out:
> pci_disable_device(pdev);
> --
> 2.43.0
>
--
i.
next prev parent reply other threads:[~2026-01-14 8:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 21:34 [PATCH] vfio/pci: Lock upstream bridge for vfio_pci_core_disable() Anthony Pighin (Nokia)
2026-01-14 8:36 ` Ilpo Järvinen [this message]
2026-01-14 22:50 ` Alex Williamson
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=1ccd984a-a852-2e98-12c5-3547581a3eb7@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