get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42502,
    "url": "http://patches.dpdk.org/api/patches/42502/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/a4acb67d720b790d81f468f8c64ec9ebcb23a08b.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": "<a4acb67d720b790d81f468f8c64ec9ebcb23a08b.1530881548.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/a4acb67d720b790d81f468f8c64ec9ebcb23a08b.1530881548.git.anatoly.burakov@intel.com",
    "date": "2018-07-06T13:17:22",
    "name": "[RFC,01/11] mem: allow memseg lists to be marked as external",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "cf5300c798d14da57b6b72f1562756ed6f0a3b98",
    "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/a4acb67d720b790d81f468f8c64ec9ebcb23a08b.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/42502/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42502/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 03BCD1BEFF;\n\tFri,  6 Jul 2018 15:17:47 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id BD8D71BE41\n\tfor <dev@dpdk.org>; Fri,  6 Jul 2018 15:17:36 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t06 Jul 2018 06:17:34 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga001.fm.intel.com with ESMTP; 06 Jul 2018 06:17:33 -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\tw66DHX3a027469; Fri, 6 Jul 2018 14:17:33 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w66DHXn0003746;\n\tFri, 6 Jul 2018 14:17:33 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w66DHXNN003742;\n\tFri, 6 Jul 2018 14:17:33 +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=\"70160976\"",
        "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:22 +0100",
        "Message-Id": "<a4acb67d720b790d81f468f8c64ec9ebcb23a08b.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 01/11] mem: allow memseg lists to be marked as\n\texternal",
        "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": "When we allocate and use DPDK memory, we need to be able to\ndifferentiate between DPDK hugepage segments and segments that\nwere made part of DPDK but are externally allocated. Add such\na property to memseg lists.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_common_memory.c     | 51 ++++++++++++++++---\n .../common/include/rte_eal_memconfig.h        |  1 +\n lib/librte_eal/common/malloc_heap.c           |  2 +-\n 3 files changed, 47 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex 4f0688f9d..835bbffb6 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -24,6 +24,21 @@\n #include \"eal_private.h\"\n #include \"eal_internal_cfg.h\"\n \n+/* forward declarations for memseg walk functions. we support external segments,\n+ * but for some functionality to work, we need to either skip or not skip\n+ * external segments. for example, while we expect for virt2memseg to return a\n+ * valid memseg even though it's an external memseg, for regular memseg walk we\n+ * want to skip those because the expectation is that we will only walk the\n+ * DPDK allocated memory.\n+ */\n+static int\n+memseg_list_walk(rte_memseg_list_walk_t func, void *arg, bool skip_external);\n+static int\n+memseg_walk(rte_memseg_walk_t func, void *arg, bool skip_external);\n+static int\n+memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg,\n+\t\tbool skip_external);\n+\n /*\n  * Try to mmap *size bytes in /dev/zero. If it is successful, return the\n  * pointer to the mmap'd area and keep *size unmodified. Else, retry\n@@ -621,9 +636,9 @@ rte_mem_iova2virt(rte_iova_t iova)\n \t * as we know they are PA-contiguous as well\n \t */\n \tif (internal_config.legacy_mem)\n-\t\trte_memseg_contig_walk(find_virt_legacy, &vi);\n+\t\tmemseg_contig_walk(find_virt_legacy, &vi, false);\n \telse\n-\t\trte_memseg_walk(find_virt, &vi);\n+\t\tmemseg_walk(find_virt, &vi, false);\n \n \treturn vi.virt;\n }\n@@ -787,8 +802,8 @@ rte_mem_lock_page(const void *virt)\n \treturn mlock((void *)aligned, page_size);\n }\n \n-int __rte_experimental\n-rte_memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg)\n+static int\n+memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg, bool skip_external)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tint i, ms_idx, ret = 0;\n@@ -803,6 +818,8 @@ rte_memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg)\n \n \t\tif (msl->memseg_arr.count == 0)\n \t\t\tcontinue;\n+\t\tif (skip_external && msl->external)\n+\t\t\tcontinue;\n \n \t\tarr = &msl->memseg_arr;\n \n@@ -837,7 +854,13 @@ rte_memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg)\n }\n \n int __rte_experimental\n-rte_memseg_walk(rte_memseg_walk_t func, void *arg)\n+rte_memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg)\n+{\n+\treturn memseg_contig_walk(func, arg, true);\n+}\n+\n+static int\n+memseg_walk(rte_memseg_walk_t func, void *arg, bool skip_external)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tint i, ms_idx, ret = 0;\n@@ -852,6 +875,8 @@ rte_memseg_walk(rte_memseg_walk_t func, void *arg)\n \n \t\tif (msl->memseg_arr.count == 0)\n \t\t\tcontinue;\n+\t\tif (skip_external && msl->external)\n+\t\t\tcontinue;\n \n \t\tarr = &msl->memseg_arr;\n \n@@ -875,7 +900,13 @@ rte_memseg_walk(rte_memseg_walk_t func, void *arg)\n }\n \n int __rte_experimental\n-rte_memseg_list_walk(rte_memseg_list_walk_t func, void *arg)\n+rte_memseg_walk(rte_memseg_walk_t func, void *arg)\n+{\n+\treturn memseg_walk(func, arg, true);\n+}\n+\n+static int\n+memseg_list_walk(rte_memseg_list_walk_t func, void *arg, bool skip_external)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tint i, ret = 0;\n@@ -888,6 +919,8 @@ rte_memseg_list_walk(rte_memseg_list_walk_t func, void *arg)\n \n \t\tif (msl->base_va == NULL)\n \t\t\tcontinue;\n+\t\tif (skip_external && msl->external)\n+\t\t\tcontinue;\n \n \t\tret = func(msl, arg);\n \t\tif (ret < 0) {\n@@ -904,6 +937,12 @@ rte_memseg_list_walk(rte_memseg_list_walk_t func, void *arg)\n \treturn ret;\n }\n \n+int __rte_experimental\n+rte_memseg_list_walk(rte_memseg_list_walk_t func, void *arg)\n+{\n+\treturn memseg_list_walk(func, arg, true);\n+}\n+\n /* init memory subsystem */\n int\n rte_eal_memory_init(void)\ndiff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h\nindex aff0688dd..4e8720ba6 100644\n--- a/lib/librte_eal/common/include/rte_eal_memconfig.h\n+++ b/lib/librte_eal/common/include/rte_eal_memconfig.h\n@@ -30,6 +30,7 @@ struct rte_memseg_list {\n \t\tuint64_t addr_64;\n \t\t/**< Makes sure addr is always 64-bits */\n \t};\n+\tbool external; /**< true if this list points to external memory */\n \tint socket_id; /**< Socket ID for all memsegs in this list. */\n \tuint64_t page_sz; /**< Page size for all memsegs in this list. */\n \tvolatile uint32_t version; /**< version number for multiprocess sync. */\ndiff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c\nindex d6cf3af81..8a1f54905 100644\n--- a/lib/librte_eal/common/malloc_heap.c\n+++ b/lib/librte_eal/common/malloc_heap.c\n@@ -631,7 +631,7 @@ malloc_heap_free(struct malloc_elem *elem)\n \tret = 0;\n \n \t/* ...of which we can't avail if we are in legacy mode */\n-\tif (internal_config.legacy_mem)\n+\tif (internal_config.legacy_mem || msl->external)\n \t\tgoto free_unlock;\n \n \t/* check if we can free any memory back to the system */\n",
    "prefixes": [
        "RFC",
        "01/11"
    ]
}