Skip to content

Commit e908f58

Browse files
committed
vfio/pci: Separate SR-IOV VF dev_set
In the below noted Fixes commit we introduced a reflck mutex to allow better scaling between devices for open and close. The reflck was based on the hot reset granularity, device level for root bus devices which cannot support hot reset or bus/slot reset otherwise. Overlooked in this were SR-IOV VFs, where there's also no bus reset option, but the default for a non-root-bus, non-slot-based device is bus level reflck granularity. The reflck mutex has since become the dev_set mutex (via commit 2cd8b14 ("vfio/pci: Move to the device set infrastructure")) and is our defacto serialization for various operations and ioctls. It still seems to be the case though that sets of vfio-pci devices really only need serialization relative to hot resets affecting the entire set, which is not relevant to SR-IOV VFs. As described in the Closes link below, this serialization contributes to startup latency when multiple VFs sharing the same "bus" are opened concurrently. Mark the device itself as the basis of the dev_set for SR-IOV VFs. Reported-by: Aaron Lewis <[email protected]> Closes: https://lore.kernel.org/all/[email protected] Tested-by: Aaron Lewis <[email protected]> Fixes: e309df5 ("vfio/pci: Parallelize device open and release") Reviewed-by: Yi Liu <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent fe24d5b commit e908f58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vfio/pci/vfio_pci_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,7 @@ int vfio_pci_core_register_device(struct vfio_pci_core_device *vdev)
21492149
return -EBUSY;
21502150
}
21512151

2152-
if (pci_is_root_bus(pdev->bus)) {
2152+
if (pci_is_root_bus(pdev->bus) || pdev->is_virtfn) {
21532153
ret = vfio_assign_device_set(&vdev->vdev, vdev);
21542154
} else if (!pci_probe_reset_slot(pdev->slot)) {
21552155
ret = vfio_assign_device_set(&vdev->vdev, pdev->slot);

0 commit comments

Comments
 (0)