Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/39046/?format=api
http://patches.dpdk.org/api/patches/39046/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1524756847-141034-1-git-send-email-jianfeng.tan@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": "<1524756847-141034-1-git-send-email-jianfeng.tan@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1524756847-141034-1-git-send-email-jianfeng.tan@intel.com", "date": "2018-04-26T15:34:07", "name": "[dpdk-dev] net/virtio-user: fix hugepage files enumeration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "197ac20bb22fe0176569c5a643c3949b84e85625", "submitter": { "id": 313, "url": "http://patches.dpdk.org/api/people/313/?format=api", "name": "Jianfeng Tan", "email": "jianfeng.tan@intel.com" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1524756847-141034-1-git-send-email-jianfeng.tan@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/39046/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/39046/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 7FA258D35;\n\tThu, 26 Apr 2018 17:32:03 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id BF2E18BA7\n\tfor <dev@dpdk.org>; Thu, 26 Apr 2018 17:32:01 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t26 Apr 2018 08:32:00 -0700", "from dpdk06.sh.intel.com ([10.67.110.196])\n\tby fmsmga007.fm.intel.com with ESMTP; 26 Apr 2018 08:31:59 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.49,330,1520924400\"; d=\"scan'208\";a=\"34852193\"", "From": "Jianfeng Tan <jianfeng.tan@intel.com>", "To": "dev@dpdk.org", "Cc": "maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhiyong.yang@intel.com, \n\tJianfeng Tan <jianfeng.tan@intel.com>", "Date": "Thu, 26 Apr 2018 15:34:07 +0000", "Message-Id": "<1524756847-141034-1-git-send-email-jianfeng.tan@intel.com>", "X-Mailer": "git-send-email 2.7.4", "Subject": "[dpdk-dev] [PATCH] net/virtio-user: fix hugepage files enumeration", "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "After the commit 2a04139f66b4 (\"eal: add single file segments option\"),\none hugepage file could contain multiple hugepages which are further\nmapped to different memory regions.\n\nOriginal enumeration implementation cannot handle this situation.\n\nThis patch filters out the duplicated files; and adjust the size after\nthe enumeration.\n\nFixes: 6a84c37e3975 (\"net/virtio-user: add vhost-user adapter layer\")\n\nSigned-off-by: Jianfeng Tan <jianfeng.tan@intel.com>\n---\n .../howto/virtio_user_for_container_networking.rst | 3 ++-\n drivers/net/virtio/virtio_user/vhost_user.c | 28 ++++++++++++++++++++--\n 2 files changed, 28 insertions(+), 3 deletions(-)", "diff": "diff --git a/doc/guides/howto/virtio_user_for_container_networking.rst b/doc/guides/howto/virtio_user_for_container_networking.rst\nindex aa68b53..476ce3a 100644\n--- a/doc/guides/howto/virtio_user_for_container_networking.rst\n+++ b/doc/guides/howto/virtio_user_for_container_networking.rst\n@@ -109,7 +109,8 @@ We have below limitations in this solution:\n * Cannot work with --no-huge option. Currently, DPDK uses anonymous mapping\n under this option which cannot be reopened to share with vhost backend.\n * Cannot work when there are more than VHOST_MEMORY_MAX_NREGIONS(8) hugepages.\n- In another word, do not use 2MB hugepage so far.\n+ If you have more regions (especially when 2MB hugepages are used), the option,\n+ --single-file-segments, can help to reduce the number of shared files.\n * Applications should not use file name like HUGEFILE_FMT (\"%smap_%d\"). That\n will bring confusion when sharing hugepage files with backend by name.\n * Root privilege is a must. DPDK resolves physical addresses of hugepages\ndiff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c\nindex a6df97a..01201c9 100644\n--- a/drivers/net/virtio/virtio_user/vhost_user.c\n+++ b/drivers/net/virtio/virtio_user/vhost_user.c\n@@ -138,12 +138,13 @@ struct hugepage_file_info {\n static int\n get_hugepage_file_info(struct hugepage_file_info huges[], int max)\n {\n-\tint idx;\n+\tint idx, k, exist;\n \tFILE *f;\n \tchar buf[BUFSIZ], *tmp, *tail;\n \tchar *str_underline, *str_start;\n \tint huge_index;\n \tuint64_t v_start, v_end;\n+\tstruct stat stats;\n \n \tf = fopen(\"/proc/self/maps\", \"r\");\n \tif (!f) {\n@@ -183,16 +184,39 @@ get_hugepage_file_info(struct hugepage_file_info huges[], int max)\n \t\tif (sscanf(str_start, \"map_%d\", &huge_index) != 1)\n \t\t\tcontinue;\n \n+\t\t/* skip duplicated file which is mapped to different regions */\n+\t\tfor (k = 0, exist = -1; k < idx; ++k) {\n+\t\t\tif (!strcmp(huges[k].path, tmp)) {\n+\t\t\t\texist = k;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\tif (exist >= 0)\n+\t\t\tcontinue;\n+\n \t\tif (idx >= max) {\n \t\t\tPMD_DRV_LOG(ERR, \"Exceed maximum of %d\", max);\n \t\t\tgoto error;\n \t\t}\n+\n \t\thuges[idx].addr = v_start;\n-\t\thuges[idx].size = v_end - v_start;\n+\t\thuges[idx].size = v_end - v_start; /* To be corrected later */\n \t\tsnprintf(huges[idx].path, PATH_MAX, \"%s\", tmp);\n \t\tidx++;\n \t}\n \n+\t/* correct the size for files who have many regions */\n+\tfor (k = 0; k < idx; ++k) {\n+\t\tif (stat(huges[k].path, &stats) < 0) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Failed to stat %s, %s\\n\",\n+\t\t\t\t huges[k].path, strerror(errno));\n+\t\t\tcontinue;\n+\t\t}\n+\t\thuges[k].size = stats.st_size;\n+\t\tPMD_DRV_LOG(INFO, \"file %s, size %\"PRIx64\"\\n\",\n+\t\t\t huges[k].path, huges[k].size);\n+\t}\n+\n \tfclose(f);\n \treturn idx;\n \n", "prefixes": [ "dpdk-dev" ] }{ "id": 39046, "url": "