Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/35728/?format=api
http://patches.dpdk.org/api/patches/35728/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/d5db616fae3e3a2bc1b6b95a18278b70feff5b89.1520428025.git.anatoly.burakov@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<d5db616fae3e3a2bc1b6b95a18278b70feff5b89.1520428025.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/d5db616fae3e3a2bc1b6b95a18278b70feff5b89.1520428025.git.anatoly.burakov@intel.com", "date": "2018-03-07T16:56:32", "name": "[dpdk-dev,v2,04/41] eal: add function to dump malloc heap contents", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "dc34bee0f3c4e78b21d1b655011678ce489d678f", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Burakov, Anatoly", "email": "anatoly.burakov@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/d5db616fae3e3a2bc1b6b95a18278b70feff5b89.1520428025.git.anatoly.burakov@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/35728/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/35728/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D36E2A495;\n\tWed, 7 Mar 2018 17:57:26 +0100 (CET)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id EA9E34C8F\n\tfor <dev@dpdk.org>; Wed, 7 Mar 2018 17:57:15 +0100 (CET)", "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t07 Mar 2018 08:57:15 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga005.jf.intel.com with ESMTP; 07 Mar 2018 08:57:10 -0800", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw27GvAFC032352; Wed, 7 Mar 2018 16:57:10 GMT", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w27GvA8x006638;\n\tWed, 7 Mar 2018 16:57:10 GMT", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w27GvABN006634;\n\tWed, 7 Mar 2018 16:57:10 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.47,436,1515484800\"; d=\"scan'208\";a=\"206261551\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "keith.wiles@intel.com, jianfeng.tan@intel.com, andras.kovacs@ericsson.com,\n\tlaszlo.vadkeri@ericsson.com, benjamin.walker@intel.com,\n\tbruce.richardson@intel.com, thomas@monjalon.net,\n\tkonstantin.ananyev@intel.com, kuralamudhan.ramakrishnan@intel.com,\n\tlouise.m.daly@intel.com, nelio.laranjeiro@6wind.com,\n\tyskoh@mellanox.com, pepperjo@japf.ch, jerin.jacob@caviumnetworks.com, \n\themant.agrawal@nxp.com, olivier.matz@6wind.com", "Date": "Wed, 7 Mar 2018 16:56:32 +0000", "Message-Id": "<d5db616fae3e3a2bc1b6b95a18278b70feff5b89.1520428025.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1520428025.git.anatoly.burakov@intel.com>", "<cover.1520428025.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1520428025.git.anatoly.burakov@intel.com>", "<cover.1520083504.git.anatoly.burakov@intel.com>\n\t<cover.1520428025.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v2 04/41] eal: add function to dump malloc heap\n\tcontents", "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Malloc heap is now a doubly linked list, so it's now possible to\niterate over each malloc element regardless of its state.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/include/rte_malloc.h | 9 +++++++++\n lib/librte_eal/common/malloc_elem.c | 24 ++++++++++++++++++++++++\n lib/librte_eal/common/malloc_elem.h | 6 ++++++\n lib/librte_eal/common/malloc_heap.c | 22 ++++++++++++++++++++++\n lib/librte_eal/common/malloc_heap.h | 3 +++\n lib/librte_eal/common/rte_malloc.c | 16 ++++++++++++++++\n lib/librte_eal/rte_eal_version.map | 1 +\n 7 files changed, 81 insertions(+)", "diff": "diff --git a/lib/librte_eal/common/include/rte_malloc.h b/lib/librte_eal/common/include/rte_malloc.h\nindex f02a8ba..a3fc83e 100644\n--- a/lib/librte_eal/common/include/rte_malloc.h\n+++ b/lib/librte_eal/common/include/rte_malloc.h\n@@ -278,6 +278,15 @@ void\n rte_malloc_dump_stats(FILE *f, const char *type);\n \n /**\n+ * Dump contents of all malloc heaps to a file.\n+ *\n+ * @param f\n+ * A pointer to a file for output\n+ */\n+void\n+rte_malloc_dump_heaps(FILE *f);\n+\n+/**\n * Set the maximum amount of allocated memory for this type.\n *\n * This is not yet implemented\ndiff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c\nindex eb41200..e02ed88 100644\n--- a/lib/librte_eal/common/malloc_elem.c\n+++ b/lib/librte_eal/common/malloc_elem.c\n@@ -1,6 +1,7 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2010-2014 Intel Corporation\n */\n+#include <inttypes.h>\n #include <stdint.h>\n #include <stddef.h>\n #include <stdio.h>\n@@ -434,3 +435,26 @@ malloc_elem_resize(struct malloc_elem *elem, size_t size)\n \t}\n \treturn 0;\n }\n+\n+static inline const char *\n+elem_state_to_str(enum elem_state state)\n+{\n+\tswitch (state) {\n+\tcase ELEM_PAD:\n+\t\treturn \"PAD\";\n+\tcase ELEM_BUSY:\n+\t\treturn \"BUSY\";\n+\tcase ELEM_FREE:\n+\t\treturn \"FREE\";\n+\t}\n+\treturn \"ERROR\";\n+}\n+\n+void\n+malloc_elem_dump(const struct malloc_elem *elem, FILE *f)\n+{\n+\tfprintf(f, \"Malloc element at %p (%s)\\n\", elem,\n+\t\t\telem_state_to_str(elem->state));\n+\tfprintf(f, \" len: 0x%zx pad: 0x%\" PRIx32 \"\\n\", elem->size, elem->pad);\n+\tfprintf(f, \" prev: %p next: %p\\n\", elem->prev, elem->next);\n+}\ndiff --git a/lib/librte_eal/common/malloc_elem.h b/lib/librte_eal/common/malloc_elem.h\nindex 238e451..40e8eb5 100644\n--- a/lib/librte_eal/common/malloc_elem.h\n+++ b/lib/librte_eal/common/malloc_elem.h\n@@ -149,6 +149,12 @@ int\n malloc_elem_resize(struct malloc_elem *elem, size_t size);\n \n /*\n+ * dump contents of malloc elem to a file.\n+ */\n+void\n+malloc_elem_dump(const struct malloc_elem *elem, FILE *f);\n+\n+/*\n * Given an element size, compute its freelist index.\n */\n size_t\ndiff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c\nindex 9c95166..44538d7 100644\n--- a/lib/librte_eal/common/malloc_heap.c\n+++ b/lib/librte_eal/common/malloc_heap.c\n@@ -217,6 +217,28 @@ malloc_heap_get_stats(struct malloc_heap *heap,\n \treturn 0;\n }\n \n+/*\n+ * Function to retrieve data for heap on given socket\n+ */\n+void\n+malloc_heap_dump(struct malloc_heap *heap, FILE *f)\n+{\n+\tstruct malloc_elem *elem;\n+\n+\trte_spinlock_lock(&heap->lock);\n+\n+\tfprintf(f, \"Heap size: 0x%zx\\n\", heap->total_size);\n+\tfprintf(f, \"Heap alloc count: %u\\n\", heap->alloc_count);\n+\n+\telem = heap->first;\n+\twhile (elem) {\n+\t\tmalloc_elem_dump(elem, f);\n+\t\telem = elem->next;\n+\t}\n+\n+\trte_spinlock_unlock(&heap->lock);\n+}\n+\n int\n rte_eal_malloc_heap_init(void)\n {\ndiff --git a/lib/librte_eal/common/malloc_heap.h b/lib/librte_eal/common/malloc_heap.h\nindex ab0005c..bb28422 100644\n--- a/lib/librte_eal/common/malloc_heap.h\n+++ b/lib/librte_eal/common/malloc_heap.h\n@@ -37,6 +37,9 @@ int\n malloc_heap_get_stats(struct malloc_heap *heap,\n \t\tstruct rte_malloc_socket_stats *socket_stats);\n \n+void\n+malloc_heap_dump(struct malloc_heap *heap, FILE *f);\n+\n int\n rte_eal_malloc_heap_init(void);\n \ndiff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c\nindex 970813e..80fb6cc 100644\n--- a/lib/librte_eal/common/rte_malloc.c\n+++ b/lib/librte_eal/common/rte_malloc.c\n@@ -182,6 +182,22 @@ rte_malloc_get_socket_stats(int socket,\n }\n \n /*\n+ * Function to dump contents of all heaps\n+ */\n+void\n+rte_malloc_dump_heaps(FILE *f)\n+{\n+\tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n+\tunsigned int socket;\n+\n+\tfor (socket = 0; socket < rte_num_sockets(); socket++) {\n+\t\tfprintf(f, \"Heap on socket %i:\\n\", socket);\n+\t\tmalloc_heap_dump(&mcfg->malloc_heaps[socket], f);\n+\t}\n+\n+}\n+\n+/*\n * Print stats on memory type. If type is NULL, info on all types is printed\n */\n void\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 52f5940..18b8bf5 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -215,6 +215,7 @@ DPDK_18.05 {\n \tglobal:\n \n \trte_num_sockets;\n+\trte_malloc_dump_heaps;\n \n } DPDK_18.02;\n \n", "prefixes": [ "dpdk-dev", "v2", "04/41" ] }{ "id": 35728, "url": "