From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DB81DA00C5; Fri, 29 May 2020 10:49:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AE1471DBAB; Fri, 29 May 2020 10:49:13 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C3E811DA22 for ; Fri, 29 May 2020 10:49:11 +0200 (CEST) IronPort-SDR: rHMprhU2qQa/KRgynTbR0C2k1BsBrhBj19Xfh37iLjsEJgPuh/oKJWwrpDBLvDJ7w5wwcw3Mhu Kcoaj+inl2cQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2020 01:49:10 -0700 IronPort-SDR: oYk9gzvu+DwJehWlX6dw4aUghI51spz/nFnhpJja4qFzD4fweZJfaEc3ixEuuTnGkd+OfFSb9C 0OJK/gTwjntA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,448,1583222400"; d="scan'208";a="285469086" Received: from kolmos-mobl.ger.corp.intel.com (HELO [10.213.230.89]) ([10.213.230.89]) by orsmga002.jf.intel.com with ESMTP; 29 May 2020 01:49:08 -0700 To: Dmitry Kozlyuk Cc: dev@dpdk.org, Dmitry Malloy , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , Bruce Richardson References: <20200428235015.2820677-1-dmitry.kozliuk@gmail.com> <20200525003720.6410-1-dmitry.kozliuk@gmail.com> <20200525003720.6410-5-dmitry.kozliuk@gmail.com> <20200528174131.01d606bb@sovereign> From: "Burakov, Anatoly" Message-ID: <45bf549a-e974-b4e4-19d9-dba3393c574e@intel.com> Date: Fri, 29 May 2020 09:49:08 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200528174131.01d606bb@sovereign> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 04/11] eal/mem: extract common code for memseg list initialization 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 28-May-20 3:41 PM, Dmitry Kozlyuk wrote: > On Thu, 28 May 2020 12:46:49 +0100 > "Burakov, Anatoly" wrote: > >> On 25-May-20 1:37 AM, Dmitry Kozlyuk wrote: >>> All supported OS create memory segment lists (MSL) and reserve VA space >>> for them in a nearly identical way. Move common code into EAL private >>> functions to reduce duplication. >>> >>> Signed-off-by: Dmitry Kozlyuk >>> --- >> >> >> >>> +eal_memseg_list_alloc(struct rte_memseg_list *msl, int reserve_flags) >>> +{ >>> + uint64_t page_sz; >>> + size_t mem_sz; >>> + void *addr; >>> + >>> + page_sz = msl->page_sz; >>> + mem_sz = page_sz * msl->memseg_arr.len; >>> + >>> + addr = eal_get_virtual_area( >>> + msl->base_va, &mem_sz, page_sz, 0, reserve_flags); >>> + if (addr == NULL) { >>> + if (rte_errno == EADDRNOTAVAIL) >>> + RTE_LOG(ERR, EAL, "Cannot reserve %llu bytes at [%p] - " >>> + "please use '--" OPT_BASE_VIRTADDR "' option\n", >>> + (unsigned long long)mem_sz, msl->base_va); >> >> Do all OS's support this EAL option? > > Supported, yes; meaningful, not quite: for Windows, we start with address 0 > (let the OS choose) and using the option can hardly help. Probably Linux and > FreeBSD EALs should print this hint. For Windows, we can leave the option, > but not print misleading hint. > We keep rte_errno when exiting this function, do we not? How about we just check it in the caller? It's a bit of a hack, but will avoid OS-specific #ifdef-ery in the common code. Not sure if it's worth it though, over just having an #idef :) Up to you! -- Thanks, Anatoly