Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/56501/?format=api
http://patches.dpdk.org/api/patches/56501/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/26384fad6f9afcba9d3311d1bf73e76f4577225d.1563276298.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": "<26384fad6f9afcba9d3311d1bf73e76f4577225d.1563276298.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/26384fad6f9afcba9d3311d1bf73e76f4577225d.1563276298.git.anatoly.burakov@intel.com", "date": "2019-07-16T11:25:05", "name": "eal/freebsd: add support for base virtaddr option", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8e9601d68085546137c5bcfd474e49989f2cf094", "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/26384fad6f9afcba9d3311d1bf73e76f4577225d.1563276298.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 5526, "url": "http://patches.dpdk.org/api/series/5526/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5526", "date": "2019-07-16T11:25:05", "name": "eal/freebsd: add support for base virtaddr option", "version": 1, "mbox": "http://patches.dpdk.org/series/5526/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/56501/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/56501/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 AAFCF2BF4;\n\tTue, 16 Jul 2019 13:25:10 +0200 (CEST)", "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id 6301A2BAB\n\tfor <dev@dpdk.org>; Tue, 16 Jul 2019 13:25:08 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t16 Jul 2019 04:25:07 -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; 16 Jul 2019 04:25:05 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.63,498,1557212400\"; d=\"scan'208\";a=\"172515907\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "John McNamara <john.mcnamara@intel.com>,\n\tMarko Kovacevic <marko.kovacevic@intel.com>,\n\tBruce Richardson <bruce.richardson@intel.com>", "Date": "Tue, 16 Jul 2019 12:25:05 +0100", "Message-Id": "<26384fad6f9afcba9d3311d1bf73e76f4577225d.1563276298.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[dpdk-dev] [PATCH] eal/freebsd: add support for base virtaddr option", "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": "According to our docs, only Linuxapp supports base-virtaddr option.\nThat is, strictly speaking, not true because most of the things\nthat are attempting to respect base-virtaddr are in common files,\nso FreeBSD already *mostly* supports this option in practice.\n\nThis commit fixes the remaining bits to explicitly support\nbase-virtaddr option, and moves the arg parsing from EAL to common\noptions parsing code. Documentation is also updated to reflect\nthat all platforms now support base-virtaddr.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n doc/guides/linux_gsg/eal_args.include.rst | 6 +++\n doc/guides/linux_gsg/linux_eal_parameters.rst | 6 ---\n doc/guides/rel_notes/release_19_08.rst | 5 +++\n lib/librte_eal/common/eal_common_options.c | 38 ++++++++++++++++++\n lib/librte_eal/freebsd/eal/eal.c | 13 ++++++-\n lib/librte_eal/linux/eal/eal.c | 39 -------------------\n 6 files changed, 60 insertions(+), 47 deletions(-)", "diff": "diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux_gsg/eal_args.include.rst\nindex cf421a56e..ed8b0e35b 100644\n--- a/doc/guides/linux_gsg/eal_args.include.rst\n+++ b/doc/guides/linux_gsg/eal_args.include.rst\n@@ -86,6 +86,12 @@ Multiprocessing-related options\n \n Set the type of the current process.\n \n+* ``--base-virtaddr <address>``\n+\n+ Attempt to use a different starting address for all memory maps of the\n+ primary DPDK process. This can be helpful if secondary processes cannot\n+ start due to conflicts in address map.\n+\n Memory-related options\n ~~~~~~~~~~~~~~~~~~~~~~\n \ndiff --git a/doc/guides/linux_gsg/linux_eal_parameters.rst b/doc/guides/linux_gsg/linux_eal_parameters.rst\nindex c63f0f49a..b2cc60e44 100644\n--- a/doc/guides/linux_gsg/linux_eal_parameters.rst\n+++ b/doc/guides/linux_gsg/linux_eal_parameters.rst\n@@ -49,12 +49,6 @@ Multiprocessing-related options\n allows running multiple independent DPDK primary/secondary processes under\n different prefixes.\n \n-* ``--base-virtaddr <address>``\n-\n- Attempt to use a different starting address for all memory maps of the\n- primary DPDK process. This can be helpful if secondary processes cannot\n- start due to conflicts in address map.\n-\n Memory-related options\n ~~~~~~~~~~~~~~~~~~~~~~\n \ndiff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst\nindex 4a1fd8dd8..1b58d9282 100644\n--- a/doc/guides/rel_notes/release_19_08.rst\n+++ b/doc/guides/rel_notes/release_19_08.rst\n@@ -56,6 +56,11 @@ New Features\n Also, make sure to start the actual text at the margin.\n =========================================================\n \n+* **FreeBSD now supports `--base-virtaddr` EAL option.**\n+\n+ FreeBSD version now also supports setting base virtual address for mapping\n+ pages and resources into its address space.\n+\n * **Added MCS lock.**\n \n MCS lock provides scalability by spinning on a CPU/thread local variable\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex 512d5088e..156e48e19 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -20,6 +20,7 @@\n #include <rte_eal.h>\n #include <rte_log.h>\n #include <rte_lcore.h>\n+#include <rte_memory.h>\n #include <rte_tailq.h>\n #include <rte_version.h>\n #include <rte_devargs.h>\n@@ -1095,6 +1096,36 @@ eal_parse_iova_mode(const char *name)\n \treturn 0;\n }\n \n+static int\n+eal_parse_base_virtaddr(const char *arg)\n+{\n+\tchar *end;\n+\tuint64_t addr;\n+\n+\terrno = 0;\n+\taddr = strtoull(arg, &end, 16);\n+\n+\t/* check for errors */\n+\tif ((errno != 0) || (arg[0] == '\\0') || end == NULL || (*end != '\\0'))\n+\t\treturn -1;\n+\n+\t/* make sure we don't exceed 32-bit boundary on 32-bit target */\n+#ifndef RTE_ARCH_64\n+\tif (addr >= UINTPTR_MAX)\n+\t\treturn -1;\n+#endif\n+\n+\t/* align the addr on 16M boundary, 16MB is the minimum huge page\n+\t * size on IBM Power architecture. If the addr is aligned to 16MB,\n+\t * it can align to 2MB for x86. So this alignment can also be used\n+\t * on x86 and other architectures.\n+\t */\n+\tinternal_config.base_virtaddr =\n+\t\tRTE_PTR_ALIGN_CEIL((uintptr_t)addr, (size_t)RTE_PGSIZE_16M);\n+\n+\treturn 0;\n+}\n+\n /* caller is responsible for freeing the returned string */\n static char *\n available_cores(void)\n@@ -1408,6 +1439,13 @@ eal_parse_common_option(int opt, const char *optarg,\n \t\t\treturn -1;\n \t\t}\n \t\tbreak;\n+\tcase OPT_BASE_VIRTADDR_NUM:\n+\t\tif (eal_parse_base_virtaddr(optarg) < 0) {\n+\t\t\tRTE_LOG(ERR, EAL, \"invalid parameter for --\"\n+\t\t\t\t\tOPT_BASE_VIRTADDR \"\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n \n \t/* don't know what to do, leave this to caller */\n \tdefault:\ndiff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex d53f0fe69..7ebe11db6 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -227,6 +227,14 @@ rte_eal_config_create(void)\n \tif (internal_config.no_shconf)\n \t\treturn 0;\n \n+\t/* map the config before base address so that we don't waste a page */\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+\telse\n+\t\trte_mem_cfg_addr = NULL;\n+\n \tif (mem_cfg_fd < 0){\n \t\tmem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600);\n \t\tif (mem_cfg_fd < 0) {\n@@ -254,8 +262,9 @@ 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+\trte_mem_cfg_addr = mmap(rte_mem_cfg_addr,\n+\t\t\tsizeof(*rte_config.mem_config), PROT_READ | PROT_WRITE,\n+\t\t\tMAP_SHARED, mem_cfg_fd, 0);\n \n \tif (rte_mem_cfg_addr == MAP_FAILED){\n \t\tRTE_LOG(ERR, EAL, \"Cannot mmap memory for rte_config\\n\");\ndiff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c\nindex 2e5499f9b..79f5d70c3 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -609,35 +609,6 @@ eal_parse_socket_arg(char *strval, volatile uint64_t *socket_arg)\n \treturn 0;\n }\n \n-static int\n-eal_parse_base_virtaddr(const char *arg)\n-{\n-\tchar *end;\n-\tuint64_t addr;\n-\n-\terrno = 0;\n-\taddr = strtoull(arg, &end, 16);\n-\n-\t/* check for errors */\n-\tif ((errno != 0) || (arg[0] == '\\0') || end == NULL || (*end != '\\0'))\n-\t\treturn -1;\n-\n-\t/* make sure we don't exceed 32-bit boundary on 32-bit target */\n-#ifndef RTE_ARCH_64\n-\tif (addr >= UINTPTR_MAX)\n-\t\treturn -1;\n-#endif\n-\n-\t/* align the addr on 16M boundary, 16MB is the minimum huge page\n-\t * size on IBM Power architecture. If the addr is aligned to 16MB,\n-\t * it can align to 2MB for x86. So this alignment can also be used\n-\t * on x86 */\n-\tinternal_config.base_virtaddr =\n-\t\tRTE_PTR_ALIGN_CEIL((uintptr_t)addr, (size_t)RTE_PGSIZE_16M);\n-\n-\treturn 0;\n-}\n-\n static int\n eal_parse_vfio_intr(const char *mode)\n {\n@@ -796,16 +767,6 @@ eal_parse_args(int argc, char **argv)\n \t\t\tinternal_config.force_socket_limits = 1;\n \t\t\tbreak;\n \n-\t\tcase OPT_BASE_VIRTADDR_NUM:\n-\t\t\tif (eal_parse_base_virtaddr(optarg) < 0) {\n-\t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameter for --\"\n-\t\t\t\t\t\tOPT_BASE_VIRTADDR \"\\n\");\n-\t\t\t\teal_usage(prgname);\n-\t\t\t\tret = -1;\n-\t\t\t\tgoto out;\n-\t\t\t}\n-\t\t\tbreak;\n-\n \t\tcase OPT_VFIO_INTR_NUM:\n \t\t\tif (eal_parse_vfio_intr(optarg) < 0) {\n \t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n", "prefixes": [] }{ "id": 56501, "url": "