Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/48853/?format=api
http://patches.dpdk.org/api/patches/48853/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/6fcd43786975f2ff63c4742e2c362873fba47fe3.1544788118.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": "<6fcd43786975f2ff63c4742e2c362873fba47fe3.1544788118.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/6fcd43786975f2ff63c4742e2c362873fba47fe3.1544788118.git.anatoly.burakov@intel.com", "date": "2018-12-14T11:50:59", "name": "[v2,4/4] mem: allow usage of non-heap external memory in multiprocess", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "5c9885623e04c00c12bbb28550c0dbbbc00ebc88", "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/6fcd43786975f2ff63c4742e2c362873fba47fe3.1544788118.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 2778, "url": "http://patches.dpdk.org/api/series/2778/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2778", "date": "2018-12-14T11:50:55", "name": "Allow using external memory without malloc", "version": 2, "mbox": "http://patches.dpdk.org/series/2778/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/48853/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/48853/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 45CDC1B9FA;\n\tFri, 14 Dec 2018 12:51:15 +0100 (CET)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 667481B99B\n\tfor <dev@dpdk.org>; Fri, 14 Dec 2018 12:51:09 +0100 (CET)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 Dec 2018 03:51:07 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga003.jf.intel.com with ESMTP; 14 Dec 2018 03:51:05 -0800", "from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com\n\t[10.243.17.64])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\twBEBp5He005268; Fri, 14 Dec 2018 11:51:05 GMT", "from sivswdev05.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev05.ir.intel.com with ESMTP id wBEBp5Yf007522;\n\tFri, 14 Dec 2018 11:51:05 GMT", "(from aburakov@localhost)\n\tby sivswdev05.ir.intel.com with LOCAL id wBEBp5Kg007518;\n\tFri, 14 Dec 2018 11:51:05 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.56,352,1539673200\"; d=\"scan'208\";a=\"110367479\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "John McNamara <john.mcnamara@intel.com>,\n\tMarko Kovacevic <marko.kovacevic@intel.com>, shahafs@mellanox.com,\n\tyskoh@mellanox.com, thomas@monjalon.net, shreyansh.jain@nxp.com", "Date": "Fri, 14 Dec 2018 11:50:59 +0000", "Message-Id": "<6fcd43786975f2ff63c4742e2c362873fba47fe3.1544788118.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1544788118.git.anatoly.burakov@intel.com>", "<cover.1544788118.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1544788118.git.anatoly.burakov@intel.com>", "<cover.1543495935.git.anatoly.burakov@intel.com>\n\t<cover.1544788118.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v2 4/4] mem: allow usage of non-heap external\n\tmemory in multiprocess", "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 multiprocess support for externally allocated memory areas that\nare not added to DPDK heap (and add relevant doc sections).\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\nAcked-by: Yongseok Koh <yskoh@mellanox.com>\n---\n .../prog_guide/env_abstraction_layer.rst | 3 +\n lib/librte_eal/common/eal_common_memory.c | 42 +++++++++++++\n lib/librte_eal/common/include/rte_memory.h | 59 +++++++++++++++++++\n lib/librte_eal/rte_eal_version.map | 2 +\n 4 files changed, 106 insertions(+)", "diff": "diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst\nindex d7799b626..b0491bf2d 100644\n--- a/doc/guides/prog_guide/env_abstraction_layer.rst\n+++ b/doc/guides/prog_guide/env_abstraction_layer.rst\n@@ -276,11 +276,14 @@ The expected workflow is as follows:\n * Register memory within DPDK\n - If IOVA table is not specified, IOVA addresses will be assumed to be\n unavailable\n+ - Other processes must attach to the memory area before they can use it\n * Perform DMA mapping with ``rte_vfio_dma_map`` if needed\n * Use the memory area in your application\n * If memory area is no longer needed, it can be unregistered\n - If the area was mapped for DMA, unmapping must be performed before\n unregistering memory\n+ - Other processes must detach from the memory area before it can be\n+ unregistered\n \n Since these externally allocated memory areas will not be managed by DPDK, it is\n therefore up to the user application to decide how to use them and what to do\ndiff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex ea43c1362..051159f80 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -852,6 +852,48 @@ rte_extmem_unregister(void *va_addr, size_t len)\n \treturn ret;\n }\n \n+static int\n+sync_memory(void *va_addr, size_t len, bool attach)\n+{\n+\tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n+\tstruct rte_memseg_list *msl;\n+\tint ret = 0;\n+\n+\tif (va_addr == NULL || len == 0) {\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+\trte_rwlock_write_lock(&mcfg->memory_hotplug_lock);\n+\n+\t/* find our segment */\n+\tmsl = malloc_heap_find_external_seg(va_addr, len);\n+\tif (msl == NULL) {\n+\t\trte_errno = ENOENT;\n+\t\tret = -1;\n+\t\tgoto unlock;\n+\t}\n+\tif (attach)\n+\t\tret = rte_fbarray_attach(&msl->memseg_arr);\n+\telse\n+\t\tret = rte_fbarray_detach(&msl->memseg_arr);\n+\n+unlock:\n+\trte_rwlock_write_unlock(&mcfg->memory_hotplug_lock);\n+\treturn ret;\n+}\n+\n+int __rte_experimental\n+rte_extmem_attach(void *va_addr, size_t len)\n+{\n+\treturn sync_memory(va_addr, len, true);\n+}\n+\n+int __rte_experimental\n+rte_extmem_detach(void *va_addr, size_t len)\n+{\n+\treturn sync_memory(va_addr, len, false);\n+}\n+\n /* init memory subsystem */\n int\n rte_eal_memory_init(void)\ndiff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h\nindex ff23fc2c1..7ca703bb1 100644\n--- a/lib/librte_eal/common/include/rte_memory.h\n+++ b/lib/librte_eal/common/include/rte_memory.h\n@@ -435,6 +435,10 @@ rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg *ms,\n * @note This API will not perform any DMA mapping. It is expected that user\n * will do that themselves.\n *\n+ * @note Before accessing this memory in other processes, it needs to be\n+ * attached in each of those processes by calling ``rte_extmem_attach`` in\n+ * each other process.\n+ *\n * @param va_addr\n * Start of virtual area to register. Must be aligned by ``page_sz``.\n * @param len\n@@ -472,6 +476,9 @@ rte_extmem_register(void *va_addr, size_t len, rte_iova_t iova_addrs[],\n * @note This API will not perform any DMA unmapping. It is expected that user\n * will do that themselves.\n *\n+ * @note Before calling this function, all other processes must call\n+ * ``rte_extmem_detach`` to detach from the memory area.\n+ *\n * @param va_addr\n * Start of virtual area to unregister\n * @param len\n@@ -486,6 +493,58 @@ rte_extmem_register(void *va_addr, size_t len, rte_iova_t iova_addrs[],\n int __rte_experimental\n rte_extmem_unregister(void *va_addr, size_t len);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Attach to external memory chunk registered in another process.\n+ *\n+ * @note Using this API is mutually exclusive with ``rte_malloc`` family of\n+ * API's.\n+ *\n+ * @note This API will not perform any DMA mapping. It is expected that user\n+ * will do that themselves.\n+ *\n+ * @param va_addr\n+ * Start of virtual area to register\n+ * @param len\n+ * Length of virtual area to register\n+ *\n+ * @return\n+ * - 0 on success\n+ * - -1 in case of error, with rte_errno set to one of the following:\n+ * EINVAL - one of the parameters was invalid\n+ * ENOENT - memory chunk was not found\n+ */\n+int __rte_experimental\n+rte_extmem_attach(void *va_addr, size_t len);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Detach from external memory chunk registered in another process.\n+ *\n+ * @note Using this API is mutually exclusive with ``rte_malloc`` family of\n+ * API's.\n+ *\n+ * @note This API will not perform any DMA unmapping. It is expected that user\n+ * will do that themselves.\n+ *\n+ * @param va_addr\n+ * Start of virtual area to unregister\n+ * @param len\n+ * Length of virtual area to unregister\n+ *\n+ * @return\n+ * - 0 on success\n+ * - -1 in case of error, with rte_errno set to one of the following:\n+ * EINVAL - one of the parameters was invalid\n+ * ENOENT - memory chunk was not found\n+ */\n+int __rte_experimental\n+rte_extmem_detach(void *va_addr, size_t len);\n+\n /**\n * Dump the physical memory layout to a file.\n *\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 593691a14..eb5f7b9cb 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -296,6 +296,8 @@ EXPERIMENTAL {\n \trte_devargs_remove;\n \trte_devargs_type_count;\n \trte_eal_cleanup;\n+\trte_extmem_attach;\n+\trte_extmem_detach;\n \trte_extmem_register;\n \trte_extmem_unregister;\n \trte_fbarray_attach;\n", "prefixes": [ "v2", "4/4" ] }{ "id": 48853, "url": "