From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id E62AF2A7 for ; Tue, 17 Jun 2014 12:57:44 +0200 (CEST) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1Wwr5O-0000iY-In; Tue, 17 Jun 2014 06:58:00 -0400 Date: Tue, 17 Jun 2014 06:57:52 -0400 From: Neil Horman To: "Richardson, Bruce" Message-ID: <20140617105752.GA8539@hmsreliant.think-freely.org> References: <1402957745-31967-1-git-send-email-bruce.richardson@intel.com> <59AF69C657FD0841A61C55336867B5B01AA36B94@IRSMSX103.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59AF69C657FD0841A61C55336867B5B01AA36B94@IRSMSX103.ger.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] vfio: make container open error non-fatal X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2014 10:57:45 -0000 On Mon, Jun 16, 2014 at 10:30:54PM +0000, Richardson, Bruce wrote: > The below patch is the quickest fix I found to make my applications work again, but I'm not sure it's the best solution. Can anyone else offer other suggestions to improve this? > > > -----Original Message----- > > From: Richardson, Bruce > > Sent: Monday, June 16, 2014 3:29 PM > > To: dev@dpdk.org > > Cc: Richardson, Bruce > > Subject: [PATCH] vfio: make container open error non-fatal > > > > When setting up an app to run using the uio driver, errors caused by > > VFIO failures should not abruptly cause the app to fail. > > > > Example: on a board with 8 ports bound to igb_uio module, and no VFIO > > configuration, a testpmd run currently fails with: > > > > EAL: cannot open VFIO container! > > EAL: 0000:04:00.0 cannot open VFIO container! > > EAL: Error - exiting with code: 1 > > Cause: Requested device 0000:04:00.0 cannot be used > > > > With this patch applied, the problem with VFIO is ignored and testpmd > > successfully starts up - with ignored errors with vfio - as below: > > > > EAL: PCI device 0000:04:00.0 on NUMA socket 0 > > EAL: probe driver: 8086:1521 rte_igb_pmd > > EAL: unknown IOMMU driver! > > EAL: 0000:04:00.0 cannot open VFIO container! > > EAL: 0000:04:00.0 not managed by UIO driver, skipping > > <...scan results for other ports skipped...> > > EAL: PCI device 0000:8e:00.0 on NUMA socket 1 > > EAL: probe driver: 8086:154a rte_ixgbe_pmd > > EAL: unknown IOMMU driver! > > EAL: 0000:8e:00.0 cannot open VFIO container! > > EAL: PCI memory mapped at 0x7ff4ff5fa000 > > EAL: PCI memory mapped at 0x7ff4ff5f6000 > > EAL: PCI device 0000:8e:00.1 on NUMA socket 1 > > EAL: probe driver: 8086:154a rte_ixgbe_pmd > > EAL: unknown IOMMU driver! > > EAL: 0000:8e:00.1 cannot open VFIO container! > > EAL: PCI memory mapped at 0x7ff4ff4f6000 > > EAL: PCI memory mapped at 0x7ff4ff4f2000 > > Interactive-mode selected > > Configuring Port 0 (socket 0) > > <...other 7 ports ...> > > Checking link statuses... > > Port 0 Link Up - speed 10000 Mbps - full-duplex > > Port 1 Link Down > > Port 2 Link Up - speed 10000 Mbps - full-duplex > > Port 3 Link Down > > Port 4 Link Up - speed 10000 Mbps - full-duplex > > Port 5 Link Down > > Port 6 Link Up - speed 10000 Mbps - full-duplex > > Port 7 Link Down > > Done > > testpmd> > > > > This issue is introduced by the VFIO patch set addition, specifically > > commit ff0b67d1. > > > > Signed-off-by: Bruce Richardson > > --- > > lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > > b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > > index 4de6061..4af38f6 100644 > > --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > > @@ -528,7 +528,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) > > int vfio_container_fd = pci_vfio_get_container_fd(); > > if (vfio_container_fd < 0) { > > RTE_LOG(ERR, EAL, " %s cannot open VFIO > > container!\n", pci_addr); > > - return -1; > > + return 1; > > } > > > > vfio_cfg.vfio_container_fd = vfio_container_fd; > > -- > > 1.9.3 > > I think it would be preferable to convert the pci_vfio_get_container_fd function to return not -1, but some -ERRNO value, so that the caller can differentiate between fatal and non-fatal errors (for instance, not having any vfio container seems non-fatal, but having one with an incompatible api version may be unworkable. Neil