From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 20F9145AF9; Thu, 10 Oct 2024 02:25:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B575A4025E; Thu, 10 Oct 2024 02:25:56 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id 9D20640156 for ; Thu, 10 Oct 2024 02:25:55 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71df67c67fcso286512b3a.2 for ; Wed, 09 Oct 2024 17:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728519955; x=1729124755; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=vR8k60uMpYkQhpzDvZo69JvuGS8ZiZzNhDBSotn8q7c=; b=qutUExBMKMUenh/AzbmQyyykdBSaWq8H6eYIeTlGstOKq98RhrjN2WlQjx0hyvnthx H5zWofK7asFKea84gGu48sxvpKIVbrJJ7j3dqhkPn8uGlkip0g6cvqYIdSRPFZTWOcFE +G0er3rIA/LaXQjRP/Mu7L+nNUIlh+4hRrYmRLoLFUuq7A4BKOd+a351QCaf0K6IE94e rCinqGJNmbH2R9a2Pqdldh6vJ/KgWvM8Yl+NgDj3qhWmswDTsw+NRW1LphenIgNUvwyp U1dMURKligswPu7PBZmQEpGjMBsUHsQnryryXSkWKKMZgs8RcYtKy/j0/A49gBphLUQJ UBLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728519955; x=1729124755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vR8k60uMpYkQhpzDvZo69JvuGS8ZiZzNhDBSotn8q7c=; b=Ottd00t5TWOgrliYoMKo51/P/QO01eijtbzyz5DKpow/C9SmbgaYcM8nusxR+HV1bZ OY+gPidOtc2Wmwwf8q045wmxitd5DoxG3UsUDPedhQimCM2hVTdAc4qeKZXdS45sMG5t fvISKRaFJTPbjLRquWpv4MOufrTfmEdodhKZb6NYw0btFdM3fFJ3jbhGt9v8rdfIrRkf Zv4gVN8S5I54Nkie18ZY7WlwsC62phgBApKqnA8qlq6g6CP/6KozYhTvO8fr2TGZbe5Z Apcr7cI84/kztyyooZhWyHN6zALvkViA6UNvZVe5Xczc6uCJiwKbvasJdz30JDlpA/83 Q+Kw== X-Gm-Message-State: AOJu0YwyVwA1VjzDq4PZl3WSA3C2DSlKpjRst6c7Ojx8kMOGFeAyvyu1 ZmDFRT+V44e1fPGO58auv9g1Fj+clEGuAy73g0VOIuK4zNHzH2AYV5Y3NJPThkA= X-Google-Smtp-Source: AGHT+IEIV8lA/gIoawamqR7pc/s70mrJfqUjgtvDo7+i+Ok/5mwkIKubKSIFU863HHlZK0p6C219gA== X-Received: by 2002:a05:6a00:2d8d:b0:71d:ee1b:c854 with SMTP id d2e1a72fcca58-71e1db744a6mr7485454b3a.9.1728519954651; Wed, 09 Oct 2024 17:25:54 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e2a9ea3edsm19301b3a.19.2024.10.09.17.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 17:25:54 -0700 (PDT) Date: Wed, 9 Oct 2024 17:25:51 -0700 From: Stephen Hemminger To: Gagandeep Singh Cc: dev@dpdk.org, Anatoly Burakov , Tyler Retzlaff Subject: Re: [v2 2/2] eal: add total memory size in memory dump APIs Message-ID: <20241009172551.07dfa497@hermes.local> In-Reply-To: <20240730110313.2555473-3-g.singh@nxp.com> References: <20240702131436.2873832-1-g.singh@nxp.com> <20240730110313.2555473-1-g.singh@nxp.com> <20240730110313.2555473-3-g.singh@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 30 Jul 2024 16:33:13 +0530 Gagandeep Singh wrote: > This patch add total memory size dump in memzone and > memsegments dump APIs. > > Signed-off-by: Gagandeep Singh > --- > lib/eal/common/eal_common_memory.c | 2 ++ > lib/eal/common/eal_common_memzone.c | 18 ++++++++++++++++-- > 2 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/lib/eal/common/eal_common_memory.c b/lib/eal/common/eal_common_memory.c > index 60ddc30580..c6b9c16617 100644 > --- a/lib/eal/common/eal_common_memory.c > +++ b/lib/eal/common/eal_common_memory.c > @@ -531,6 +531,8 @@ void > rte_dump_physmem_layout(FILE *f) > { > rte_memseg_walk(dump_memseg, f); > + fprintf(f, "Total Memory Segments size = %uM\n", > + (unsigned int) rte_eal_get_physmem_size() / (1024 * 1024)); > } You are going to get truncated result here because rte_eal_get_physmem_size() is uint64_t and unsigned int is 32 bit. The cast happens before the division which leads to truncation with 4G. Simplest fix would be fprintf(f, "Total Memory Segments size = %"PRIu64"M\n", rte_eal_get_physmem_size() / (1024 * 1024));