get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/48409/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 48409,
    "url": "http://patchwork.dpdk.org/api/patches/48409/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/b50a376ae05397a9f741c1291609b5540d64fe02.1543495935.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<b50a376ae05397a9f741c1291609b5540d64fe02.1543495935.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/b50a376ae05397a9f741c1291609b5540d64fe02.1543495935.git.anatoly.burakov@intel.com",
    "date": "2018-11-29T13:48:35",
    "name": "[4/4] mem: allow usage of non-heap external memory in multiprocess",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5c30ba9fe347a087310408a98268af9d1c2390f3",
    "submitter": {
        "id": 4,
        "url": "http://patchwork.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/b50a376ae05397a9f741c1291609b5540d64fe02.1543495935.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 2612,
            "url": "http://patchwork.dpdk.org/api/series/2612/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=2612",
            "date": "2018-11-29T13:48:33",
            "name": "Allow using external memory without malloc",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/2612/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/48409/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/48409/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 5D02E1B4E1;\n\tThu, 29 Nov 2018 14:48:47 +0100 (CET)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 921BF1B4B3\n\tfor <dev@dpdk.org>; Thu, 29 Nov 2018 14:48:39 +0100 (CET)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Nov 2018 05:48:38 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga008.jf.intel.com with ESMTP; 29 Nov 2018 05:48:36 -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\twATDmajG012510; Thu, 29 Nov 2018 13:48:36 GMT",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id wATDma4A019999;\n\tThu, 29 Nov 2018 13:48:36 GMT",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id wATDmaRb019995;\n\tThu, 29 Nov 2018 13:48:36 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,294,1539673200\"; d=\"scan'208\";a=\"96751622\"",
        "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": "Thu, 29 Nov 2018 13:48:35 +0000",
        "Message-Id": "<b50a376ae05397a9f741c1291609b5540d64fe02.1543495935.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1543495935.git.anatoly.burakov@intel.com>",
            "<cover.1543495935.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1543495935.git.anatoly.burakov@intel.com>",
            "<cover.1543495935.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 4/4] mem: allow usage of non-heap external memory\n\tin 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>\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 a2e085ae8..67b445c31 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -849,6 +849,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 4a43c1a9e..050bb6d8e 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\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": [
        "4/4"
    ]
}