From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 22B433256 for ; Thu, 5 Oct 2017 02:06:43 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2017 17:06:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,479,1500966000"; d="scan'208";a="906861906" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.241.225.26]) ([10.241.225.26]) by FMSMGA003.fm.intel.com with ESMTP; 04 Oct 2017 17:06:42 -0700 To: Changpeng Liu , dev@dpdk.org References: <1496530644-8393-1-git-send-email-changpeng.liu@intel.com> From: Ferruh Yigit Message-ID: Date: Thu, 5 Oct 2017 01:06:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1496530644-8393-1-git-send-email-changpeng.liu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] pci/uio: enable prefetchable resources mapping X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 00:06:44 -0000 On 6/3/2017 11:57 PM, Changpeng Liu wrote: > For PCI prefetchable resources, Linux will create a > write combined file as well, the library will try > to map resourceX_wc file first, if the file does > not exist, then it will map resourceX as usual. Hi Changpeng, Code part looks OK, but can you please describe more why we should try write combined resource file first, what is the benefit of using it _wc file? Thanks, ferruh > > Signed-off-by: Changpeng Liu > --- > lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > index fa10329..d9fc20a 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > @@ -321,7 +321,7 @@ > > /* update devname for mmap */ > snprintf(devname, sizeof(devname), > - "%s/" PCI_PRI_FMT "/resource%d", > + "%s/" PCI_PRI_FMT "/resource%d_wc", > pci_get_sysfs_path(), > loc->domain, loc->bus, loc->devid, > loc->function, res_idx); > @@ -335,13 +335,22 @@ > } > > /* > - * open resource file, to mmap it > + * open prefetchable resource file first, try to mmap it > */ > fd = open(devname, O_RDWR); > if (fd < 0) { > - RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", > - devname, strerror(errno)); > - goto error; > + snprintf(devname, sizeof(devname), > + "%s/" PCI_PRI_FMT "/resource%d", > + pci_get_sysfs_path(), > + loc->domain, loc->bus, loc->devid, > + loc->function, res_idx); > + /* then try to map resource file */ > + fd = open(devname, O_RDWR); > + if (fd < 0) { > + RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", > + devname, strerror(errno)); > + goto error; > + } > } > > /* try mapping somewhere close to the end of hugepages */ >