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 2968EA0517; Tue, 9 Jun 2020 15:36:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DC9ED4C90; Tue, 9 Jun 2020 15:36:14 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id EA4781E34 for ; Tue, 9 Jun 2020 15:36:13 +0200 (CEST) IronPort-SDR: WwHfBtP3K8YRIVY7OKj8z7zvyVNT3/9wmFtjQEUSmWM8o/hxWn+b3jndnQaDUjaN0G8n7/oErO 5dQJoKJQNPrg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2020 06:36:12 -0700 IronPort-SDR: IPMkEDocpFpr384YdYBnoSFlA+KlbVIjElEon5dkK8SRGJw5cIbaNIVyRnp/Ixy9WSzY90Ogg/ fTGXIht5EVVQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,492,1583222400"; d="scan'208";a="288833079" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.235.42]) ([10.213.235.42]) by orsmga002.jf.intel.com with ESMTP; 09 Jun 2020 06:36:10 -0700 To: Dmitry Kozlyuk , dev@dpdk.org Cc: Dmitry Malloy , Narcisa Ana Maria Vasile , Fady Bader , Tal Shnaiderman , Bruce Richardson References: <20200525003720.6410-1-dmitry.kozliuk@gmail.com> <20200602230329.17838-1-dmitry.kozliuk@gmail.com> <20200602230329.17838-5-dmitry.kozliuk@gmail.com> From: "Burakov, Anatoly" Message-ID: <255a3887-b187-e3b2-cf06-a0a67942e788@intel.com> Date: Tue, 9 Jun 2020 14:36:10 +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: <20200602230329.17838-5-dmitry.kozliuk@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 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 03-Jun-20 12:03 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 > --- > +int > +eal_memseg_list_alloc(struct rte_memseg_list *msl, int reserve_flags) > +{ > + size_t page_sz, 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) { > +#ifndef RTE_EXEC_ENV_WINDOWS > + /* The hint would be misleading on Windows, but this function > + * is called from many places, including common code, > + * so don't duplicate the message. > + */ > + 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); > + else > + RTE_LOG(ERR, EAL, "Cannot reserve memory\n"); > +#endif You're left without any error messages on Windows. How about: const char *err_str = "Cannot reserve memory\n"; #ifndef RTE_EXEC_ENV_WINDOWS if (rte_errno == EADDRNOTAVAIL) err_str = ... #endif RTE_LOG(ERR, EAL, err_str); or something like that? -- Thanks, Anatoly