Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/48046/?format=api
http://patchwork.dpdk.org/api/patches/48046/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/6b5e1de44f42e18a6a9326a06eb800c6bb8ddfdf.1542130721.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": "<6b5e1de44f42e18a6a9326a06eb800c6bb8ddfdf.1542130721.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/6b5e1de44f42e18a6a9326a06eb800c6bb8ddfdf.1542130721.git.anatoly.burakov@intel.com", "date": "2018-11-13T17:54:48", "name": "[19.02,2/2] mem: use memfd for no-huge mode", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "3a5d4e8c7c39c3cbd8bd58efb8309adc54d055b4", "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/6b5e1de44f42e18a6a9326a06eb800c6bb8ddfdf.1542130721.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 2393, "url": "http://patchwork.dpdk.org/api/series/2393/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=2393", "date": "2018-11-13T17:54:48", "name": "Allow using virtio without hugepages", "version": 1, "mbox": "http://patchwork.dpdk.org/series/2393/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/48046/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/48046/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 187312B83;\n\tTue, 13 Nov 2018 18:54:53 +0100 (CET)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 53E6B1D7\n\tfor <dev@dpdk.org>; Tue, 13 Nov 2018 18:54:51 +0100 (CET)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Nov 2018 09:54:50 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga002.fm.intel.com with ESMTP; 13 Nov 2018 09:54:49 -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\twADHsmrh032030; Tue, 13 Nov 2018 17:54:48 GMT", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id wADHsm42001131;\n\tTue, 13 Nov 2018 17:54:48 GMT", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id wADHsmhb001127;\n\tTue, 13 Nov 2018 17:54:48 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,228,1539673200\"; d=\"scan'208\";a=\"104058629\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "przemyslawx.lal@intel.com, kuralamudhan.ramakrishnan@intel.com,\n\tivan.coughlan@intel.com, tiwei.bie@intel.com, ray.kinsella@intel.com", "Date": "Tue, 13 Nov 2018 17:54:48 +0000", "Message-Id": "<6b5e1de44f42e18a6a9326a06eb800c6bb8ddfdf.1542130721.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1542130721.git.anatoly.burakov@intel.com>", "<cover.1542130721.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1542130721.git.anatoly.burakov@intel.com>", "<cover.1542130721.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH 19.02 2/2] 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 lib/librte_eal/linuxapp/eal/eal_memory.c | 46 ++++++++++++++++++++++--\n 1 file changed, 44 insertions(+), 2 deletions(-)", "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex 48b23ce19..8feac2c56 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,7 @@\n #include <sys/time.h>\n #include <signal.h>\n #include <setjmp.h>\n+#include <linux/memfd.h>\n #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES\n #include <numa.h>\n #include <numaif.h>\n@@ -1345,12 +1346,15 @@ 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, memfd, flags;\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@@ -1363,8 +1367,36 @@ 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+\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(ERR, EAL, \"Cannot create memfd: %s\\n\",\n+\t\t\t\t\tstrerror(errno));\n+\t\t\tRTE_LOG(ERR, 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 \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@@ -1375,6 +1407,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": [ "19.02", "2/2" ] }{ "id": 48046, "url": "