Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/66347/?format=api
https://patches.dpdk.org/api/patches/66347/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200306144844.27255-1-david.marchand@redhat.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": "<20200306144844.27255-1-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200306144844.27255-1-david.marchand@redhat.com", "date": "2020-03-06T14:48:44", "name": "[RFC] app/testpmd: only lock text pages", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2d2d3426674368cf8bfbbc15c58374013c65d304", "submitter": { "id": 1173, "url": "https://patches.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.com" }, "delegate": { "id": 319, "url": "https://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200306144844.27255-1-david.marchand@redhat.com/mbox/", "series": [ { "id": 8818, "url": "https://patches.dpdk.org/api/series/8818/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=8818", "date": "2020-03-06T14:48:44", "name": "[RFC] app/testpmd: only lock text pages", "version": 1, "mbox": "https://patches.dpdk.org/series/8818/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/66347/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/66347/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 1310AA056A;\n\tFri, 6 Mar 2020 15:49:16 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 597492BA8;\n\tFri, 6 Mar 2020 15:49:15 +0100 (CET)", "from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com\n [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 9F61FFEB\n for <dev@dpdk.org>; Fri, 6 Mar 2020 15:49:13 +0100 (CET)", "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-381--TnG40rDMNamL7KHQmNg_Q-1; Fri, 06 Mar 2020 09:49:09 -0500", "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com\n [10.5.11.12])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E40CC73476;\n Fri, 6 Mar 2020 14:49:07 +0000 (UTC)", "from dmarchan.remote.csb (ovpn-204-36.brq.redhat.com [10.40.204.36])\n by smtp.corp.redhat.com (Postfix) with ESMTP id B5F4F60BEC;\n Fri, 6 Mar 2020 14:49:04 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1583506152;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=kWNYYAiRd/5K3urRlYO8EyqNmY07OaiaFQhKTLAfUc8=;\n b=P10dRiZ5/RYrk5cfDFBnEDrMwzGU5nP0qI5yjt+lH1jZoRi3mmVGtQOOQKpOZV58KEMJFC\n cgqjk0+Yz2nxDemSXuwOcmtOZr6B0b4hjtFOjbZGbL2YCHj4Gq/9idOyEnGQHhCXiYMecE\n My8dfJdfwP9PZHrAoUQ/xcD7NqNPvSU=", "X-MC-Unique": "-TnG40rDMNamL7KHQmNg_Q-1", "From": "David Marchand <david.marchand@redhat.com>", "To": "dev@dpdk.org", "Cc": "echaudro@redhat.com, aconole@redhat.com, maxime.coquelin@redhat.com,\n anatoly.burakov@intel.com, Wenzhuo Lu <wenzhuo.lu@intel.com>,\n Jingjing Wu <jingjing.wu@intel.com>,\n Bernard Iremonger <bernard.iremonger@intel.com>", "Date": "Fri, 6 Mar 2020 15:48:44 +0100", "Message-Id": "<20200306144844.27255-1-david.marchand@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=US-ASCII", "Content-Transfer-Encoding": "quoted-printable", "Subject": "[dpdk-dev] [RFC PATCH] app/testpmd: only lock text pages", "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Since 18.05 and the memory subsystem rework, EAL reserves some big\n(unused) mappings.\n\nIn testpmd, we have been locking all pages to avoid page faults during\nbenchmark/performance regression tests [1].\nHowever, asking for locking all the pages triggers issues on FreeBSD [2]\nand becomes really heavy in some Linux configurations (see [3], [4]).\n\nThis patch changes the behavior so that testpmd only lock pages\ncontaining .text by default.\n\n1: https://git.dpdk.org/dpdk/commit/?id=1c036b16c284\n2: https://git.dpdk.org/dpdk/commit/?id=fb7b8b32cd95\n3: https://bugzilla.redhat.com/show_bug.cgi?id=1786923\n4: http://mails.dpdk.org/archives/dev/2020-February/158477.html\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n app/test-pmd/parameters.c | 4 +--\n app/test-pmd/testpmd.c | 53 +++++++++++++++++++++++++++++++--------\n app/test-pmd/testpmd.h | 5 +++-\n 3 files changed, 49 insertions(+), 13 deletions(-)", "diff": "diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex 404dba2b2..952371e6c 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -1304,9 +1304,9 @@ launch_args_parse(int argc, char** argv)\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"hot-plug\"))\n \t\t\t\thot_plug = 1;\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"mlockall\"))\n-\t\t\t\tdo_mlockall = 1;\n+\t\t\t\tdo_mlock = TESTPMD_MLOCK_ALL;\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"no-mlockall\"))\n-\t\t\t\tdo_mlockall = 0;\n+\t\t\t\tdo_mlock = TESTPMD_MLOCK_NONE;\n \t\t\tif (!strcmp(lgopts[opt_idx].name,\n \t\t\t\t \"noisy-tx-sw-buffer-size\")) {\n \t\t\t\tn = atoi(optarg);\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 035836adf..9a1716321 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -13,6 +13,7 @@\n #include <sys/types.h>\n #include <errno.h>\n #include <stdbool.h>\n+#include <link.h>\n \n #include <sys/queue.h>\n #include <sys/stat.h>\n@@ -390,9 +391,9 @@ uint32_t event_print_mask = (UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN) |\n \t\t\t (UINT32_C(1) << RTE_ETH_EVENT_MACSEC) |\n \t\t\t (UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV);\n /*\n- * Decide if all memory are locked for performance.\n+ * Decide which part of memory is locked for performance.\n */\n-int do_mlockall = 0;\n+int do_mlock = TESTPMD_MLOCK_TEXT;\n \n /*\n * NIC bypass mode configuration options.\n@@ -3455,6 +3456,42 @@ signal_handler(int signum)\n \t}\n }\n \n+static void\n+lock_pages(const void *_addr, size_t _len, const char *prefix)\n+{\n+\tconst void *addr;\n+\tsize_t pagesize;\n+\tsize_t len;\n+\n+\t/* While Linux does not care, FreeBSD mlock expects page aligned\n+\t * address (according to the man).\n+\t */\n+\tpagesize = sysconf(_SC_PAGESIZE);\n+\taddr = RTE_PTR_ALIGN_FLOOR(_addr, pagesize);\n+\tlen = _len + ((uintptr_t)_addr & (pagesize - 1));\n+\tif (mlock(addr, len)) {\n+\t\tTESTPMD_LOG(NOTICE, \"%s: mlock %p (0x%zx) aligned to %p (0x%zx) failed with error \\\"%s\\\"\\n\",\n+\t\t\tprefix, _addr, _len, addr, len, strerror(errno));\n+\t}\n+}\n+\n+static int\n+lock_text_cb(struct dl_phdr_info *info, __rte_unused size_t size,\n+\t\t__rte_unused void *data)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < info->dlpi_phnum; i++) {\n+\t\tvoid *addr;\n+\n+\t\tif (info->dlpi_phdr[i].p_memsz == 0)\n+\t\t\tcontinue;\n+\t\taddr = (void *)(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr);\n+\t\tlock_pages(addr, info->dlpi_phdr[i].p_memsz, info->dlpi_name);\n+\t}\n+\treturn 0;\n+}\n+\n int\n main(int argc, char** argv)\n {\n@@ -3514,19 +3551,15 @@ main(int argc, char** argv)\n \tlatencystats_enabled = 0;\n #endif\n \n-\t/* on FreeBSD, mlockall() is disabled by default */\n-#ifdef RTE_EXEC_ENV_FREEBSD\n-\tdo_mlockall = 0;\n-#else\n-\tdo_mlockall = 1;\n-#endif\n-\n \targc -= diag;\n \targv += diag;\n \tif (argc > 1)\n \t\tlaunch_args_parse(argc, argv);\n \n-\tif (do_mlockall && mlockall(MCL_CURRENT | MCL_FUTURE)) {\n+\tif (do_mlock == TESTPMD_MLOCK_TEXT ) {\n+\t\tdl_iterate_phdr(lock_text_cb, NULL);\n+\t} else if (do_mlock == TESTPMD_MLOCK_ALL &&\n+\t\t\tmlockall(MCL_CURRENT | MCL_FUTURE)) {\n \t\tTESTPMD_LOG(NOTICE, \"mlockall() failed with error \\\"%s\\\"\\n\",\n \t\t\tstrerror(errno));\n \t}\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 7a7c73f79..a38e5a1f5 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -343,7 +343,10 @@ extern uint32_t event_print_mask;\n /**< set by \"--print-event xxxx\" and \"--mask-event xxxx parameters */\n extern bool setup_on_probe_event; /**< disabled by port setup-on iterator */\n extern uint8_t hot_plug; /**< enable by \"--hot-plug\" parameter */\n-extern int do_mlockall; /**< set by \"--mlockall\" or \"--no-mlockall\" parameter */\n+#define TESTPMD_MLOCK_NONE 0\n+#define TESTPMD_MLOCK_TEXT 1\n+#define TESTPMD_MLOCK_ALL 2\n+extern int do_mlock; /**< set by \"--mlockall\" or \"--no-mlockall\" parameter */\n extern uint8_t clear_ptypes; /**< disabled by set ptype cmd */\n \n #ifdef RTE_LIBRTE_IXGBE_BYPASS\n", "prefixes": [ "RFC" ] }{ "id": 66347, "url": "