Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/32440/?format=api
https://patches.dpdk.org/api/patches/32440/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/a345b702ab7403f344e4b28674c7c9e78a61030d.1513680516.git.anatoly.burakov@intel.com/", "project": { "id": 1, "url": "https://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": "<a345b702ab7403f344e4b28674c7c9e78a61030d.1513680516.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/a345b702ab7403f344e4b28674c7c9e78a61030d.1513680516.git.anatoly.burakov@intel.com", "date": "2017-12-19T11:04:37", "name": "[dpdk-dev,13/23] eal: make use of dynamic memory allocation for init", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "7ff9cd2296424f801ea7054f3eb2037d816147c4", "submitter": { "id": 4, "url": "https://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/a345b702ab7403f344e4b28674c7c9e78a61030d.1513680516.git.anatoly.burakov@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/32440/comments/", "check": "warning", "checks": "https://patches.dpdk.org/api/patches/32440/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 190801B24F;\n\tTue, 19 Dec 2017 12:05:41 +0100 (CET)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 4CF68160\n\tfor <dev@dpdk.org>; Tue, 19 Dec 2017 12:05:04 +0100 (CET)", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Dec 2017 03:05:03 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga008.jf.intel.com with ESMTP; 19 Dec 2017 03:05:01 -0800", "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\tvBJB50j1030165; Tue, 19 Dec 2017 11:05:00 GMT", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id vBJB50is005404;\n\tTue, 19 Dec 2017 11:05:00 GMT", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id vBJB50Pi005399;\n\tTue, 19 Dec 2017 11:05:00 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.45,426,1508828400\"; d=\"scan'208\";a=\"4002766\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "andras.kovacs@ericsson.com, laszlo.vadkeri@ericsson.com,\n\tkeith.wiles@intel.com, benjamin.walker@intel.com,\n\tbruce.richardson@intel.com, thomas@monjalon.net", "Date": "Tue, 19 Dec 2017 11:04:37 +0000", "Message-Id": "<a345b702ab7403f344e4b28674c7c9e78a61030d.1513680516.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1513680516.git.anatoly.burakov@intel.com>", "<cover.1513680516.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1513680516.git.anatoly.burakov@intel.com>", "<cover.1513680516.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH 13/23] eal: make use of dynamic memory allocation\n\tfor init", "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add a new (non-legacy) memory init path for EAL. It uses the\nnew dynamic allocation facilities, although it's only being run\nat startup.\n\nIf no -m or --socket-mem switches were specified, the new init\nwill not allocate anything, whereas if those switches were passed,\nappropriate amounts of pages would be requested, just like for\nlegacy init.\n\nSince rte_malloc support for dynamic allocation comes in later\npatches, running DPDK without --socket-mem or -m switches will\nfail in this patch.\n\nAlso, allocated pages will be physically discontiguous (or rather,\nthey're not guaranteed to be physically contiguous - they may still\nbe, by accident) unless IOVA_AS_VA mode is used.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/linuxapp/eal/eal_memory.c | 60 ++++++++++++++++++++++++++++++++\n 1 file changed, 60 insertions(+)", "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex 59f6889..7cc4a55 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memory.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c\n@@ -68,6 +68,7 @@\n #include <rte_string_fns.h>\n \n #include \"eal_private.h\"\n+#include \"eal_memalloc.h\"\n #include \"eal_internal_cfg.h\"\n #include \"eal_filesystem.h\"\n #include \"eal_hugepages.h\"\n@@ -1322,6 +1323,61 @@ eal_legacy_hugepage_init(void)\n \treturn -1;\n }\n \n+static int\n+eal_hugepage_init(void) {\n+\tstruct hugepage_info used_hp[MAX_HUGEPAGE_SIZES];\n+\tuint64_t memory[RTE_MAX_NUMA_NODES];\n+\tint hp_sz_idx, socket_id;\n+\n+\ttest_phys_addrs_available();\n+\n+\tmemset(used_hp, 0, sizeof(used_hp));\n+\n+\tfor (hp_sz_idx = 0;\n+\t\t\thp_sz_idx < (int) internal_config.num_hugepage_sizes;\n+\t\t\thp_sz_idx++) {\n+\t\t/* meanwhile, also initialize used_hp hugepage sizes in used_hp */\n+\t\tstruct hugepage_info *hpi;\n+\t\thpi = &internal_config.hugepage_info[hp_sz_idx];\n+\t\tused_hp[hp_sz_idx].hugepage_sz = hpi->hugepage_sz;\n+\t}\n+\n+\t/* make a copy of socket_mem, needed for balanced allocation. */\n+\tfor (hp_sz_idx = 0; hp_sz_idx < RTE_MAX_NUMA_NODES; hp_sz_idx++)\n+\t\tmemory[hp_sz_idx] = internal_config.socket_mem[hp_sz_idx];\n+\n+\t/* calculate final number of pages */\n+\tif (calc_num_pages_per_socket(memory,\n+\t\t\tinternal_config.hugepage_info, used_hp,\n+\t\t\tinternal_config.num_hugepage_sizes) < 0)\n+\t\treturn -1;\n+\n+\tfor (int hp_sz_idx = 0;\n+\t\t\thp_sz_idx < (int) internal_config.num_hugepage_sizes;\n+\t\t\thp_sz_idx++) {\n+\t\tfor (socket_id = 0; socket_id < RTE_MAX_NUMA_NODES;\n+\t\t\t\tsocket_id++) {\n+\t\t\tstruct hugepage_info *hpi = &used_hp[hp_sz_idx];\n+\t\t\tunsigned num_pages = hpi->num_pages[socket_id];\n+\t\t\tint num_pages_alloc;\n+\n+\t\t\tif (num_pages == 0)\n+\t\t\t\tcontinue;\n+\n+\t\t\tRTE_LOG(DEBUG, EAL, \"Allocating %u pages of size %luM on socket %i\\n\",\n+\t\t\t\tnum_pages, hpi->hugepage_sz >> 20, socket_id);\n+\n+\t\t\tnum_pages_alloc = eal_memalloc_alloc_page_bulk(NULL,\n+\t\t\t\t\tnum_pages,\n+\t\t\t\t\thpi->hugepage_sz, socket_id,\n+\t\t\t\t\ttrue);\n+\t\t\tif (num_pages_alloc < 0)\n+\t\t\t\treturn -1;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n /*\n * uses fstat to report the size of a file on disk\n */\n@@ -1533,6 +1589,8 @@ int\n rte_eal_hugepage_init(void) {\n \tif (internal_config.legacy_mem)\n \t\treturn eal_legacy_hugepage_init();\n+\telse\n+\t\treturn eal_hugepage_init();\n \treturn -1;\n }\n \n@@ -1540,6 +1598,8 @@ int\n rte_eal_hugepage_attach(void) {\n \tif (internal_config.legacy_mem)\n \t\treturn eal_legacy_hugepage_attach();\n+\telse\n+\t\tRTE_LOG(ERR, EAL, \"Secondary processes aren't supported yet\\n\");\n \treturn -1;\n }\n \n", "prefixes": [ "dpdk-dev", "13/23" ] }{ "id": 32440, "url": "