Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/45503/?format=api
http://patches.dpdk.org/api/patches/45503/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/232466ce208b7f1eba3ce07ee5d95b7ac785d99d.1538044725.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": "<232466ce208b7f1eba3ce07ee5d95b7ac785d99d.1538044725.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/232466ce208b7f1eba3ce07ee5d95b7ac785d99d.1538044725.git.anatoly.burakov@intel.com", "date": "2018-09-27T10:41:13", "name": "[v6,16/21] malloc: allow detaching from external memory", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "be5ec0c05faf88080be6dba099b99f8cfd8d990e", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "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/232466ce208b7f1eba3ce07ee5d95b7ac785d99d.1538044725.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 1543, "url": "http://patches.dpdk.org/api/series/1543/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1543", "date": "2018-09-27T10:40:57", "name": "Support externally allocated memory in DPDK", "version": 6, "mbox": "http://patches.dpdk.org/series/1543/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/45503/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/45503/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 DA5961B2B0;\n\tThu, 27 Sep 2018 12:42:02 +0200 (CEST)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id A358C1B158\n\tfor <dev@dpdk.org>; Thu, 27 Sep 2018 12:41:30 +0200 (CEST)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Sep 2018 03:41:29 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga003.jf.intel.com with ESMTP; 27 Sep 2018 03:41:25 -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\tw8RAfObR028399; Thu, 27 Sep 2018 11:41:24 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w8RAfOIS022821;\n\tThu, 27 Sep 2018 11:41:24 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w8RAfOdb022814;\n\tThu, 27 Sep 2018 11:41:24 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.54,310,1534834800\"; d=\"scan'208\";a=\"87052668\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "laszlo.madarassy@ericsson.com, laszlo.vadkerti@ericsson.com,\n\tandras.kovacs@ericsson.com, winnie.tian@ericsson.com,\n\tdaniel.andrasi@ericsson.com, janos.kobor@ericsson.com,\n\tgeza.koblo@ericsson.com, srinath.mannam@broadcom.com,\n\tscott.branden@broadcom.com, ajit.khaparde@broadcom.com,\n\tkeith.wiles@intel.com, bruce.richardson@intel.com, thomas@monjalon.net,\n\tshreyansh.jain@nxp.com, shahafs@mellanox.com,\n\tarybchenko@solarflare.com, alejandro.lucero@netronome.com", "Date": "Thu, 27 Sep 2018 11:41:13 +0100", "Message-Id": "<232466ce208b7f1eba3ce07ee5d95b7ac785d99d.1538044725.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1538044725.git.anatoly.burakov@intel.com>", "<cover.1538044725.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1538044725.git.anatoly.burakov@intel.com>", "<cover.1537960448.git.anatoly.burakov@intel.com>\n\t<cover.1538044725.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v6 16/21] malloc: allow detaching from external\n\tmemory", "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 API to detach from existing chunk of external memory in a\nprocess.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/include/rte_malloc.h | 27 +++++++++++++++++++\n lib/librte_eal/common/rte_malloc.c | 31 +++++++++++++++++-----\n lib/librte_eal/rte_eal_version.map | 1 +\n 3 files changed, 52 insertions(+), 7 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/include/rte_malloc.h b/lib/librte_eal/common/include/rte_malloc.h\nindex 793f9473a..7249e6aae 100644\n--- a/lib/librte_eal/common/include/rte_malloc.h\n+++ b/lib/librte_eal/common/include/rte_malloc.h\n@@ -315,6 +315,9 @@ rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,\n * @note Memory area must not contain any allocated elements to allow its\n * removal from the heap\n *\n+ * @note All other processes must detach from the memory chunk prior to it being\n+ * removed from the heap.\n+ *\n * @param heap_name\n * Name of the heap to remove memory from\n * @param va_addr\n@@ -357,6 +360,30 @@ rte_malloc_heap_memory_remove(const char *heap_name, void *va_addr, size_t len);\n int __rte_experimental\n rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len);\n \n+/**\n+ * Detach from a chunk of external memory in secondary process.\n+ *\n+ * @note This function must be called in before any attempt is made to remove\n+ * external memory from the heap in another process. This function does *not*\n+ * need to be called if a call to ``rte_malloc_heap_memory_remove`` will be\n+ * called in current process.\n+ *\n+ * @param heap_name\n+ * Heap name to which this chunk of memory belongs\n+ * @param va_addr\n+ * Start address of memory chunk to attach to\n+ * @param len\n+ * Length of memory chunk to attach to\n+ * @return\n+ * 0 on successful detach\n+ * -1 on unsuccessful detach, with rte_errno set to indicate cause for error:\n+ * EINVAL - one of the parameters was invalid\n+ * EPERM - attempted to detach memory from a reserved heap\n+ * ENOENT - heap or memory chunk was not found\n+ */\n+int __rte_experimental\n+rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len);\n+\n /**\n * Creates a new empty malloc heap with a specified name.\n *\ndiff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c\nindex 5078235b1..72e42b337 100644\n--- a/lib/librte_eal/common/rte_malloc.c\n+++ b/lib/librte_eal/common/rte_malloc.c\n@@ -422,10 +422,11 @@ struct sync_mem_walk_arg {\n \tvoid *va_addr;\n \tsize_t len;\n \tint result;\n+\tbool attach;\n };\n \n static int\n-attach_mem_walk(const struct rte_memseg_list *msl, void *arg)\n+sync_mem_walk(const struct rte_memseg_list *msl, void *arg)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tstruct sync_mem_walk_arg *wa = arg;\n@@ -440,7 +441,10 @@ attach_mem_walk(const struct rte_memseg_list *msl, void *arg)\n \t\tmsl_idx = msl - mcfg->memsegs;\n \t\tfound_msl = &mcfg->memsegs[msl_idx];\n \n-\t\tret = rte_fbarray_attach(&found_msl->memseg_arr);\n+\t\tif (wa->attach)\n+\t\t\tret = rte_fbarray_attach(&found_msl->memseg_arr);\n+\t\telse\n+\t\t\tret = rte_fbarray_detach(&found_msl->memseg_arr);\n \n \t\tif (ret < 0)\n \t\t\twa->result = -rte_errno;\n@@ -451,8 +455,8 @@ attach_mem_walk(const struct rte_memseg_list *msl, void *arg)\n \treturn 0;\n }\n \n-int\n-rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)\n+static int\n+sync_memory(const char *heap_name, void *va_addr, size_t len, bool attach)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tstruct malloc_heap *heap = NULL;\n@@ -475,20 +479,21 @@ rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)\n \t\tret = -1;\n \t\tgoto unlock;\n \t}\n-\t/* we shouldn't be able to attach to internal heaps */\n+\t/* we shouldn't be able to sync to internal heaps */\n \tif (heap->socket_id < RTE_MAX_NUMA_NODES) {\n \t\trte_errno = EPERM;\n \t\tret = -1;\n \t\tgoto unlock;\n \t}\n \n-\t/* find corresponding memseg list to attach to */\n+\t/* find corresponding memseg list to sync to */\n \twa.va_addr = va_addr;\n \twa.len = len;\n \twa.result = -ENOENT; /* fail unless explicitly told to succeed */\n+\twa.attach = attach;\n \n \t/* we're already holding a read lock */\n-\trte_memseg_list_walk_thread_unsafe(attach_mem_walk, &wa);\n+\trte_memseg_list_walk_thread_unsafe(sync_mem_walk, &wa);\n \n \tif (wa.result < 0) {\n \t\trte_errno = -wa.result;\n@@ -501,6 +506,18 @@ rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)\n \treturn ret;\n }\n \n+int\n+rte_malloc_heap_memory_attach(const char *heap_name, void *va_addr, size_t len)\n+{\n+\treturn sync_memory(heap_name, va_addr, len, true);\n+}\n+\n+int\n+rte_malloc_heap_memory_detach(const char *heap_name, void *va_addr, size_t len)\n+{\n+\treturn sync_memory(heap_name, va_addr, len, false);\n+}\n+\n int\n rte_malloc_heap_create(const char *heap_name)\n {\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 920852042..30583eef2 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -323,6 +323,7 @@ EXPERIMENTAL {\n \trte_malloc_heap_get_socket;\n \trte_malloc_heap_memory_add;\n \trte_malloc_heap_memory_attach;\n+\trte_malloc_heap_memory_detach;\n \trte_malloc_heap_memory_remove;\n \trte_malloc_heap_socket_is_external;\n \trte_mem_alloc_validator_register;\n", "prefixes": [ "v6", "16/21" ] }{ "id": 45503, "url": "