From 0cdda6c6612da7ae37de78e3d2a0b2272bab742a Mon Sep 17 00:00:00 2001 From: Juraj Linkeš Date: Tue, 12 Oct 2021 10:03:04 +0200 Subject: vpp_device: bind to vfio-pci before running tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In rare cases, binding the whole /dev/vfio folder will result in unusable VFs: notice dpdk EAL: Cannot open /dev/vfio/151: Device or resource busy [0], section 4.3.1. provides some clues as to what's going on and how to avoid the failure. Mounting /dev/vfio reset the file descriptors of all devices under /dev/vfio. Vfio-pci creates a device when an interface is bound to it. The rare failure then occurs when /dev/vfio is mounted while a process is using the file descriptors result in that process using invalid file descriptors (or file descriptors belonging to a different VF). Fix the issue by binding i40e and ice VFs to vfio-pci before containers are created and make sure that the VFs are not unbound later in testing. Only bind DUT VFs since the TG uses the kernel driver. [0]: https://connect.redhat.com/sites/default/files/2021-03/Cloud Native Network Function Requirements.pdf Ticket: CSIT-1794 Change-Id: I83db91b29d16669fb034b141ad247f6f796fdf64 Signed-off-by: Juraj Linkeš --- resources/libraries/python/DUTSetup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'resources/libraries/python/DUTSetup.py') diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py index 504022381e..885b1ef30a 100644 --- a/resources/libraries/python/DUTSetup.py +++ b/resources/libraries/python/DUTSetup.py @@ -444,16 +444,21 @@ class DUTSetup: ) @staticmethod - def pci_driver_unbind_list(node, *pci_addrs): - """Unbind PCI devices from current driver on node. + def unbind_pci_devices_from_other_driver(node, driver, *pci_addrs): + """Unbind PCI devices from driver other than input driver on node. :param node: DUT node. + :param driver: Driver to not unbind from. If None or empty string, + will attempt to unbind from the current driver. :param pci_addrs: PCI device addresses. :type node: dict + :type driver: str :type pci_addrs: list """ for pci_addr in pci_addrs: - DUTSetup.pci_driver_unbind(node, pci_addr) + if not driver or \ + DUTSetup.get_pci_dev_driver(node, pci_addr) != driver: + DUTSetup.pci_driver_unbind(node, pci_addr) @staticmethod def pci_driver_bind(node, pci_addr, driver): -- cgit 1.2.3-korg