Show a patch.

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

{
    "id": 44049,
    "url": "http://patches.dpdk.org/api/patches/44049/",
    "web_url": "http://patches.dpdk.org/patch/44049/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1535642492-21831-3-git-send-email-alejandro.lucero@netronome.com>",
    "date": "2018-08-30T15:21:29",
    "name": "[2/5] mem: use address hint for mapping hugepages",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "d8223665dbb0a1364be12c3bbec56e5d87628c37",
    "submitter": {
        "id": 270,
        "url": "http://patches.dpdk.org/api/people/270/",
        "name": "Alejandro Lucero",
        "email": "alejandro.lucero@netronome.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/44049/mbox/",
    "series": [
        {
            "id": 1117,
            "url": "http://patches.dpdk.org/api/series/1117/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1117",
            "date": "2018-08-30T15:21:27",
            "name": "use IOVAs check based on DMA mask",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1117/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44049/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/44049/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<1535642492-21831-1-git-send-email-alejandro.lucero@netronome.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 1.9.1",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6640E5699;\n\tThu, 30 Aug 2018 17:22:34 +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 F34414CBB;\n\tThu, 30 Aug 2018 17:22:27 +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\tw7UFLZrK021915; Thu, 30 Aug 2018 16:21:35 +0100",
            "(from alucero@localhost)\n\tby netronome.com (8.14.4/8.14.4/Submit) id w7UFLZqf021914;\n\tThu, 30 Aug 2018 16:21:35 +0100"
        ],
        "References": "<1535642492-21831-1-git-send-email-alejandro.lucero@netronome.com>",
        "Delivered-To": "patchwork@dpdk.org",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1535642492-21831-3-git-send-email-alejandro.lucero@netronome.com>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list",
        "From": "Alejandro Lucero <alejandro.lucero@netronome.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@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>",
        "To": "dev@dpdk.org",
        "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>",
        "Date": "Thu, 30 Aug 2018 16:21:29 +0100",
        "Cc": "stable@dpdk.org",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH 2/5] mem: use address hint for mapping hugepages"
    },
    "content": "Linux kernel uses a really high address as starting address for\nserving mmaps calls. If there exist 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>\n---\n lib/librte_eal/common/eal_common_memory.c | 35 ++++++++++++++++++++++++++++++-\n 1 file changed, 34 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex 1e8312b..914f1d8 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -37,6 +37,23 @@\n static void *next_baseaddr;\n static uint64_t system_page_sz;\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_eal_check_dma_mask for ensuring all\n+ * memory is within supported range.\n+ */\n+static uint64_t baseaddr = 0x100000000;\n+#endif\n+\n void *\n eal_get_virtual_area(void *requested_addr, size_t *size,\n \t\tsize_t page_sz, int flags, int mmap_flags)\n@@ -60,6 +77,11 @@\n \t\t\trte_eal_process_type() == RTE_PROC_PRIMARY)\n \t\tnext_baseaddr = (void *) internal_config.base_virtaddr;\n \n+#ifdef RTE_ARCH_64\n+\tif (next_baseaddr == NULL && internal_config.base_virtaddr == 0 &&\n+\t\t\trte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\tnext_baseaddr = (void *) baseaddr;\n+#endif\n \tif (requested_addr == NULL && next_baseaddr != NULL) {\n \t\trequested_addr = next_baseaddr;\n \t\trequested_addr = RTE_PTR_ALIGN(requested_addr, page_sz);\n@@ -89,9 +111,20 @@\n \n \t\tmapped_addr = mmap(requested_addr, (size_t)map_sz, PROT_READ,\n \t\t\t\tmmap_flags, -1, 0);\n+\n \t\tif (mapped_addr == MAP_FAILED && allow_shrink)\n \t\t\t*size -= page_sz;\n-\t} while (allow_shrink && mapped_addr == MAP_FAILED && *size > 0);\n+\n+\t\tif (mapped_addr != MAP_FAILED && addr_is_hint &&\n+\t\t    mapped_addr != requested_addr) {\n+\t\t\t/* hint was not used. Try with another offset */\n+\t\t\tmunmap(mapped_addr, map_sz);\n+\t\t\tmapped_addr = MAP_FAILED;\n+\t\t\tnext_baseaddr = RTE_PTR_ADD(next_baseaddr, 0x100000000);\n+\t\t\trequested_addr = next_baseaddr;\n+\t\t}\n+\t} while ((allow_shrink || addr_is_hint) &&\n+\t\t mapped_addr == MAP_FAILED && *size > 0);\n \n \t/* align resulting address - if map failed, we will ignore the value\n \t * anyway, so no need to add additional checks.\n",
    "prefixes": [
        "2/5"
    ]
}