Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/42507/?format=api
http://patches.dpdk.org/api/patches/42507/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/41225d71752906662b81fe939cd7fe47994133e1.1530881548.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": "<41225d71752906662b81fe939cd7fe47994133e1.1530881548.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/41225d71752906662b81fe939cd7fe47994133e1.1530881548.git.anatoly.burakov@intel.com", "date": "2018-07-06T13:17:31", "name": "[RFC,10/11] malloc: allow destroying heaps", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "34f40635e6d599064f0ec76302fbc6fbae2a8b34", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Burakov, Anatoly", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/41225d71752906662b81fe939cd7fe47994133e1.1530881548.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 453, "url": "http://patches.dpdk.org/api/series/453/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=453", "date": "2018-07-06T13:17:21", "name": "Support externally allocated memory in DPDK", "version": 1, "mbox": "http://patches.dpdk.org/series/453/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/42507/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/42507/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 4CE041BF28;\n\tFri, 6 Jul 2018 15:17:53 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id D2AC51BE9C\n\tfor <dev@dpdk.org>; Fri, 6 Jul 2018 15:17:40 +0200 (CEST)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t06 Jul 2018 06:17:40 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 06 Jul 2018 06:17:35 -0700", "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\tw66DHY83027497; Fri, 6 Jul 2018 14:17:34 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w66DHYDN003818;\n\tFri, 6 Jul 2018 14:17:34 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w66DHY8j003814;\n\tFri, 6 Jul 2018 14:17:34 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,316,1526367600\"; d=\"scan'208\";a=\"72741956\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "srinath.mannam@broadcom.com, scott.branden@broadcom.com,\n\tajit.khaparde@broadcom.com", "Date": "Fri, 6 Jul 2018 14:17:31 +0100", "Message-Id": "<41225d71752906662b81fe939cd7fe47994133e1.1530881548.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1530881548.git.anatoly.burakov@intel.com>", "<cover.1530881548.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1530881548.git.anatoly.burakov@intel.com>", "<cover.1530881548.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [RFC 10/11] malloc: allow destroying heaps", "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://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add an API to destroy specified heap. Any memory regions still\ncontained within the heap will be removed first.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/include/rte_malloc.h | 21 ++++++++++++++++\n lib/librte_eal/common/malloc_heap.c | 29 ++++++++++++++++++++++\n lib/librte_eal/common/malloc_heap.h | 3 +++\n lib/librte_eal/common/rte_malloc.c | 27 ++++++++++++++++++++\n lib/librte_eal/rte_eal_version.map | 1 +\n 5 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 25d8d3f11..239cda2ca 100644\n--- a/lib/librte_eal/common/include/rte_malloc.h\n+++ b/lib/librte_eal/common/include/rte_malloc.h\n@@ -346,6 +346,27 @@ rte_malloc_heap_add_memory(const char *heap_name, void *va_addr, size_t len,\n int __rte_experimental\n rte_malloc_heap_remove_memory(const char *heap_name, void *va_addr, size_t len);\n \n+/**\n+ * Destroys a previously created malloc heap with specified name.\n+ *\n+ * @note Concurrently creating or destroying heaps is not thread-safe.\n+ *\n+ * @note This function does not deallocate the memory backing the heap - it only\n+ * deregisters memory from DPDK.\n+ *\n+ * @note This function will return a failure result if not all memory allocated\n+ * from the heap has been freed back to malloc heap.\n+ *\n+ * @param heap_name\n+ * Name of the heap to create.\n+ *\n+ * @return\n+ * - 0 on successful creation.\n+ * - -1 on error.\n+ */\n+int __rte_experimental\n+rte_malloc_heap_destroy(const char *heap_name);\n+\n /**\n * If malloc debug is enabled, check a memory block for header\n * and trailer markers to indicate that all is well with the block.\ndiff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c\nindex 27dbf6e60..e447b6412 100644\n--- a/lib/librte_eal/common/malloc_heap.c\n+++ b/lib/librte_eal/common/malloc_heap.c\n@@ -1039,6 +1039,35 @@ malloc_heap_create(struct malloc_heap *heap, const char *heap_name)\n \treturn 0;\n }\n \n+int\n+malloc_heap_destroy(struct malloc_heap *heap)\n+{\n+\tstruct malloc_elem *elem;\n+\n+\tif (heap->alloc_count != 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Heap is still in use\\n\");\n+\t\trte_errno = EBUSY;\n+\t\treturn -1;\n+\t}\n+\telem = heap->first;\n+\twhile (elem != NULL) {\n+\t\tstruct malloc_elem *next = elem->next;\n+\n+\t\tif (destroy_seg(elem, elem->size) < 0)\n+\t\t\treturn -1;\n+\n+\t\telem = next;\n+\t}\n+\tif (heap->total_size != 0)\n+\t\tRTE_LOG(ERR, EAL, \"Total size not zero, heap is likely corrupt\\n\");\n+\n+\t/* we can't memset the entire thing as we're still holding the lock */\n+\tLIST_INIT(heap->free_head);\n+\tmemset(&heap->name, 0, sizeof(heap->name));\n+\n+\treturn 0;\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 000146365..399c9a6b1 100644\n--- a/lib/librte_eal/common/malloc_heap.h\n+++ b/lib/librte_eal/common/malloc_heap.h\n@@ -38,6 +38,9 @@ malloc_heap_alloc_on_heap_id(const char *type, size_t size,\n int\n malloc_heap_create(struct malloc_heap *heap, const char *heap_name);\n \n+int\n+malloc_heap_destroy(struct malloc_heap *heap);\n+\n int\n malloc_heap_add_external_memory(struct malloc_heap *heap, void *va_addr,\n \t\trte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz);\ndiff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c\nindex 8d2eb7250..b6beee7ce 100644\n--- a/lib/librte_eal/common/rte_malloc.c\n+++ b/lib/librte_eal/common/rte_malloc.c\n@@ -385,3 +385,30 @@ rte_malloc_heap_create(const char *heap_name)\n \treturn malloc_heap_create(heap, heap_name);\n }\n \n+int\n+rte_malloc_heap_destroy(const char *heap_name)\n+{\n+\tstruct malloc_heap *heap = NULL;\n+\tint ret;\n+\n+\tif (heap_name == NULL ||\n+\t\t\tstrnlen(heap_name, RTE_HEAP_NAME_MAX_LEN) == 0 ||\n+\t\t\tstrnlen(heap_name, RTE_HEAP_NAME_MAX_LEN) ==\n+\t\t\t\tRTE_HEAP_NAME_MAX_LEN) {\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+\t/* start from non-socket heaps */\n+\theap = malloc_heap_find_named_heap(heap_name);\n+\tif (heap == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Heap %s not found\\n\", heap_name);\n+\t\trte_errno = ENOENT;\n+\t\treturn -1;\n+\t}\n+\t/* sanity checks done, now we can destroy the heap */\n+\trte_spinlock_lock(&heap->lock);\n+\tret = malloc_heap_destroy(heap);\n+\trte_spinlock_unlock(&heap->lock);\n+\n+\treturn ret;\n+}\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 7ee79051f..cdde7eb3b 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -282,6 +282,7 @@ EXPERIMENTAL {\n \trte_malloc_get_stats_from_heap;\n \trte_malloc_heap_add_memory;\n \trte_malloc_heap_create;\n+\trte_malloc_heap_destroy;\n \trte_malloc_heap_remove_memory;\n \trte_mem_alloc_validator_register;\n \trte_mem_alloc_validator_unregister;\n", "prefixes": [ "RFC", "10/11" ] }{ "id": 42507, "url": "