From patchwork Tue Jul 30 11:03:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gagandeep Singh X-Patchwork-Id: 142756 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 810CF456F4; Tue, 30 Jul 2024 14:04:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B24DB40616; Tue, 30 Jul 2024 14:04:11 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013002.outbound.protection.outlook.com [52.101.67.2]) by mails.dpdk.org (Postfix) with ESMTP id 9E02F400D7 for ; Tue, 30 Jul 2024 13:03:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nPbPpE3319b1Ul75ZxnKOQ8SMfEjYqIigFTWwoGdNq0VUhYqe05rKorgGDkSGvRhxQZQ/Dj5BmGYvvKh8VXTOlVkvgNU1F12u+pmr5jQOMNZJbOoeScbJRKzHRwqOs6jiuc57jfDkNZpre7YBME6BloXjYi3cFcDR/+XSEjln3qSU4isQqmaLUZKanMUcmOiklpcanP0zHeD/D6VrG6igzELM9fMcOGauTC0cneoWlFJcGxflPdMRcxBKOdGQmxVyM7PP9r6F0VwpKTmcVD1XdI0tiqkF70Ubd+9vB0q2zgRTgyV71V2HV5Kni1HujBp/eCXLTYN3ZKqFA+12NnRbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=pqsTftf2gOlJmeNdGmTfdgJvS1Kw2R4Ab+YlOfJsTm8=; b=qI/TO8RB2FwMu6B7jae9fS2NmUcvLd4iQezgUzK79N4enpX3GuM0H96NLh/nqUewl/sYzQwm5UGXlxzdtTg9rn180vdytcaBDQnz1YXzpWa+NLx1aBOrodHQzw8rhLMPGtPSh9vtdnhjhK8lD9B2OSLhz73Q1S9GEsJjiJhBTs0Fcr0ddNqpBYr4qgNzSMAiQoSlmLZ96/CjcBnAiUCsAsfj/Rh8SI/R2SPaXawr21+ZxKJmmEAdfSN2GXMC5ox0FtWU8w9HjZcrdq7B+sphL+b0v7bu2/kVUiYwF+y0saWNOk+FFQmwb+mKWiJGt7Mmzy+PTRB7F67fe/TPjoXCWw== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pqsTftf2gOlJmeNdGmTfdgJvS1Kw2R4Ab+YlOfJsTm8=; b=lRyZTH4FL7X09czC79q+DuCiJdMHhiZLC2jU1ojWQqYJEGmGbq22JvOeHNHCQRWQBzaGAdCx8ZdIu7EnqFqUJzOezj3oaxQUmJ1FKuOtxUhfTloQhUjdpfI8JsBAxOB5NtLdY/DCJR7qz4xT+Z5FvHbBnb2+rxJlXmDGuQ9OJGFlgLl4qTZnCrpExx8d4QHvgPVTK+BPLfTH/eYDnER6ArLYfBEeqb9Vn3cf3TRnReCFWB6ru6wBcYHpqtBIb9j38gE3e3lzohpXm2jdRBAIZfksR1kA/rGvf7DAfLrQgrwRuufSq5/KrWH5vJU2wiBDSQHxOn0b3x86Aez4CBLXjQ== 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 AS5PR04MB10018.eurprd04.prod.outlook.com (2603:10a6:20b:67e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.26; Tue, 30 Jul 2024 11:03:31 +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.7807.026; Tue, 30 Jul 2024 11:03:31 +0000 From: Gagandeep Singh To: dev@dpdk.org, Anatoly Burakov , Tyler Retzlaff Subject: [v2 2/2] eal: add total memory size in memory dump APIs Date: Tue, 30 Jul 2024 16:33:13 +0530 Message-Id: <20240730110313.2555473-3-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240730110313.2555473-1-g.singh@nxp.com> References: <20240702131436.2873832-1-g.singh@nxp.com> <20240730110313.2555473-1-g.singh@nxp.com> X-ClientProxiedBy: SI2PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:195::10) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|AS5PR04MB10018:EE_ X-MS-Office365-Filtering-Correlation-Id: 57c4abd4-81e7-470d-4cb7-08dcb0873f74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: +5p+N8HRCUo5W0dE+nCf9sqTsjSy0Ca7vhvMvuiJshpTHyATN34vDt0WcuMeeE3/xQxoB+oir32fGwAB13cZQZqqjwxaRb+zF0bLKR9O8ebvzDXo7Qtl+fhIOccACAnnUNwPC9k8pLKEqkV5J9sSoDa0vvnwsSWhh0IbQlIqeuBy6DPLv37XwnbW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T6octEvevm1MB8IMKy/Y9fzt/dnnl0TiJVZAnMUZAcqBTIrlmusiJ7zrCbkw5gjr0B8MQnO9R3BJPUGb9YOxACerxVi+Wpfom5DDyO7DH3emEphvOET1XxqQOxYayPQDDDOQ0CNjYk+tX9VaOEMpVkGIfTPCLduSFpATjnF1Vm7KKvA== 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)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AT52oN68YDrrsBiWLGKqV7DhlVju+CMnG4x4XsOxEYX4aroIHvlYQ5rrYPo/wnVxP+nO4eBYB/lXqKCZqqJuSAbOWFQL4VmAvzVjuQki2xizjk3QAZlHNFTHmqVPOqcleenbxogtUjtjIZVafoXga3LVuTfjotVXdt9kg4aTBtr0AJEAYSP1pAoOw2jKJoczCtLKb+RGSt1X1omp6cQei4xmy4wUr/K5f1L+xtpYOM0F77YiXXQe/um0/BE3vwtHopICWHFy/MBJqKazYMlAXLNoRgo6gc9o/goPq01AEuvbWdXoO7P3+Lmm1xEAnycw1lsdyubcSfbxqrmMayQMxlsNNBLARIkEeZyzGDb3wNKFLLwLJHtQnSZgNUEwp5U+48ULRZNnk9VOxLeeXyGs2LAQXjHIPneLVgVu45wGtlk+cxpSpeyMOqiCG3pFG2YxJ4ivEFGE10aMT/1RUYfilc87jwfjJSfPXt7GVYC0O3cZWvl1RkeotrH2JF+BFulpaEtpTHWp4O5Yukdm0b2iJPigEdQBggfP10otHMbY5dVB/ZDWwAbcGXFqopQl/BYR1oWp/H4aqvvNE5zFpxGiZGSHZttJ20SPVXrLjeA9/dshYe6z982kMHkZ2BzjkzYLyiTrgTua7S8dLfWPaO6o1xYbdXvZsySBK5U8YNm/TLRtJCO3BbQ/j/nJJBBlTN8Lf0L/ZC2rJZF0JHNdOH/TILLvgLCbBaE22TjPSP1mANX5P2HTp9yF7wX8UWgF8UVR6WDVNHxKbMubijWRhh22G9LIxRLXZzayJOVVDagtX6fdc1id+J8ZDb3FnA012Cng435NlqwIgI4Ve1UqfPSyDBUkV5xppHppcE2f3J78wydV7uaNSZtEo+8flH3UrMt4bizx398c/gWz0qB/ULtvueUg+ELI4LHlFws9tlCvDkSbAXoq+8tvdSEfUJdT4USHAkSqxStDtqcHvB7IpLBodfvNG/WWB2OUQ4Va78A3bdwRzVdxdZPbkMLIfXRmEUSVQ5B49TwKRVawjjmYWcnmj6biF/29LuV1NvQGwe6AhwMVGiCcp5MTgdk5SfzRdXm/DTqrTEhwq0DukSC2PhwVOJm9Omb+Jl5TF8JGCAU/C9Wi0m20W2ymcbkuY/7FSGawQ7jm0jznXoxfEnW95yqXPy/iK2JOvmG3iQ4UhLV6Tx+AWGypoQ/DlOboM9NxUPdgmSHkOCnAkVMwx46X+MGJCJ8zuwii9BYTfD5+qhot/Zo654h4XCVJfFTWt8Q1jOxDmirZ27xs+N1WI/Y59wKonmcmJUm5ei4qxgwV9+gbbZr7vT5IhOe4SEeq7YunDOmMnncfY9d+00UvpoooZoqHITuqD9/DFo1bmv7UQ0GTBmrZCYSf0HHPJv4fSPVNds2DbDUGrY3zBFsMHjKmH5vzDU9pMQJqsxYCNUgt0yAjY0nNZTVnzxh+9Q48nauAbPEaUl6dqG2o8NS1dupsB5puTPfH07xw2MM7h+Fu0PETF2Vc+GHwCwdyTF0Ux2QY25dycxn5SkvL5UOJ5/ru+kOWbwlROmCnMFCKG/CP+3r3oLth3Za7Qp7rETbuBwz2qr1x X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57c4abd4-81e7-470d-4cb7-08dcb0873f74 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 11:03:31.2985 (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: Wg+BDJJUljj6lLS3Q8ArjjdOZKvMjLBEQBxEqggbvwWb+0WSuEhYEUk1lB3PRBOY X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10018 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 2d9b6aa3e3..4cd077d8d8 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) { @@ -367,7 +372,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); @@ -380,6 +386,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) { @@ -412,7 +419,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)); } /*