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 0630F4554D; Tue, 2 Jul 2024 15:14:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1859C4067C; Tue, 2 Jul 2024 15:14:55 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2043.outbound.protection.outlook.com [40.107.241.43]) by mails.dpdk.org (Postfix) with ESMTP id 6F1AA406BC for ; Tue, 2 Jul 2024 15:14:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VncCYaTYT+0BG+MC8EIYXymTMdieCxLHB1QXK7Mc2FEf57hZsxl1WbaeTg+krXTRr7XYrBXUreYB03ReHE+NkAcNrmfGaIQp9uxguvlKl7vieEib3QOF0ksGCr2AGqDfxLHo/CZ5ZeBi1mhhVBM+422G8Bfw0tPcDMcEHnisDPchBBv5Q8n0Y3g9gTegURPG9QpZxXlUp7gi+EUCbSdio4V9lexzB7jOw/mwyh4JSHFuOSqH2FEJn8jPGV/YlKekZ9nM+/0IWtnSgRP4daN+lZ5gCXYBTgwKXMPoV831GQlmk0e6xPAEpyufxyQ5j1N5zMw9b712evRjicmfO0Y0Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=98F9tSlMTsCfufCHeD6CXVNQMPiJuN2C9qxTBzbq4Wo=; b=bLoDd3tyxzi1bwM5vn6Za1Hf0VXRZluy9YZsHYuptjek9smuoGS2lVqG260tOwePIUiNmfPfCwx+MULswS/vHp5Bm8kJc/ZD9nA6bIPlvPC19KZs/UcX2a/W+ChO4/l0NY8iq9sx/2m7yedFz4TvkvwMiZBsKICWnv3a6o1fc2u7/LTlz65hoYsH67QQ7ZG57l+CiiG0fiqNkhmH9F/W7sqS4bGHDwn9mo9WU2SPFP20/RflGn8baVa03aX3cGBa05GNABwhLE9gYr9trmlQVcHygZrnUOWFQJ0w0ldNuwMN3lm7jIid/zwevohQhIt2hGNyLgmDzFwd4nwya6t9bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=98F9tSlMTsCfufCHeD6CXVNQMPiJuN2C9qxTBzbq4Wo=; b=CbFPKlhHT4lz7DaSQwGz0pz5tsaau7P450zNQPGdrxCbrQ9hMdAdzHQqQfnPt/chGifNeMACpzYS5oosg1B++cMD+3jdA+D3sUmn2svS+N04n/agYQGQAwsm3tl3SDm+nutLUCgl9a/lIkeieHReIDQlXE09zmr3VUIblnwYGj4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by PAXPR04MB8799.eurprd04.prod.outlook.com (2603:10a6:102:20e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.28; Tue, 2 Jul 2024 13:14:52 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%7]) with mapi id 15.20.7719.029; Tue, 2 Jul 2024 13:14:52 +0000 From: Gagandeep Singh To: dev@dpdk.org, Anatoly Burakov , Tyler Retzlaff Cc: hemant.agrawal@nxp.com Subject: [PATCH 2/2] eal: add total memory size in memory dump APIs Date: Tue, 2 Jul 2024 18:44:36 +0530 Message-Id: <20240702131436.2873832-2-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240702131436.2873832-1-g.singh@nxp.com> References: <20240702131436.2873832-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|PAXPR04MB8799:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f45ca0a-1f98-46a6-c6c9-08dc9a98f59b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YnLJOyxDFlgNYM2AoUp/Me3qa2ETtR2BQPgwAvUu/caxNkCFdub2yUOqGLHX?= =?us-ascii?Q?TrS5KyltD1yTqNCd7K+aL59+fzxq4q679xEUxFupMJCXnxdB84Zp2Ut3XdFo?= =?us-ascii?Q?S/VdmzaDInjjLAWNmWqjzBLIc9+8gom7Oo4PGmrtJ1s7FFB6tNnJpsHUv5mU?= =?us-ascii?Q?fub0+JEoH0W4VUwdyiZhqkLvAX20SL8WRAvdUgy6BgWbrABZeFpcHlHbFQ2X?= =?us-ascii?Q?v1X93hm5woTJR8c5AiQ9Lt0DXaHPD8WwdyNaklCsyOMLGabJ97+XmDvDmp70?= =?us-ascii?Q?2dG53LExxqQULrr0940zFf/PTlBbprcloRtFZjJOWCVz9Dh0jDYLbVUWijlS?= =?us-ascii?Q?uBcfl6iN8m9CQNvpwj0Mu/IGmy9XsvsAv46tvk0hO/hlpG98wnPupinpBwV2?=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smk8QYthWwddZN6E?= =?us-ascii?Q?oM/r4biaunZyRmklb/tHd0xdlJDzd09l5TtbNK3D4VhQHXj1MPQ20fmWTYad?= =?us-ascii?Q?Ey2R7C8W1r0Wc8AUy/CZKLLO97loUsd9eSZmG8sqnGyk6M9J+w=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GnnXLBtLxE1iBSzcqUJ//ATdCvovg0pniMUroW8MqNv1xQPprQQMf4ZRetxQ?= =?us-ascii?Q?dVSswLASfq4ZvXK+GSBbJWCVCu7XkWWr3O4GI1cL+iuOhG1E26ufPWFdN32p?= =?us-ascii?Q?4rj/yPlbby8slIwNooNxmNMXav5/LcKxPNf2+E0OjKJG7OC42d4ZqhETk5VY?= =?us-ascii?Q?KOjvV5VUDfTgP8ujL6mea8RcAafGhllf88aeeInrAPBd+BRfLc6zU9PdFLrE?= =?us-ascii?Q?gR8LfRKl4cegB6A0GYDetYWsjz2LV6Vt9bsC5Pry+D42vsTsNi05nstg8Ec7?= =?us-ascii?Q?/8vCsSLrUaEnKS9GVYKa0REGZTVdq8bGClqkyDGZzLmwK6cJeP+H9Sb9JFhE?= =?us-ascii?Q?96oQUpD/FvaNRidOiBMJFhyrvmL69xEivujirF6gMWZorg2B927SV4VyMdxJ?= =?us-ascii?Q?MGQ7qukqsZFMJZXOmx9byeUNn+ALhJRAWosufO2HEmMAMvjOHytfnACeAzK3?= =?us-ascii?Q?jleQuHK5jM8dA3K0zEJXgDx5Y1J4lLcNjuGrxUWDNKxhYQ4IZscxZYzUMQyZ?= =?us-ascii?Q?xnZtL4vIAyLrfzfcipfSiPv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YyMP8zPiW5lK/MCNgy3TtrlpJGfTubMMflKbTqjXBIn8g1ETgw2wuVCbot?= =?us-ascii?Q?46L+Ouyw4q5FxHkL6O59rSFF9pXQ/rjsfm+le/MQ4SWBtu2J6iKTtTEnoJrW?= =?us-ascii?Q?nZkyNq6xJyEqfy84qkI=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f45ca0a-1f98-46a6-c6c9-08dc9a98f59b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2024 13:14:52.7889 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GaPa3q8fOdsdkACARrXTvBFPZPJ+4uaMTlEYU+rXCppjsRdBWdTV9TYklumuAyh3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8799 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 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)); } static int diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 32e6b78f87..1d12ccc443 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -58,6 +58,11 @@ rte_memzone_max_get(void) return mcfg->max_memzone; } +struct memzone_info { + FILE *f; + uint64_t t_size; +}; + static inline const struct rte_memzone * memzone_lookup_thread_unsafe(const char *name) { @@ -369,7 +374,8 @@ dump_memzone(const struct rte_memzone *mz, void *arg) struct rte_memseg *ms; int mz_idx, ms_idx; size_t page_sz; - FILE *f = arg; + struct memzone_info *info = arg; + FILE *f = info->f; mz_idx = rte_fbarray_find_idx(&mcfg->memzones, mz); @@ -382,6 +388,7 @@ dump_memzone(const struct rte_memzone *mz, void *arg) mz->socket_id, mz->flags); + info->t_size += mz->len; /* go through each page occupied by this memzone */ msl = rte_mem_virt2memseg_list(mz->addr); if (!msl) { @@ -414,7 +421,14 @@ dump_memzone(const struct rte_memzone *mz, void *arg) void rte_memzone_dump(FILE *f) { - rte_memzone_walk(dump_memzone, f); + struct memzone_info info; + + memset(&info, 0, sizeof(info)); + info.f = f; + + rte_memzone_walk(dump_memzone, &info); + fprintf(f, "Total Memory Zones size = %uM\n", (unsigned int)info.t_size + / (1024 * 1024)); } /* -- 2.25.1