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 4FFEDA051A; Wed, 10 Jun 2020 12:26:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 932C72B83; Wed, 10 Jun 2020 12:26:28 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 9C73B29D6 for ; Wed, 10 Jun 2020 12:26:26 +0200 (CEST) IronPort-SDR: o/Zt/6Z5W7d8EuelCKNBzPWYaTWjPgap5ipHp7NnXBHjbtM2Qgbv++SRtm04t2BUmGApPHrUY3 a6HhzFYapkrw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2020 03:26:25 -0700 IronPort-SDR: pZKIRqFXNnYu5shhMunVJcJ1wb9jTMJWOEB1vmcWzdkifR/0Kl7Oz3EzNhyD4C8KLtHEytqfeK niF/9EHUueWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,495,1583222400"; d="scan'208";a="296163757" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.200.247]) ([10.213.200.247]) by fmsmga004.fm.intel.com with ESMTP; 10 Jun 2020 03:26:23 -0700 To: Dmitry Kozlyuk Cc: dev@dpdk.org, 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> <255a3887-b187-e3b2-cf06-a0a67942e788@intel.com> <20200609171733.7e3d9601@sovereign> From: "Burakov, Anatoly" Message-ID: Date: Wed, 10 Jun 2020 11:26:22 +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: <20200609171733.7e3d9601@sovereign> 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 09-Jun-20 3:17 PM, Dmitry Kozlyuk wrote: > On Tue, 9 Jun 2020 14:36:10 +0100 > "Burakov, Anatoly" wrote: > >> 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? >> > > How about removing generic error message here completely and printing more > specific messages at call sites? In fact, almost all of them already do this. > It would be more helpful in tracking down errors. > Agreed, let's do that :) We do pass up the rte_errno, correct? So, we should be able to do that. -- Thanks, Anatoly