Show a patch.

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

{
    "id": 44223,
    "url": "http://patches.dpdk.org/api/patches/44223/",
    "web_url": "http://patches.dpdk.org/patch/44223/",
    "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": "<c3e4652e37c8d50cbef185ad935f6ea5c137948c.1536064999.git.anatoly.burakov@intel.com>",
    "date": "2018-09-04T13:11:36",
    "name": "[01/16] mem: add length to memseg list",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d8283d40c4183d1d09fbaff27f2390455bbeb6e9",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/",
        "name": "Burakov, Anatoly",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/patch/44223/mbox/",
    "series": [
        {
            "id": 1170,
            "url": "http://patches.dpdk.org/api/series/1170/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1170",
            "date": "2018-09-04T13:11:35",
            "name": "Support externally allocated memory in DPDK",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1170/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44223/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44223/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 1.7.0.7",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 576E22BF7;\n\tTue,  4 Sep 2018 15:12:00 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id 934D5231E\n\tfor <dev@dpdk.org>; Tue,  4 Sep 2018 15:11:56 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Sep 2018 06:11:55 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga006.fm.intel.com with ESMTP; 04 Sep 2018 06:11:52 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw84DBpCp023347; Tue, 4 Sep 2018 14:11:51 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w84DBphl024201;\n\tTue, 4 Sep 2018 14:11:51 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w84DBpRj024197;\n\tTue, 4 Sep 2018 14:11:51 +0100"
        ],
        "References": [
            "<cover.1536064999.git.anatoly.burakov@intel.com>",
            "<cover.1536064999.git.anatoly.burakov@intel.com>"
        ],
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<c3e4652e37c8d50cbef185ad935f6ea5c137948c.1536064999.git.anatoly.burakov@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,329,1531810800\"; d=\"scan'208\";a=\"260567754\"",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": [
            "<cover.1536064999.git.anatoly.burakov@intel.com>",
            "<cover.1536064999.git.anatoly.burakov@intel.com>"
        ],
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Tue,  4 Sep 2018 14:11:36 +0100",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n\tlaszlo.madarassy@ericsson.com, laszlo.vadkerti@ericsson.com,\n\tandras.kovacs@ericsson.com, winnie.tian@ericsson.com,\n\tdaniel.andrasi@ericsson.com, janos.kobor@ericsson.com,\n\tsrinath.mannam@broadcom.com, scott.branden@broadcom.com,\n\tajit.khaparde@broadcom.com, keith.wiles@intel.com, thomas@monjalon.net",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH 01/16] mem: add length to memseg list"
    },
    "content": "Previously, to calculate length of memory area covered by a memseg\nlist, we would've needed to multiply page size by length of fbarray\nbacking that memseg list. This is not obvious and unnecessarily\nlow level, so store length in the memseg list itself.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n drivers/bus/pci/linux/pci.c                       | 2 +-\n lib/librte_eal/bsdapp/eal/eal_memory.c            | 2 ++\n lib/librte_eal/common/eal_common_memory.c         | 5 ++---\n lib/librte_eal/common/include/rte_eal_memconfig.h | 1 +\n lib/librte_eal/linuxapp/eal/eal_memalloc.c        | 3 ++-\n lib/librte_eal/linuxapp/eal/eal_memory.c          | 4 +++-\n 6 files changed, 11 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c\nindex 04648ac93..d6e1027ab 100644\n--- a/drivers/bus/pci/linux/pci.c\n+++ b/drivers/bus/pci/linux/pci.c\n@@ -119,7 +119,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)\n static int\n find_max_end_va(const struct rte_memseg_list *msl, void *arg)\n {\n-\tsize_t sz = msl->memseg_arr.len * msl->page_sz;\n+\tsize_t sz = msl->len;\n \tvoid *end_va = RTE_PTR_ADD(msl->base_va, sz);\n \tvoid **max_va = arg;\n \ndiff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c\nindex 16d2bc7c3..65ea670f9 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_memory.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c\n@@ -79,6 +79,7 @@ rte_eal_hugepage_init(void)\n \t\t}\n \t\tmsl->base_va = addr;\n \t\tmsl->page_sz = page_sz;\n+\t\tmsl->len = internal_config.memory;\n \t\tmsl->socket_id = 0;\n \n \t\t/* populate memsegs. each memseg is 1 page long */\n@@ -370,6 +371,7 @@ alloc_va_space(struct rte_memseg_list *msl)\n \t\treturn -1;\n \t}\n \tmsl->base_va = addr;\n+\tmsl->len = mem_sz;\n \n \treturn 0;\n }\ndiff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex fbfb1b055..0868bf681 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -171,7 +171,7 @@ virt2memseg(const void *addr, const struct rte_memseg_list *msl)\n \n \t/* a memseg list was specified, check if it's the right one */\n \tstart = msl->base_va;\n-\tend = RTE_PTR_ADD(start, (size_t)msl->page_sz * msl->memseg_arr.len);\n+\tend = RTE_PTR_ADD(start, msl->len);\n \n \tif (addr < start || addr >= end)\n \t\treturn NULL;\n@@ -194,8 +194,7 @@ virt2memseg_list(const void *addr)\n \t\tmsl = &mcfg->memsegs[msl_idx];\n \n \t\tstart = msl->base_va;\n-\t\tend = RTE_PTR_ADD(start,\n-\t\t\t\t(size_t)msl->page_sz * msl->memseg_arr.len);\n+\t\tend = RTE_PTR_ADD(start, msl->len);\n \t\tif (addr >= start && addr < end)\n \t\t\tbreak;\n \t}\ndiff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h\nindex aff0688dd..1d8b0a6fe 100644\n--- a/lib/librte_eal/common/include/rte_eal_memconfig.h\n+++ b/lib/librte_eal/common/include/rte_eal_memconfig.h\n@@ -30,6 +30,7 @@ struct rte_memseg_list {\n \t\tuint64_t addr_64;\n \t\t/**< Makes sure addr is always 64-bits */\n \t};\n+\tsize_t len; /**< Length of memory area covered by this memseg list. */\n \tint socket_id; /**< Socket ID for all memsegs in this list. */\n \tuint64_t page_sz; /**< Page size for all memsegs in this list. */\n \tvolatile uint32_t version; /**< version number for multiprocess sync. */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\nindex aa95551a8..d040a2f71 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n@@ -828,7 +828,7 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg)\n \tint msl_idx, seg_idx, ret, dir_fd = -1;\n \n \tstart_addr = (uintptr_t) msl->base_va;\n-\tend_addr = start_addr + msl->memseg_arr.len * (size_t)msl->page_sz;\n+\tend_addr = start_addr + msl->len;\n \n \tif ((uintptr_t)wa->ms->addr < start_addr ||\n \t\t\t(uintptr_t)wa->ms->addr >= end_addr)\n@@ -1314,6 +1314,7 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,\n \t\treturn -1;\n \t}\n \tlocal_msl->base_va = primary_msl->base_va;\n+\tlocal_msl->len = primary_msl->len;\n \n \treturn 0;\n }\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex dbf19499e..c522538bf 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memory.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c\n@@ -857,6 +857,7 @@ alloc_va_space(struct rte_memseg_list *msl)\n \t\treturn -1;\n \t}\n \tmsl->base_va = addr;\n+\tmsl->len = mem_sz;\n \n \treturn 0;\n }\n@@ -1365,6 +1366,7 @@ eal_legacy_hugepage_init(void)\n \t\tmsl->base_va = addr;\n \t\tmsl->page_sz = page_sz;\n \t\tmsl->socket_id = 0;\n+\t\tmsl->len = internal_config.memory;\n \n \t\t/* populate memsegs. each memseg is one page long */\n \t\tfor (cur_seg = 0; cur_seg < n_segs; cur_seg++) {\n@@ -1611,7 +1613,7 @@ eal_legacy_hugepage_init(void)\n \t\tif (msl->memseg_arr.count > 0)\n \t\t\tcontinue;\n \t\t/* this is an unused list, deallocate it */\n-\t\tmem_sz = (size_t)msl->page_sz * msl->memseg_arr.len;\n+\t\tmem_sz = msl->len;\n \t\tmunmap(msl->base_va, mem_sz);\n \t\tmsl->base_va = NULL;\n \n",
    "prefixes": [
        "01/16"
    ]
}