lkml.org 
[lkml]   [2026]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2026-04-29 14:39    [W:0.322 / U:4.671 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog