From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP; 18 Jan 2017 09:05:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,249,1477983600"; d="scan'208";a="54502626" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.23]) ([10.237.221.23]) by orsmga005.jf.intel.com with ESMTP; 18 Jan 2017 09:05:30 -0800 To: Ben Walker , dev@dpdk.org, Jianfeng Tan References: <20170103223033.26313-1-benjamin.walker@intel.com> <20170103225600.51310-1-benjamin.walker@intel.com> From: Sergio Gonzalez Monroy Message-ID: Date: Wed, 18 Jan 2017 17:05:29 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20170103225600.51310-1-benjamin.walker@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] eal: Support running as unprivileged user 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: Wed, 18 Jan 2017 17:05:32 -0000 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