get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 61898,
    "url": "http://patches.dpdk.org/api/patches/61898/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/e8d1128c93881950d23d44913ebec32cf3e5313e.1571920604.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": "<e8d1128c93881950d23d44913ebec32cf3e5313e.1571920604.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/e8d1128c93881950d23d44913ebec32cf3e5313e.1571920604.git.anatoly.burakov@intel.com",
    "date": "2019-10-24T12:36:50",
    "name": "[v5,2/2] eal: use base address hint to reserve space for mem config",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "07fa1ad59163cd4984a84d725ab6e8c7a36da851",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/e8d1128c93881950d23d44913ebec32cf3e5313e.1571920604.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 7043,
            "url": "http://patches.dpdk.org/api/series/7043/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7043",
            "date": "2019-10-24T12:36:49",
            "name": "[v5,1/2] eal: make base address hint OS-specific",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/7043/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/61898/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/61898/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 13D2A1EA3E;\n\tThu, 24 Oct 2019 14:37:00 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 52C6E1E9F5;\n\tThu, 24 Oct 2019 14:36:55 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Oct 2019 05:36:55 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.151])\n\tby orsmga007.jf.intel.com with ESMTP; 24 Oct 2019 05:36:53 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.68,224,1569308400\"; d=\"scan'208\";a=\"188576339\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>, david.marchand@redhat.com,\n\tstephen@networkplumber.org, han.li1@zte.com.cn, stable@dpdk.org",
        "Date": "Thu, 24 Oct 2019 13:36:50 +0100",
        "Message-Id": "<e8d1128c93881950d23d44913ebec32cf3e5313e.1571920604.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": [
            "<ea8457f47a25f20f59bb1f37dcf2a1f0bf340c9d.1571920604.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564577214.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<ea8457f47a25f20f59bb1f37dcf2a1f0bf340c9d.1571920604.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564577214.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v5 2/2] eal: use base address hint to reserve\n\tspace for mem config",
        "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": "Currently, mem config will be mapped without using the virtual\narea reservation infrastructure, which means it will be mapped\nat an arbitrary location. This may cause failures to map the\nshared config in secondary process due to things like PCI\nwhitelist arguments allocating memory in a space where the\nprimary has allocated the shared mem config.\n\nFix this by using virtual area reservation to reserve space for\nthe mem config, thereby avoiding the problem and reserving the\nshared config (hopefully) far away from any normal memory\nallocations.\n\nCc: stable@dpdk.org\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v4:\n    - Fix mem config length to always be page-aligned\n    \n    v3:\n    - Fix alignment issues with base address\n    \n    v2:\n    - Fix issue with unneeded ADDR_IS_HINT flag that broke things\n      on 32-bit builds\n\n lib/librte_eal/freebsd/eal/eal.c | 28 +++++++++++++++++++++------\n lib/librte_eal/linux/eal/eal.c   | 33 +++++++++++++++++++++++---------\n 2 files changed, 46 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex f86e9aa318..5b869b895a 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -218,7 +218,10 @@ eal_parse_sysfs_value(const char *filename, unsigned long *val)\n static int\n rte_eal_config_create(void)\n {\n-\tvoid *rte_mem_cfg_addr;\n+\tsize_t page_sz = sysconf(_SC_PAGE_SIZE);\n+\tsize_t cfg_len = sizeof(*rte_config.mem_config);\n+\tsize_t cfg_len_aligned = RTE_ALIGN(cfg_len, page_sz);\n+\tvoid *rte_mem_cfg_addr, *mapped_mem_cfg_addr;\n \tint retval;\n \n \tconst char *pathname = eal_runtime_config_path();\n@@ -235,7 +238,7 @@ rte_eal_config_create(void)\n \t\t}\n \t}\n \n-\tretval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));\n+\tretval = ftruncate(mem_cfg_fd, cfg_len);\n \tif (retval < 0){\n \t\tclose(mem_cfg_fd);\n \t\tmem_cfg_fd = -1;\n@@ -253,15 +256,28 @@ rte_eal_config_create(void)\n \t\treturn -1;\n \t}\n \n-\trte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),\n-\t\t\t\tPROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);\n-\n-\tif (rte_mem_cfg_addr == MAP_FAILED){\n+\t/* reserve space for config */\n+\trte_mem_cfg_addr = eal_get_virtual_area(NULL, &cfg_len_aligned, page_sz,\n+\t\t\t0, 0);\n+\tif (rte_mem_cfg_addr == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot mmap memory for rte_config\\n\");\n \t\tclose(mem_cfg_fd);\n \t\tmem_cfg_fd = -1;\n \t\treturn -1;\n \t}\n+\n+\t/* remap the actual file into the space we've just reserved */\n+\tmapped_mem_cfg_addr = mmap(rte_mem_cfg_addr,\n+\t\t\tcfg_len_aligned, PROT_READ | PROT_WRITE,\n+\t\t\tMAP_SHARED | MAP_FIXED, mem_cfg_fd, 0);\n+\tif (mapped_mem_cfg_addr == MAP_FAILED) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot remap memory for rte_config\\n\");\n+\t\tmunmap(rte_mem_cfg_addr, cfg_len);\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n+\t\treturn -1;\n+\t}\n+\n \tmemcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));\n \trte_config.mem_config = rte_mem_cfg_addr;\n \ndiff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c\nindex f39720637f..6488171010 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -306,7 +306,10 @@ eal_parse_sysfs_value(const char *filename, unsigned long *val)\n static int\n rte_eal_config_create(void)\n {\n-\tvoid *rte_mem_cfg_addr;\n+\tsize_t page_sz = sysconf(_SC_PAGE_SIZE);\n+\tsize_t cfg_len = sizeof(*rte_config.mem_config);\n+\tsize_t cfg_len_aligned = RTE_ALIGN(cfg_len, page_sz);\n+\tvoid *rte_mem_cfg_addr, *mapped_mem_cfg_addr;\n \tint retval;\n \n \tconst char *pathname = eal_runtime_config_path();\n@@ -318,7 +321,7 @@ rte_eal_config_create(void)\n \tif (internal_config.base_virtaddr != 0)\n \t\trte_mem_cfg_addr = (void *)\n \t\t\tRTE_ALIGN_FLOOR(internal_config.base_virtaddr -\n-\t\t\tsizeof(struct rte_mem_config), sysconf(_SC_PAGE_SIZE));\n+\t\t\tsizeof(struct rte_mem_config), page_sz);\n \telse\n \t\trte_mem_cfg_addr = NULL;\n \n@@ -331,7 +334,7 @@ rte_eal_config_create(void)\n \t\t}\n \t}\n \n-\tretval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));\n+\tretval = ftruncate(mem_cfg_fd, cfg_len);\n \tif (retval < 0){\n \t\tclose(mem_cfg_fd);\n \t\tmem_cfg_fd = -1;\n@@ -349,13 +352,25 @@ rte_eal_config_create(void)\n \t\treturn -1;\n \t}\n \n-\trte_mem_cfg_addr = mmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config),\n-\t\t\t\tPROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);\n-\n-\tif (rte_mem_cfg_addr == MAP_FAILED){\n-\t\tclose(mem_cfg_fd);\n-\t\tmem_cfg_fd = -1;\n+\t/* reserve space for config */\n+\trte_mem_cfg_addr = eal_get_virtual_area(rte_mem_cfg_addr,\n+\t\t\t&cfg_len_aligned, page_sz, 0, 0);\n+\tif (rte_mem_cfg_addr == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot mmap memory for rte_config\\n\");\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n+\t\treturn -1;\n+\t}\n+\n+\t/* remap the actual file into the space we've just reserved */\n+\tmapped_mem_cfg_addr = mmap(rte_mem_cfg_addr,\n+\t\t\tcfg_len_aligned, PROT_READ | PROT_WRITE,\n+\t\t\tMAP_SHARED | MAP_FIXED, mem_cfg_fd, 0);\n+\tif (mapped_mem_cfg_addr == MAP_FAILED) {\n+\t\tmunmap(rte_mem_cfg_addr, cfg_len);\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n+\t\tRTE_LOG(ERR, EAL, \"Cannot remap memory for rte_config\\n\");\n \t\treturn -1;\n \t}\n \n",
    "prefixes": [
        "v5",
        "2/2"
    ]
}