Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/41816/?format=api
http://patchwork.dpdk.org/api/patches/41816/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/385f43246053aaf19d2377dbb9f91dbf8c314e35.1530186042.git.anatoly.burakov@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<385f43246053aaf19d2377dbb9f91dbf8c314e35.1530186042.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/385f43246053aaf19d2377dbb9f91dbf8c314e35.1530186042.git.anatoly.burakov@intel.com", "date": "2018-06-28T11:41:48", "name": "[v2,2/3] eal/bsdapp: concatenate adjacent segments", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "28c5941549b6cb457de9a9597c8f16235ad2e85d", "submitter": { "id": 4, "url": "http://patchwork.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/385f43246053aaf19d2377dbb9f91dbf8c314e35.1530186042.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 289, "url": "http://patchwork.dpdk.org/api/series/289/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=289", "date": "2018-06-28T11:41:48", "name": "[v2,1/3] eal/bsdapp: fix segment index display", "version": 2, "mbox": "http://patchwork.dpdk.org/series/289/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/41816/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/41816/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 A03205F2F;\n\tThu, 28 Jun 2018 13:41:53 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 0DBE75B2A\n\tfor <dev@dpdk.org>; Thu, 28 Jun 2018 13:41:51 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Jun 2018 04:41:51 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga007.fm.intel.com with ESMTP; 28 Jun 2018 04:41:51 -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\tw5SBfnXs010613; Thu, 28 Jun 2018 12:41:49 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w5SBfnm3008961;\n\tThu, 28 Jun 2018 12:41:49 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w5SBfnbO008957;\n\tThu, 28 Jun 2018 12:41:49 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,283,1526367600\"; d=\"scan'208\";a=\"50579577\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "Bruce Richardson <bruce.richardson@intel.com>", "Date": "Thu, 28 Jun 2018 12:41:48 +0100", "Message-Id": "<385f43246053aaf19d2377dbb9f91dbf8c314e35.1530186042.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<f046c737e0304a8fdbf23b766577757634119f31.1530186042.git.anatoly.burakov@intel.com>", "<fd5598072a48e941be2f851b6286078b50e0c7b2.1528716160.git.anatoly.burakov@intel.com>" ], "References": [ "<f046c737e0304a8fdbf23b766577757634119f31.1530186042.git.anatoly.burakov@intel.com>", "<fd5598072a48e941be2f851b6286078b50e0c7b2.1528716160.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v2 2/3] eal/bsdapp: concatenate adjacent segments", "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": "Previously, memory allocator always left holes between mapped\ncontigmem segments, even if they were IOVA-contiguous. Fix this\nby remembering last IOVA address and memseg index, and checking\nagainst those when mapping new contigmem segments.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n v2:\n - Fix comparison when deciding if hole is needed\n\n lib/librte_eal/bsdapp/eal/eal_memory.c | 48 ++++++++++++++++----------\n 1 file changed, 30 insertions(+), 18 deletions(-)", "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c\nindex ca06de2f8..7bf05c760 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_memory.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c\n@@ -104,6 +104,8 @@ rte_eal_hugepage_init(void)\n \t/* map all hugepages and sort them */\n \tfor (i = 0; i < internal_config.num_hugepage_sizes; i ++){\n \t\tstruct hugepage_info *hpi;\n+\t\trte_iova_t prev_end = 0;\n+\t\tint prev_ms_idx = -1;\n \t\tuint64_t page_sz, mem_needed;\n \t\tunsigned int n_pages, max_pages;\n \n@@ -124,10 +126,27 @@ rte_eal_hugepage_init(void)\n \t\t\tint error;\n \t\t\tsize_t sysctl_size = sizeof(physaddr);\n \t\t\tchar physaddr_str[64];\n+\t\t\tbool is_adjacent;\n+\n+\t\t\t/* first, check if this segment is IOVA-adjacent to\n+\t\t\t * the previous one.\n+\t\t\t */\n+\t\t\tsnprintf(physaddr_str, sizeof(physaddr_str),\n+\t\t\t\t\t\"hw.contigmem.physaddr.%d\", j);\n+\t\t\terror = sysctlbyname(physaddr_str, &physaddr,\n+\t\t\t\t\t&sysctl_size, NULL, 0);\n+\t\t\tif (error < 0) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Failed to get physical addr for buffer %u \"\n+\t\t\t\t\t\t\"from %s\\n\", j, hpi->hugedir);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\n+\t\t\tis_adjacent = prev_end != 0 && physaddr == prev_end;\n+\t\t\tprev_end = physaddr + hpi->hugepage_sz;\n \n \t\t\tfor (msl_idx = 0; msl_idx < RTE_MAX_MEMSEG_LISTS;\n \t\t\t\t\tmsl_idx++) {\n-\t\t\t\tbool empty;\n+\t\t\t\tbool empty, need_hole;\n \t\t\t\tmsl = &mcfg->memsegs[msl_idx];\n \t\t\t\tarr = &msl->memseg_arr;\n \n@@ -136,20 +155,23 @@ rte_eal_hugepage_init(void)\n \n \t\t\t\tempty = arr->count == 0;\n \n-\t\t\t\t/* we need 1, plus hole if not empty */\n+\t\t\t\t/* we need a hole if this isn't an empty memseg\n+\t\t\t\t * list, and if previous segment was not\n+\t\t\t\t * adjacent to current one.\n+\t\t\t\t */\n+\t\t\t\tneed_hole = !empty && !is_adjacent;\n+\n+\t\t\t\t/* we need 1, plus hole if not adjacent */\n \t\t\t\tms_idx = rte_fbarray_find_next_n_free(arr,\n-\t\t\t\t\t\t0, 1 + (empty ? 1 : 0));\n+\t\t\t\t\t\t0, 1 + (need_hole ? 1 : 0));\n \n \t\t\t\t/* memseg list is full? */\n \t\t\t\tif (ms_idx < 0)\n \t\t\t\t\tcontinue;\n \n-\t\t\t\t/* leave some space between memsegs, they are\n-\t\t\t\t * not IOVA contiguous, so they shouldn't be VA\n-\t\t\t\t * contiguous either.\n-\t\t\t\t */\n-\t\t\t\tif (!empty)\n+\t\t\t\tif (need_hole && prev_ms_idx == ms_idx - 1)\n \t\t\t\t\tms_idx++;\n+\t\t\t\tprev_ms_idx = ms_idx;\n \n \t\t\t\tbreak;\n \t\t\t}\n@@ -178,16 +200,6 @@ rte_eal_hugepage_init(void)\n \t\t\t\treturn -1;\n \t\t\t}\n \n-\t\t\tsnprintf(physaddr_str, sizeof(physaddr_str), \"hw.contigmem\"\n-\t\t\t\t\t\".physaddr.%d\", j);\n-\t\t\terror = sysctlbyname(physaddr_str, &physaddr, &sysctl_size,\n-\t\t\t\t\tNULL, 0);\n-\t\t\tif (error < 0) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"Failed to get physical addr for buffer %u \"\n-\t\t\t\t\t\t\"from %s\\n\", j, hpi->hugedir);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\n \t\t\tseg->addr = addr;\n \t\t\tseg->iova = physaddr;\n \t\t\tseg->hugepage_sz = page_sz;\n", "prefixes": [ "v2", "2/3" ] }{ "id": 41816, "url": "