get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 48766,
    "url": "http://patchwork.dpdk.org/api/patches/48766/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/cb139d478f4d1c9b069dab02337b0b7aacfcdd36.1544701282.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": "<cb139d478f4d1c9b069dab02337b0b7aacfcdd36.1544701282.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/cb139d478f4d1c9b069dab02337b0b7aacfcdd36.1544701282.git.anatoly.burakov@intel.com",
    "date": "2018-12-13T11:43:16",
    "name": "[v3,2/5] memalloc: check for memfd support in segment fd API",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "16f9de2963492fb986eb80d7f5615fe6ae774a28",
    "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/cb139d478f4d1c9b069dab02337b0b7aacfcdd36.1544701282.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 2758,
            "url": "http://patchwork.dpdk.org/api/series/2758/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=2758",
            "date": "2018-12-13T11:43:14",
            "name": "Allow using virtio-user without hugepages",
            "version": 3,
            "mbox": "http://patchwork.dpdk.org/series/2758/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/48766/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/48766/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 EAC601B520;\n\tThu, 13 Dec 2018 12:43:33 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id D33E11B4F3;\n\tThu, 13 Dec 2018 12:43:24 +0100 (CET)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Dec 2018 03:43:22 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga005.fm.intel.com with ESMTP; 13 Dec 2018 03:43:20 -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\twBDBhJ6g032154; Thu, 13 Dec 2018 11:43:20 GMT",
            "from sivswdev05.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev05.ir.intel.com with ESMTP id wBDBhJUo012548;\n\tThu, 13 Dec 2018 11:43:19 GMT",
            "(from aburakov@localhost)\n\tby sivswdev05.ir.intel.com with LOCAL id wBDBhJaY012540;\n\tThu, 13 Dec 2018 11:43:19 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,348,1539673200\"; d=\"scan'208\";a=\"303508190\"",
        "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>, przemyslawx.lal@intel.com,\n\tkuralamudhan.ramakrishnan@intel.com, ivan.coughlan@intel.com,\n\ttiwei.bie@intel.com, ray.kinsella@intel.com,\n\tmaxime.coquelin@redhat.com, stable@dpdk.org",
        "Date": "Thu, 13 Dec 2018 11:43:16 +0000",
        "Message-Id": "<cb139d478f4d1c9b069dab02337b0b7aacfcdd36.1544701282.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1544701282.git.anatoly.burakov@intel.com>",
            "<cover.1544701282.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1544701282.git.anatoly.burakov@intel.com>",
            "<cover.1544546363.git.anatoly.burakov@intel.com>\n\t<cover.1544701282.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v3 2/5] memalloc: check for memfd support in\n\tsegment fd API",
        "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": "If memfd support was not compiled, or hugepage memfd support\nis not available at runtime, the API will now return proper\nerror code, indicating that this API is unsupported. This\nchanges the API, so document the changes.\n\nFixes: 41dbdb68723b (\"mem: add external API to retrieve page fd\")\nFixes: 3a44687139eb (\"mem: allow querying offset into segment fd\")\nCc: stable@dpdk.org\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\nAcked-by: Tiwei Bie <tiwei.bie@intel.com>\n---\n\nNotes:\n    The API is experimental, no deprecation notice needed.\n\n doc/guides/rel_notes/release_19_02.rst     |  2 ++\n lib/librte_eal/linuxapp/eal/eal_memalloc.c | 40 +++++++++++++++++-----\n 2 files changed, 34 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst\nindex ade41b9c8..960098582 100644\n--- a/doc/guides/rel_notes/release_19_02.rst\n+++ b/doc/guides/rel_notes/release_19_02.rst\n@@ -88,6 +88,8 @@ API Changes\n   where segment fd API is not expected to be supported:\n \n   - On attempt to get segment fd for an externally allocated memory segment\n+  - In cases where memfd support would have been required to provide segment\n+    fd's (such as in-memory or no-huge mode)\n \n \n ABI Changes\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\nindex 784939566..a93548b8c 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n@@ -23,6 +23,10 @@\n #include <sys/time.h>\n #include <signal.h>\n #include <setjmp.h>\n+#ifdef F_ADD_SEALS /* if file sealing is supported, so is memfd */\n+#include <linux/memfd.h>\n+#define MEMFD_SUPPORTED\n+#endif\n #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES\n #include <numa.h>\n #include <numaif.h>\n@@ -53,8 +57,8 @@ const int anonymous_hugepages_supported =\n #endif\n \n /*\n- * we don't actually care if memfd itself is supported - we only need to check\n- * if memfd supports hugetlbfs, as that already implies memfd support.\n+ * we've already checked memfd support at compile-time, but we also need to\n+ * check if we can create hugepage files with memfd.\n  *\n  * also, this is not a constant, because while we may be *compiled* with memfd\n  * hugetlbfs support, we might not be *running* on a system that supports memfd\n@@ -63,10 +67,11 @@ const int anonymous_hugepages_supported =\n  */\n static int memfd_create_supported =\n #ifdef MFD_HUGETLB\n-#define MEMFD_SUPPORTED\n \t\t1;\n+#define RTE_MFD_HUGETLB MFD_HUGETLB\n #else\n \t\t0;\n+#define RTE_MFD_HUGETLB 4U\n #endif\n \n /*\n@@ -338,12 +343,12 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,\n \tint fd;\n \tchar segname[250]; /* as per manpage, limit is 249 bytes plus null */\n \n+\tint flags = RTE_MFD_HUGETLB | pagesz_flags(hi->hugepage_sz);\n+\n \tif (internal_config.single_file_segments) {\n \t\tfd = fd_list[list_idx].memseg_list_fd;\n \n \t\tif (fd < 0) {\n-\t\t\tint flags = MFD_HUGETLB | pagesz_flags(hi->hugepage_sz);\n-\n \t\t\tsnprintf(segname, sizeof(segname), \"seg_%i\", list_idx);\n \t\t\tfd = memfd_create(segname, flags);\n \t\t\tif (fd < 0) {\n@@ -357,8 +362,6 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,\n \t\tfd = fd_list[list_idx].fds[seg_idx];\n \n \t\tif (fd < 0) {\n-\t\t\tint flags = MFD_HUGETLB | pagesz_flags(hi->hugepage_sz);\n-\n \t\t\tsnprintf(segname, sizeof(segname), \"seg_%i-%i\",\n \t\t\t\t\tlist_idx, seg_idx);\n \t\t\tfd = memfd_create(segname, flags);\n@@ -1542,6 +1545,17 @@ int\n eal_memalloc_get_seg_fd(int list_idx, int seg_idx)\n {\n \tint fd;\n+\n+\tif (internal_config.in_memory || internal_config.no_hugetlbfs) {\n+#ifndef MEMFD_SUPPORTED\n+\t\t/* in in-memory or no-huge mode, we rely on memfd support */\n+\t\treturn -ENOTSUP;\n+#endif\n+\t\t/* memfd supported, but hugetlbfs memfd may not be */\n+\t\tif (!internal_config.no_hugetlbfs && !memfd_create_supported)\n+\t\t\treturn -ENOTSUP;\n+\t}\n+\n \tif (internal_config.single_file_segments) {\n \t\tfd = fd_list[list_idx].memseg_list_fd;\n \t} else if (fd_list[list_idx].len == 0) {\n@@ -1565,7 +1579,7 @@ test_memfd_create(void)\n \t\tint pagesz_flag = pagesz_flags(pagesz);\n \t\tint flags;\n \n-\t\tflags = pagesz_flag | MFD_HUGETLB;\n+\t\tflags = pagesz_flag | RTE_MFD_HUGETLB;\n \t\tint fd = memfd_create(\"test\", flags);\n \t\tif (fd < 0) {\n \t\t\t/* we failed - let memalloc know this isn't working */\n@@ -1589,6 +1603,16 @@ eal_memalloc_get_seg_fd_offset(int list_idx, int seg_idx, size_t *offset)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \n+\tif (internal_config.in_memory || internal_config.no_hugetlbfs) {\n+#ifndef MEMFD_SUPPORTED\n+\t\t/* in in-memory or no-huge mode, we rely on memfd support */\n+\t\treturn -ENOTSUP;\n+#endif\n+\t\t/* memfd supported, but hugetlbfs memfd may not be */\n+\t\tif (!internal_config.no_hugetlbfs && !memfd_create_supported)\n+\t\t\treturn -ENOTSUP;\n+\t}\n+\n \t/* fd_list not initialized? */\n \tif (fd_list[list_idx].len == 0)\n \t\treturn -ENODEV;\n",
    "prefixes": [
        "v3",
        "2/5"
    ]
}