From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergio Gonzalez Monroy Subject: Re: [PATCH v2] eal: Support running as unprivileged user Date: Wed, 18 Jan 2017 17:05:29 +0000 Message-ID: References: <20170103223033.26313-1-benjamin.walker@intel.com> <20170103225600.51310-1-benjamin.walker@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit To: Ben Walker , dev@dpdk.org, Jianfeng Tan Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 78395FABB for ; Wed, 18 Jan 2017 18:05:32 +0100 (CET) In-Reply-To: <20170103225600.51310-1-benjamin.walker@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 03/01/2017 22:56, Ben Walker wrote: > For Linux kernel 4.0 and newer, the ability to obtain > physical page frame numbers for unprivileged users from > /proc/self/pagemap was removed. Instead, when an IOMMU > is present, simply choose our own DMA addresses instead. > > Signed-off-by: Ben Walker > @@ -255,6 +257,22 @@ find_physaddrs(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi) > } > > /* > + * For each hugepage in hugepg_tbl, fill the physaddr value sequentially. > + */ > +static int > +set_physaddrs(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi) > +{ > + unsigned int i; > + phys_addr_t addr = 0; > + > + for (i = 0; i < hpi->num_pages[0]; i++) { > + hugepg_tbl[i].physaddr = addr; > + addr += hugepg_tbl[i].size; > + } > + return 0; > +} > + Sorry for late catch, but when having multiple hugepage sizes, both would be mapped from address 0. I thin making the var static should be enough. Also I would prefer some randomness on the start address instead of always 0. Thanks, Sergio