get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57247,
    "url": "http://patches.dpdk.org/api/patches/57247/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/3f4bf9cdf8b472e05e76274f6e8df5be936b01a9.1564398617.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": "<3f4bf9cdf8b472e05e76274f6e8df5be936b01a9.1564398617.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/3f4bf9cdf8b472e05e76274f6e8df5be936b01a9.1564398617.git.anatoly.burakov@intel.com",
    "date": "2019-07-29T12:42:52",
    "name": "[2/2] eal: use base address hint to reserve space for mem config",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "11055406776bb38649298a139991fde2d987bb61",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.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/3f4bf9cdf8b472e05e76274f6e8df5be936b01a9.1564398617.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 5813,
            "url": "http://patches.dpdk.org/api/series/5813/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5813",
            "date": "2019-07-29T12:42:51",
            "name": "[1/2] eal: make base address hint OS-specific",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/5813/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/57247/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/57247/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 C60771BFB5;\n\tMon, 29 Jul 2019 14:43:01 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 06D001BF8D;\n\tMon, 29 Jul 2019 14:42:55 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jul 2019 05:42:54 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby fmsmga002.fm.intel.com with ESMTP; 29 Jul 2019 05:42: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.64,322,1559545200\"; d=\"scan'208\";a=\"199658790\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n\tstable@dpdk.org",
        "Date": "Mon, 29 Jul 2019 13:42:52 +0100",
        "Message-Id": "<3f4bf9cdf8b472e05e76274f6e8df5be936b01a9.1564398617.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": [
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564398617.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564398617.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564398617.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564398617.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 2/2] eal: use base address hint to reserve space\n\tfor 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 lib/librte_eal/freebsd/eal/eal.c | 27 +++++++++++++++++++++------\n lib/librte_eal/linux/eal/eal.c   | 30 ++++++++++++++++++++++--------\n 2 files changed, 43 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex d53f0fe69..fb43c00fd 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,29 @@ 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), EAL_VIRTUAL_AREA_ADDR_IS_HINT,\n+\t\t\t0);\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..ed0ebcc8e 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,26 @@ 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), EAL_VIRTUAL_AREA_ADDR_IS_HINT,\n+\t\t\t0);\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": [
        "2/2"
    ]
}