DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Gagandeep Singh <g.singh@nxp.com>
Cc: dev@dpdk.org, Anatoly Burakov <anatoly.burakov@intel.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: Re: [v2 2/2] eal: add total memory size in memory dump APIs
Date: Wed, 9 Oct 2024 17:25:51 -0700	[thread overview]
Message-ID: <20241009172551.07dfa497@hermes.local> (raw)
In-Reply-To: <20240730110313.2555473-3-g.singh@nxp.com>

On Tue, 30 Jul 2024 16:33:13 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

> This patch add total memory size dump in memzone and
> memsegments dump APIs.
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
>  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));

  reply	other threads:[~2024-10-10  0:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 13:14 [PATCH 1/2] app/proc-info: add memory heap dump Gagandeep Singh
2024-07-02 13:14 ` [PATCH 2/2] eal: add total memory size in memory dump APIs Gagandeep Singh
2024-07-03  8:33 ` [PATCH 1/2] app/proc-info: add memory heap dump Hemant Agrawal
2024-07-29 17:18 ` Thomas Monjalon
2024-07-30 11:10   ` Gagandeep Singh
2024-07-30 11:03 ` [v2 0/2] proc-info memory dump enhancement Gagandeep Singh
2024-07-30 11:03   ` [v2 1/2] app/proc-info: add memory heap dump Gagandeep Singh
2024-10-10  7:16     ` [v3 " Gagandeep Singh
2024-10-10  7:16       ` [v3 2/2] eal: add total memory size in memory dump APIs Gagandeep Singh
2024-10-10 14:52         ` Stephen Hemminger
2024-10-10 14:53         ` Stephen Hemminger
2024-10-10 14:53       ` [v3 1/2] app/proc-info: add memory heap dump Stephen Hemminger
2024-07-30 11:03   ` [v2 2/2] eal: add total memory size in memory dump APIs Gagandeep Singh
2024-10-10  0:25     ` Stephen Hemminger [this message]
2024-10-11 13:15   ` [v2 0/2] proc-info memory dump enhancement David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241009172551.07dfa497@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=g.singh@nxp.com \
    --cc=roretzla@linux.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).