Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/48647/?format=api
http://patches.dpdk.org/api/patches/48647/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/28e25797ef95a0a74fd264388ab63b9cd980c265.1544546363.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": "<28e25797ef95a0a74fd264388ab63b9cd980c265.1544546363.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/28e25797ef95a0a74fd264388ab63b9cd980c265.1544546363.git.anatoly.burakov@intel.com", "date": "2018-12-11T16:43:31", "name": "[v2,4/5] mem: use memfd for no-huge mode", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "5ceb0f07331e3e276697a7fdd72042d2cd63198f", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/28e25797ef95a0a74fd264388ab63b9cd980c265.1544546363.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 2730, "url": "http://patches.dpdk.org/api/series/2730/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2730", "date": "2018-12-11T16:43:27", "name": "Allow using virtio without hugepages", "version": 2, "mbox": "http://patches.dpdk.org/series/2730/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/48647/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/48647/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 09D407CB0;\n\tTue, 11 Dec 2018 17:43:47 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id CBFD05F1B\n\tfor <dev@dpdk.org>; Tue, 11 Dec 2018 17:43:37 +0100 (CET)", "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Dec 2018 08:43:36 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga004.jf.intel.com with ESMTP; 11 Dec 2018 08:43:34 -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\twBBGhXSq026219; Tue, 11 Dec 2018 16:43:33 GMT", "from sivswdev05.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev05.ir.intel.com with ESMTP id wBBGhXkQ007061;\n\tTue, 11 Dec 2018 16:43:33 GMT", "(from aburakov@localhost)\n\tby sivswdev05.ir.intel.com with LOCAL id wBBGhXDu007057;\n\tTue, 11 Dec 2018 16:43:33 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,342,1539673200\"; d=\"scan'208\";a=\"258617687\"", "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": "Tue, 11 Dec 2018 16:43:31 +0000", "Message-Id": "<28e25797ef95a0a74fd264388ab63b9cd980c265.1544546363.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1544546363.git.anatoly.burakov@intel.com>", "<cover.1544546363.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1544546363.git.anatoly.burakov@intel.com>", "<cover.1542130721.git.anatoly.burakov@intel.com>\n\t<cover.1544546363.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v2 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>\n---\n\nNotes:\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..420d51b5b 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-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": [ "v2", "4/5" ] }{ "id": 48647, "url": "