From: Alex Williamson <alex.williamson@nvidia.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: kvm <kvm@vger.kernel.org>, Alex Williamson <alex@shazbot.org>,
skhawaja@google.com, Jason Gunthorpe <jgg@ziepe.ca>,
Bjorn Helgaas <bhelgaas@google.com>,
Kevin Tian <kevin.tian@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-pci <linux-pci@vger.kernel.org>,
Andrii Staikov <andrii.staikov@intel.com>,
Mitch Williams <mitch.a.williams@intel.com>,
Nick Nunley <nicholas.d.nunley@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [RFC PATCH 0/5] PCI/vfio-pci: Guard resets against active SR-IOV VFs
Date: Wed, 12 Aug 2026 16:53:06 -0600 [thread overview]
Message-ID: <20260812165306.31300443@nvidia.com> (raw)
In-Reply-To: <20260812214554.GA1067593@bhelgaas>
On Wed, 12 Aug 2026 16:45:54 -0500
Bjorn Helgaas <helgaas@kernel.org> wrote:
> [+cc Andrii, Mitch, Nick, Tony, Przemek]
>
> On Tue, Aug 11, 2026 at 10:53:18PM -0600, Alex Williamson wrote:
> > It's recently been found[1] that vfio-pci doesn't restrict resets on PFs
> > while SR-IOV is enabled. This can not only result in an uncoordinated
> > disruption of the use of the associated VFs, but the ongoing use of and
> > access to the VF has the potential to result in machine checks.
>
> I suspect this might also be related to the somewhat weird usage of
> pci_restore_msi_state() to restore VF MSI state in several network
> drivers:
>
> https://git.kernel.org/linus/371e576ff3e8 ("i40e: Restore VF MSI-X state during PCI reset")
> https://git.kernel.org/linus/7e4dcc13965c ("iavf: restore MSI state on reset")
> https://git.kernel.org/linus/a54a0b24f4f5 ("ice: restore VF MSI-X state during PCI reset")
>
> I think these are a little weird because they only run on a PF but
> call pci_restore_msi_state() on all the VFs.
>
> I guess these paths are recovery after FLR of the PF destroys the VFs,
> and after the FLR, pci_restore_state() on the PF re-enables the VFs
> but leaves them uninitialized. It seems kind of ad hoc to restore VF
> MSI state but not the rest of VF config space. This all seems kind of
> messy and makes me dubious about exporting pci_restore_msi_state()
> directly to drivers.
I don't understand how the i40e and ice NIC VFs can continue operation
with only MSI-X state restored. It seems to directly contradict the
requirements of the PCIe spec (7.0):
9.2.2.3 FLR That Targets a PF §
PFs must support FLR.
FLR to a PF resets the PF state as well as the SR-IOV extended
capability including VF Enable which means that VFs no longer exist.
9.2.3 IOV Re-initialization and Reallocation §
If VF Enable is Cleared after having been Set, all of the VFs
associated with the PF no longer exist and must no longer issue PCIe
transactions or respond to Configuration Space or Memory Space
accesses. VFs must not retain any architected state after VF Enable
has been Cleared (including sticky bits). For security, unarchitected
VF state configured through the VF must be cleared or randomized,
with the exception of persistent storage data.
For the PF driver patches noted to be effective, the VFs must not be
scrubbed on re-initialization, nor can a .reset_done hook in the PF
driver do anything to avoid unsupported requests from ongoing DMA and
MMIO accesses while VF Enable is cleared. So it looks like an
incomplete fix for non-compliant devices? Thanks,
Alex
prev parent reply other threads:[~2026-08-12 22:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 4:53 [RFC PATCH 0/5] PCI/vfio-pci: Guard resets against active SR-IOV VFs Alex Williamson
2026-08-12 4:53 ` [RFC PATCH 1/5] PCI: Refuse function reset of an SR-IOV PF with enabled VFs Alex Williamson
2026-08-12 5:01 ` sashiko-bot
2026-08-12 4:53 ` [RFC PATCH 2/5] PCI: Add pci_reset_bus_cond() for a caller-gated slot or bus reset Alex Williamson
2026-08-12 5:00 ` sashiko-bot
2026-08-12 4:53 ` [RFC PATCH 3/5] vfio/pci: Refuse to reset an SR-IOV PF with enabled VFs Alex Williamson
2026-08-12 5:02 ` sashiko-bot
2026-08-12 4:53 ` [RFC PATCH 4/5] PCI: Export pci_reset_supported() Alex Williamson
2026-08-12 4:59 ` sashiko-bot
2026-08-12 4:53 ` [RFC PATCH 5/5] vfio/pci: Use pci_reset_supported() in place of reset_works Alex Williamson
2026-08-12 4:59 ` sashiko-bot
2026-08-12 21:45 ` [RFC PATCH 0/5] PCI/vfio-pci: Guard resets against active SR-IOV VFs Bjorn Helgaas
2026-08-12 22:53 ` Alex Williamson [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=20260812165306.31300443@nvidia.com \
--to=alex.williamson@nvidia.com \
--cc=alex@shazbot.org \
--cc=andrii.staikov@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--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=mitch.a.williams@intel.com \
--cc=nicholas.d.nunley@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=skhawaja@google.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 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.