Messages in this thread |  | | Date | Wed, 29 Apr 2026 09:38:33 -0300 | | From | Jason Gunthorpe <> | | Subject | Re: [PATCH RFC] net/mlx5: check whether VFs are assigned before disabling SR-IOV |
| |
On Tue, Apr 28, 2026 at 08:04:14PM +0200, Max Boone via B4 Relay wrote: > From: Max Boone <mboone@akamai.com> > > When MLX5 cards are passed through to a VM, disabling SR-IOV by > setting the sriov_numvfs to 0 will render the machine unstable.
What? How does that happen?
> -void mlx5_sriov_disable(struct pci_dev *pdev, bool num_vf_change) > +int mlx5_sriov_disable(struct pci_dev *pdev, bool num_vf_change) > { > struct mlx5_core_dev *dev = pci_get_drvdata(pdev); > struct devlink *devlink = priv_to_devlink(dev); > int num_vfs = pci_num_vf(dev->pdev); > > + if (pci_vfs_assigned(dev->pdev)) { > + mlx5_core_warn(dev, "can't disable sriov, VFs are assigned\n"); > + return -EPERM; > + }
*barf* WTF did this come from?
Grep says only Xen makes this true, so this is all working around some Xen brokenness in their "assignment" ?
If people care about Xen pci_is_dev_assigned() should be be purged and pciback should be fixed to not "make the machine unstable" when it is removed during a VF teardown.
Or at the very least this nasty Xen intrustion should be placed in the PCI core code and removed from the drivers.
Also, no, you can't fail mlx5_sriov_disable() it is called during driver remove and cannot fail in that flow.
Jason
|  |