Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/48764/?format=api
http://patchwork.dpdk.org/api/patches/48764/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/ed8bab1aec7b3bd9433435f32054df0e54911fff.1544701282.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": "<ed8bab1aec7b3bd9433435f32054df0e54911fff.1544701282.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/ed8bab1aec7b3bd9433435f32054df0e54911fff.1544701282.git.anatoly.burakov@intel.com", "date": "2018-12-13T11:43:18", "name": "[v3,4/5] mem: use memfd for no-huge mode", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "c408781bf6a03466044499ba6594f29a3de8b71c", "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/ed8bab1aec7b3bd9433435f32054df0e54911fff.1544701282.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 2758, "url": "http://patchwork.dpdk.org/api/series/2758/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=2758", "date": "2018-12-13T11:43:14", "name": "Allow using virtio-user without hugepages", "version": 3, "mbox": "http://patchwork.dpdk.org/series/2758/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/48764/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/48764/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 885D71B50F;\n\tThu, 13 Dec 2018 12:43:31 +0100 (CET)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 935471B4F4\n\tfor <dev@dpdk.org>; Thu, 13 Dec 2018 12:43:24 +0100 (CET)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Dec 2018 03:43:23 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 13 Dec 2018 03:43:21 -0800", "from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com\n\t[10.243.17.64])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\twBDBhKJc032160; Thu, 13 Dec 2018 11:43:20 GMT", "from sivswdev05.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev05.ir.intel.com with ESMTP id wBDBhKjN012562;\n\tThu, 13 Dec 2018 11:43:20 GMT", "(from aburakov@localhost)\n\tby sivswdev05.ir.intel.com with LOCAL id wBDBhKbs012558;\n\tThu, 13 Dec 2018 11:43:20 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.56,348,1539673200\"; d=\"scan'208\";a=\"118038671\"", "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>, przemyslawx.lal@intel.com,\n\tkuralamudhan.ramakrishnan@intel.com, ivan.coughlan@intel.com,\n\ttiwei.bie@intel.com, ray.kinsella@intel.com, maxime.coquelin@redhat.com", "Date": "Thu, 13 Dec 2018 11:43:18 +0000", "Message-Id": "<ed8bab1aec7b3bd9433435f32054df0e54911fff.1544701282.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1544701282.git.anatoly.burakov@intel.com>", "<cover.1544701282.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1544701282.git.anatoly.burakov@intel.com>", "<cover.1544546363.git.anatoly.burakov@intel.com>\n\t<cover.1544701282.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v3 4/5] mem: use memfd for no-huge mode", "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": "When running in no-huge mode, we anonymously allocate our memory.\nWhile this works for regular NICs and vdev's, it's not suitable\nfor memory sharing scenarios such as virtio with vhost_user\nbackend.\n\nTo fix this, allocate no-huge memory using memfd, and register\nit with memalloc just like any other memseg fd. This will enable\nusing rte_memseg_get_fd() API with --no-huge EAL flag.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\nAcked-by: Tiwei Bie <tiwei.bie@intel.com>\n---\n\nNotes:\n v3:\n - Clarify release notes to state that the changes apply to\n virtio-user NICs rather than virtio in general\n \n v2:\n - Detect memfd support at compile time\n - Change memfd-related log level to debug\n\n doc/guides/rel_notes/release_19_02.rst | 5 +++\n lib/librte_eal/linuxapp/eal/eal_memory.c | 54 +++++++++++++++++++++++-\n 2 files changed, 57 insertions(+), 2 deletions(-)", "diff": "diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst\nindex 960098582..f733ad139 100644\n--- a/doc/guides/rel_notes/release_19_02.rst\n+++ b/doc/guides/rel_notes/release_19_02.rst\n@@ -23,6 +23,11 @@ DPDK Release 19.02\n New Features\n ------------\n \n+* **Support for using VirtIO without hugepages**\n+\n+ The --no-huge mode was augmented to use memfd-backed memory (on systems that\n+ support memfd), to allow using virtio-user-based NICs without hugepages.\n+\n .. This section should contain new features added in this release.\n Sample format:\n \ndiff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex 32feb415d..7d922a965 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memory.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c\n@@ -25,6 +25,10 @@\n #include <sys/time.h>\n #include <signal.h>\n #include <setjmp.h>\n+#ifdef F_ADD_SEALS /* if file sealing is supported, so is memfd */\n+#include <linux/memfd.h>\n+#define MEMFD_SUPPORTED\n+#endif\n #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES\n #include <numa.h>\n #include <numaif.h>\n@@ -1341,12 +1345,18 @@ eal_legacy_hugepage_init(void)\n \t/* hugetlbfs can be disabled */\n \tif (internal_config.no_hugetlbfs) {\n \t\tstruct rte_memseg_list *msl;\n+\t\tint n_segs, cur_seg, fd, flags;\n+#ifdef MEMFD_SUPPORTED\n+\t\tint memfd;\n+#endif\n \t\tuint64_t page_sz;\n-\t\tint n_segs, cur_seg;\n \n \t\t/* nohuge mode is legacy mode */\n \t\tinternal_config.legacy_mem = 1;\n \n+\t\t/* nohuge mode is single-file segments mode */\n+\t\tinternal_config.single_file_segments = 1;\n+\n \t\t/* create a memseg list */\n \t\tmsl = &mcfg->memsegs[0];\n \n@@ -1359,8 +1369,38 @@ eal_legacy_hugepage_init(void)\n \t\t\treturn -1;\n \t\t}\n \n+\t\t/* set up parameters for anonymous mmap */\n+\t\tfd = -1;\n+\t\tflags = MAP_PRIVATE | MAP_ANONYMOUS;\n+\n+#ifdef MEMFD_SUPPORTED\n+\t\t/* create a memfd and store it in the segment fd table */\n+\t\tmemfd = memfd_create(\"nohuge\", 0);\n+\t\tif (memfd < 0) {\n+\t\t\tRTE_LOG(DEBUG, EAL, \"Cannot create memfd: %s\\n\",\n+\t\t\t\t\tstrerror(errno));\n+\t\t\tRTE_LOG(DEBUG, EAL, \"Falling back to anonymous map\\n\");\n+\t\t} else {\n+\t\t\t/* we got an fd - now resize it */\n+\t\t\tif (ftruncate(memfd, internal_config.memory) < 0) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Cannot resize memfd: %s\\n\",\n+\t\t\t\t\t\tstrerror(errno));\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Falling back to anonymous map\\n\");\n+\t\t\t\tclose(memfd);\n+\t\t\t} else {\n+\t\t\t\t/* creating memfd-backed file was successful.\n+\t\t\t\t * we want changes to memfd to be visible to\n+\t\t\t\t * other processes (such as vhost backend), so\n+\t\t\t\t * map it as shared memory.\n+\t\t\t\t */\n+\t\t\t\tRTE_LOG(DEBUG, EAL, \"Using memfd for anonymous memory\\n\");\n+\t\t\t\tfd = memfd;\n+\t\t\t\tflags = MAP_SHARED;\n+\t\t\t}\n+\t\t}\n+#endif\n \t\taddr = mmap(NULL, internal_config.memory, PROT_READ | PROT_WRITE,\n-\t\t\t\tMAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n+\t\t\t\tflags, fd, 0);\n \t\tif (addr == MAP_FAILED) {\n \t\t\tRTE_LOG(ERR, EAL, \"%s: mmap() failed: %s\\n\", __func__,\n \t\t\t\t\tstrerror(errno));\n@@ -1371,6 +1411,16 @@ eal_legacy_hugepage_init(void)\n \t\tmsl->socket_id = 0;\n \t\tmsl->len = internal_config.memory;\n \n+\t\t/* we're in single-file segments mode, so only the segment list\n+\t\t * fd needs to be set up.\n+\t\t */\n+\t\tif (fd != -1) {\n+\t\t\tif (eal_memalloc_set_seg_list_fd(0, fd) < 0) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Cannot set up segment list fd\\n\");\n+\t\t\t\t/* not a serious error, proceed */\n+\t\t\t}\n+\t\t}\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 \t\t\tarr = &msl->memseg_arr;\n", "prefixes": [ "v3", "4/5" ] }{ "id": 48764, "url": "