From patchwork Fri Jul 1 15:59:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 14504 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E0FE62BAB; Fri, 1 Jul 2016 17:59:36 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id AA8F12BA6 for ; Fri, 1 Jul 2016 17:59:35 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 01 Jul 2016 08:59:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,557,1459839600"; d="scan'208";a="987164830" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 01 Jul 2016 08:59:33 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u61FxWXl021676; Fri, 1 Jul 2016 16:59:32 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u61FxWiR024872; Fri, 1 Jul 2016 16:59:32 +0100 Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u61FxW76024868; Fri, 1 Jul 2016 16:59:32 +0100 X-Authentication-Warning: sivswdev02.ir.intel.com: fyigit set sender to ferruh.yigit@intel.com using -f From: Ferruh Yigit To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 1 Jul 2016 16:59:31 +0100 Message-Id: <1467388771-24838-1-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1467385678-16205-1-git-send-email-ferruh.yigit@intel.com> References: <1467385678-16205-1-git-send-email-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v3] igb_uio: fix possible mmap failure for Linux >= v4.5 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" mmap the iomem range of the PCI device fails for kernels that enabled CONFIG_IO_STRICT_DEVMEM option: EAL: pci_map_resource(): cannot mmap(39, 0x7f1c51800000, 0x100000, 0x0): Invalid argument (0xffffffffffffffff) CONFIG_IO_STRICT_DEVMEM is introduced in Linux v4.5 and not enabled by default: Linux commit: 90a545e restrict /dev/mem to idle io memory ranges As a workaround igb_uio can stop reserving PCI memory resources, from kernel point of view iomem region looks like idle and mmap works again. This matches uio_pci_generic usage. With this update device iomem range is not protected against any other kernel drivers or userspace access. But this shouldn't be a problem for dpdk usage module since purpose of the igb_uio module is to provide userspace access. Fixes: af75078fece3 ("first public release") Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index 45a5720..df41e45 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -342,16 +342,6 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) goto fail_free; } - /* - * reserve device's PCI memory regions for use by this - * module - */ - err = pci_request_regions(dev, "igb_uio"); - if (err != 0) { - dev_err(&dev->dev, "Cannot request regions\n"); - goto fail_disable; - } - /* enable bus mastering on the device */ pci_set_master(dev); @@ -441,8 +431,6 @@ fail_release_iomem: igbuio_pci_release_iomem(&udev->info); if (udev->mode == RTE_INTR_MODE_MSIX) pci_disable_msix(udev->pdev); - pci_release_regions(dev); -fail_disable: pci_disable_device(dev); fail_free: kfree(udev); @@ -460,7 +448,6 @@ igbuio_pci_remove(struct pci_dev *dev) igbuio_pci_release_iomem(&udev->info); if (udev->mode == RTE_INTR_MODE_MSIX) pci_disable_msix(dev); - pci_release_regions(dev); pci_disable_device(dev); pci_set_drvdata(dev, NULL); kfree(udev);