From patchwork Fri Jul 1 15:07:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 14503 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 454492BAB; Fri, 1 Jul 2016 17:08:13 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 71E562BA8 for ; Fri, 1 Jul 2016 17:08:11 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 01 Jul 2016 08:08:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.26,557,1459839600"; d="scan'208"; a="1008998426" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2016 08:08:02 -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 u61F80eT009403; Fri, 1 Jul 2016 16:08:00 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u61F80hg016242; Fri, 1 Jul 2016 16:08:00 +0100 Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u61F8059016238; Fri, 1 Jul 2016 16:08:00 +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:07:58 +0100 Message-Id: <1467385678-16205-1-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1467372912-31113-1-git-send-email-ferruh.yigit@intel.com> References: <1467372912-31113-1-git-send-email-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v2] igb_uio: fix possible mmap failure for Linux > v4.3 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.4 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);