get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42229,
    "url": "http://patches.dpdk.org/api/patches/42229/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1530708838-2682-5-git-send-email-alejandro.lucero@netronome.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": "<1530708838-2682-5-git-send-email-alejandro.lucero@netronome.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1530708838-2682-5-git-send-email-alejandro.lucero@netronome.com",
    "date": "2018-07-04T12:53:56",
    "name": "[v3,4/6] mem: use address hint for mapping hugepages",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b8715a74cb738a0265cbb2aa03b970b8e82829b7",
    "submitter": {
        "id": 270,
        "url": "http://patches.dpdk.org/api/people/270/?format=api",
        "name": "Alejandro Lucero",
        "email": "alejandro.lucero@netronome.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/1530708838-2682-5-git-send-email-alejandro.lucero@netronome.com/mbox/",
    "series": [
        {
            "id": 397,
            "url": "http://patches.dpdk.org/api/series/397/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=397",
            "date": "2018-07-04T12:53:54",
            "name": "use IOVAs check based on DMA mask",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/397/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42229/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42229/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 6F7201BF46;\n\tWed,  4 Jul 2018 14:54:18 +0200 (CEST)",
            "from netronome.com (host-79-78-33-110.static.as9105.net\n\t[79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 83AE31BF27;\n\tWed,  4 Jul 2018 14:54:09 +0200 (CEST)",
            "from netronome.com (localhost [127.0.0.1])\n\tby netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id\n\tw64Cs4kh002742; Wed, 4 Jul 2018 13:54:04 +0100",
            "(from alucero@localhost)\n\tby netronome.com (8.14.4/8.14.4/Submit) id w64Cs4KQ002741;\n\tWed, 4 Jul 2018 13:54:04 +0100"
        ],
        "From": "Alejandro Lucero <alejandro.lucero@netronome.com>",
        "To": "dev@dpdk.org",
        "Cc": "stable@dpdk.org, anatoly.burakov@intel.com, maxime.coquelin@redhat.com, \n\tferruh.yigit@intel.com",
        "Date": "Wed,  4 Jul 2018 13:53:56 +0100",
        "Message-Id": "<1530708838-2682-5-git-send-email-alejandro.lucero@netronome.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1530708838-2682-1-git-send-email-alejandro.lucero@netronome.com>",
        "References": "<1530708838-2682-1-git-send-email-alejandro.lucero@netronome.com>",
        "Subject": "[dpdk-dev] [PATCH v3 4/6] mem: use address hint for mapping\n\thugepages",
        "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": "Linux kernel uses a really high address as starting address for\nserving mmaps calls. If there exists addressing limitations and\nIOVA mode is VA, this starting address is likely too high for\nthose devices. However, it is possible to use a lower address in\nthe process virtual address space as with 64 bits there is a lot\nof available space.\n\nThis patch adds an address hint as starting address for 64 bits\nsystems.\n\nSigned-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/linuxapp/eal/eal_memory.c | 55 ++++++++++++++++++++++++++------\n 1 file changed, 46 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex 17c20d4..2ed4017 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memory.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c\n@@ -88,6 +88,23 @@\n \n static uint64_t baseaddr_offset;\n \n+#ifdef RTE_ARCH_64\n+/*\n+ * Linux kernel uses a really high address as starting address for serving\n+ * mmaps calls. If there exists addressing limitations and IOVA mode is VA,\n+ * this starting address is likely too high for those devices. However, it\n+ * is possible to use a lower address in the process virtual address space\n+ * as with 64 bits there is a lot of available space.\n+ *\n+ * Current known limitations are 39 or 40 bits. Setting the starting address\n+ * at 4GB implies there are 508GB or 1020GB for mapping the available\n+ * hugepages. This is likely enough for most systems, although a device with\n+ * addressing limitations should call rte_dev_check_dma_mask for ensuring all\n+ * memory is within supported range.\n+ */\n+static uint64_t baseaddr = 0x100000000;\n+#endif\n+\n static bool phys_addrs_available = true;\n \n #define RANDOMIZE_VA_SPACE_FILE \"/proc/sys/kernel/randomize_va_space\"\n@@ -250,6 +267,23 @@\n \t}\n }\n \n+static void *\n+get_addr_hint(void)\n+{\n+\tif (internal_config.base_virtaddr != 0) {\n+\t\treturn (void *) (uintptr_t)\n+\t\t\t    (internal_config.base_virtaddr +\n+\t\t\t     baseaddr_offset);\n+\t} else {\n+#ifdef RTE_ARCH_64\n+\t\treturn (void *) (uintptr_t) (baseaddr +\n+\t\t\t\tbaseaddr_offset);\n+#else\n+\t\treturn NULL;\n+#endif\n+\t}\n+}\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@@ -260,16 +294,10 @@\n static void *\n get_virtual_area(size_t *size, size_t hugepage_sz)\n {\n-\tvoid *addr;\n+\tvoid *addr, *addr_hint;\n \tint fd;\n \tlong aligned_addr;\n \n-\tif (internal_config.base_virtaddr != 0) {\n-\t\taddr = (void*) (uintptr_t) (internal_config.base_virtaddr +\n-\t\t\t\tbaseaddr_offset);\n-\t}\n-\telse addr = NULL;\n-\n \tRTE_LOG(DEBUG, EAL, \"Ask a virtual area of 0x%zx bytes\\n\", *size);\n \n \tfd = open(\"/dev/zero\", O_RDONLY);\n@@ -278,7 +306,9 @@\n \t\treturn NULL;\n \t}\n \tdo {\n-\t\taddr = mmap(addr,\n+\t\taddr_hint = get_addr_hint();\n+\n+\t\taddr = mmap(addr_hint,\n \t\t\t\t(*size) + hugepage_sz, PROT_READ,\n #ifdef RTE_ARCH_PPC_64\n \t\t\t\tMAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB,\n@@ -286,8 +316,15 @@\n \t\t\t\tMAP_PRIVATE,\n #endif\n \t\t\t\tfd, 0);\n-\t\tif (addr == MAP_FAILED)\n+\t\tif (addr == MAP_FAILED) {\n+\t\t\t/* map failed. Let's try with less memory */\n \t\t\t*size -= hugepage_sz;\n+\t\t} else if (addr_hint && addr != addr_hint) {\n+\t\t\t/* hint was not used. Try with another offset */\n+\t\t\tmunmap(addr, (*size) + hugepage_sz);\n+\t\t\taddr = MAP_FAILED;\n+\t\t\tbaseaddr_offset += 0x100000000;\n+\t\t}\n \t} while (addr == MAP_FAILED && *size > 0);\n \n \tif (addr == MAP_FAILED) {\n",
    "prefixes": [
        "v3",
        "4/6"
    ]
}