get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57280,
    "url": "http://patches.dpdk.org/api/patches/57280/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/752b0334b6070d247e4e47ead8e04b09a8c7cc46.1564501879.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": "<752b0334b6070d247e4e47ead8e04b09a8c7cc46.1564501879.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/752b0334b6070d247e4e47ead8e04b09a8c7cc46.1564501879.git.anatoly.burakov@intel.com",
    "date": "2019-07-30T15:51:21",
    "name": "[v3,2/2] eal: use base address hint to reserve space for mem config",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "89e8c16e06cfd51944c63c568f52234c6197b951",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/752b0334b6070d247e4e47ead8e04b09a8c7cc46.1564501879.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 5835,
            "url": "http://patches.dpdk.org/api/series/5835/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5835",
            "date": "2019-07-30T15:51:20",
            "name": "[v3,1/2] eal: make base address hint OS-specific",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/5835/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/57280/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/57280/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 252501C028;\n\tTue, 30 Jul 2019 17:51:30 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id EE8E01BF05;\n\tTue, 30 Jul 2019 17:51:24 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 Jul 2019 08:51:23 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby orsmga002.jf.intel.com with ESMTP; 30 Jul 2019 08:51:22 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,327,1559545200\"; d=\"scan'208\";a=\"183169795\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n\tstable@dpdk.org",
        "Date": "Tue, 30 Jul 2019 16:51:21 +0100",
        "Message-Id": "<752b0334b6070d247e4e47ead8e04b09a8c7cc46.1564501879.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": [
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564501879.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564501063.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564501879.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564501063.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v3 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    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 | 26 ++++++++++++++++++++------\n lib/librte_eal/linux/eal/eal.c   | 29 +++++++++++++++++++++--------\n 2 files changed, 41 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex d53f0fe69..5d2e147b1 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -219,7 +219,8 @@ 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 cfg_len = sizeof(*rte_config.mem_config);\n+\tvoid *rte_mem_cfg_addr, *mapped_mem_cfg_addr;\n \tint retval;\n \n \tconst char *pathname = eal_runtime_config_path();\n@@ -236,7 +237,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@@ -254,15 +255,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,\n+\t\t\tsysconf(_SC_PAGESIZE), 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, 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 34db78753..bfd3bc2da 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -305,7 +305,8 @@ 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 cfg_len = sizeof(*rte_config.mem_config);\n+\tvoid *rte_mem_cfg_addr, *mapped_mem_cfg_addr;\n \tint retval;\n \n \tconst char *pathname = eal_runtime_config_path();\n@@ -330,7 +331,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@@ -348,13 +349,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, &cfg_len,\n+\t\t\tsysconf(_SC_PAGESIZE), 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, 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": [
        "v3",
        "2/2"
    ]
}