get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57320,
    "url": "http://patches.dpdk.org/api/patches/57320/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/500c51378a8ebca57c85f55bc95f7cd41fc169c4.1564577214.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": "<500c51378a8ebca57c85f55bc95f7cd41fc169c4.1564577214.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/500c51378a8ebca57c85f55bc95f7cd41fc169c4.1564577214.git.anatoly.burakov@intel.com",
    "date": "2019-07-31T12:47:01",
    "name": "[v4,2/2] eal: use base address hint to reserve space for mem config",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "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/500c51378a8ebca57c85f55bc95f7cd41fc169c4.1564577214.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 5854,
            "url": "http://patches.dpdk.org/api/series/5854/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5854",
            "date": "2019-07-31T12:47:00",
            "name": "[v4,1/2] eal: make base address hint OS-specific",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/5854/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/57320/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/57320/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 CCFF11C19A;\n\tWed, 31 Jul 2019 14:47:10 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 3B8C31C11E;\n\tWed, 31 Jul 2019 14:47:06 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t31 Jul 2019 05:47:03 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby orsmga006.jf.intel.com with ESMTP; 31 Jul 2019 05:47:01 -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,330,1559545200\"; d=\"scan'208\";a=\"177303165\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n\tstable@dpdk.org",
        "Date": "Wed, 31 Jul 2019 13:47:01 +0100",
        "Message-Id": "<500c51378a8ebca57c85f55bc95f7cd41fc169c4.1564577214.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": [
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564577214.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564501879.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564577214.git.anatoly.burakov@intel.com>",
            "<09c3f9d74e1e49aa5b3608d4bf4a773d086e83ff.1564501879.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v4 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 d53f0fe69..ce3c5ed2d 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -219,7 +219,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@@ -236,7 +239,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 +257,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 34db78753..55a3bb971 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -305,7 +305,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@@ -317,7 +320,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@@ -330,7 +333,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 +351,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": [
        "v4",
        "2/2"
    ]
}