From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 687FDA051F;
	Wed, 10 Jun 2020 16:31:55 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 3BC721BE9B;
	Wed, 10 Jun 2020 16:31:55 +0200 (CEST)
Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com
 [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id D9CED1BF60
 for <dev@dpdk.org>; Wed, 10 Jun 2020 16:31:53 +0200 (CEST)
Received: by mail-lf1-f68.google.com with SMTP id d7so1565096lfi.12
 for <dev@dpdk.org>; Wed, 10 Jun 2020 07:31:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=vhPFh34OtrQtCN7WNL0V7cXeocUGuoeFrux+z0iQWbk=;
 b=epiQoLRL5S+eopxBPwsF3O4GYxwjO1tru3F4JgGyZt9FLnhEJbU2LL7r6JVKGXXshf
 jwZoTCNv6Wb2z6ljyBnigLbtnT/drZ6htUA/oQtQfCynn8iKmWDTtA2xTHSANAeNPcJg
 AiD8s/xe++QVAPlWTG+niQPAoHp6FCQA1h7CXmlS7hvkI64txLis/YA2p3SgyVynl9le
 eCfLW5NG09tv3SjCH3Y6C7cWKMM6RxwJE2rWW4708Rhe9xKmzqfJwv1FnvC5et1MqPTh
 55K9giK2xZrbQYjHyvNBf39L/0Y4tRCfuKYo2LeKPqgxCT26rjkynFcOKS07fkQexDRn
 ax1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=vhPFh34OtrQtCN7WNL0V7cXeocUGuoeFrux+z0iQWbk=;
 b=c9KkiykAJbNz8Ha0Fjd3ExWpVVbHsYX5M0+bGcxmqY5XaiTTlIEeu+XdIc2SFh+sVJ
 QyUcNEQAUSZrzBVtbIP7Yb+Xi4DNSZrEqH+AQsevH9iJam0q8ZGCEajiNIJvkCAFjzmW
 8Ih4HSondd5D03vhcn67BMshCCHo40anuAt7XKmq28CC0LDv47Bet09KmuhgLS8mvbtP
 i6s3eTRZYXH9xKgMrjvUObnusHQ9YNzegF9lfUL4s4AelVfUTUFIhopTbo5Zw3c+Eest
 rtBMBtmPnXaCL0ipYNvz0xYC7Tst+SU7tcf49I3hm5lnguvpfcokOYR53uXKHBousod1
 vFYQ==
X-Gm-Message-State: AOAM530qOPv2LcZ5BtHjRPUtStgfCaowZg2MmT/3aAL7jbKWFJjDSghE
 JEeLRdsrXbOkCcCcpoRNGlO7/YshLbcCew==
X-Google-Smtp-Source: ABdhPJx7fDGF4WH4+XNYzAf46S0yOO1LBC0NKHSISeyOQGw/6974aWAVU88zC65s8uvtU0RWpDC6Zg==
X-Received: by 2002:a19:be87:: with SMTP id o129mr1880155lff.217.1591799513463; 
 Wed, 10 Jun 2020 07:31:53 -0700 (PDT)
Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru.
 [37.110.65.23])
 by smtp.gmail.com with ESMTPSA id w6sm5030417ljw.11.2020.06.10.07.31.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 10 Jun 2020 07:31:52 -0700 (PDT)
Date: Wed, 10 Jun 2020 17:31:51 +0300
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, Dmitry Malloy <dmitrym@microsoft.com>, Narcisa Ana Maria
 Vasile <Narcisa.Vasile@microsoft.com>, Fady Bader <fady@mellanox.com>, Tal
 Shnaiderman <talshn@mellanox.com>, Bruce Richardson
 <bruce.richardson@intel.com>
Message-ID: <20200610173151.27f1a1aa@sovereign>
In-Reply-To: <a3eaab78-410b-c957-b1dd-84b5b219dc64@intel.com>
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>
 <a3eaab78-410b-c957-b1dd-84b5b219dc64@intel.com>
X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Wed, 10 Jun 2020 11:26:22 +0100
"Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:

[snip]
> >>> +	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.

Actually, callers don't need rte_errno, because we only have to distinguish
EADDRNOTAVAIL here, and eal_get_virtual_area() already prints precise
diagnostics at WARNING and ERR level. rte_errno is preserved, however.

-- 
Dmitry Kozlyuk