Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/57774/?format=api
https://patches.dpdk.org/api/patches/57774/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1566392575-7965-2-git-send-email-tallurix.chaitanya.babu@intel.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": "<1566392575-7965-2-git-send-email-tallurix.chaitanya.babu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1566392575-7965-2-git-send-email-tallurix.chaitanya.babu@intel.com", "date": "2019-08-21T13:02:53", "name": "[1/3] lib/eal: fix vfio unmap that fails unexpectedly", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "039b89cc257e7db3af9900d1e541ec6d226f5388", "submitter": { "id": 1164, "url": "https://patches.dpdk.org/api/people/1164/?format=api", "name": "Chaitanya Babu, TalluriX", "email": "tallurix.chaitanya.babu@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1566392575-7965-2-git-send-email-tallurix.chaitanya.babu@intel.com/mbox/", "series": [ { "id": 6091, "url": "https://patches.dpdk.org/api/series/6091/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6091", "date": "2019-08-21T13:02:52", "name": "add unit tests for eal vfio library", "version": 1, "mbox": "https://patches.dpdk.org/series/6091/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/57774/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/57774/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 AABEB1BF03;\n\tWed, 21 Aug 2019 15:04:06 +0200 (CEST)", "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 8E1561BEFF;\n\tWed, 21 Aug 2019 15:04:04 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t21 Aug 2019 06:04:03 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga006.jf.intel.com with ESMTP; 21 Aug 2019 06:04:02 -0700", "from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com\n\t[10.102.246.100])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tx7LD41Jj029286; Wed, 21 Aug 2019 14:04:01 +0100", "from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])\n\tby wgcvswdev001.ir.intel.com with ESMTP id x7LD3Qtk008336;\n\tWed, 21 Aug 2019 14:03:26 +0100", "(from tchaitax@localhost)\n\tby wgcvswdev001.ir.intel.com with ? id x7LD3Qfb008332;\n\tWed, 21 Aug 2019 14:03:26 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.64,412,1559545200\"; d=\"scan'208\";a=\"183527141\"", "From": "Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>", "To": "dev@dpdk.org", "Cc": "reshma.pattan@intel.com, jananeex.m.parthasarathy@intel.com,\n\tanatoly.burakov@intel.com,\n\tChaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>,\n\tstable@dpdk.org", "Date": "Wed, 21 Aug 2019 14:02:53 +0100", "Message-Id": "<1566392575-7965-2-git-send-email-tallurix.chaitanya.babu@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": "<1566392575-7965-1-git-send-email-tallurix.chaitanya.babu@intel.com>", "References": "<1566392575-7965-1-git-send-email-tallurix.chaitanya.babu@intel.com>", "Subject": "[dpdk-dev] [PATCH 1/3] lib/eal: fix vfio unmap that fails\n\tunexpectedly", "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": "Unmap of multiple pages fails after a sequence of partial map/unmaps.\nThe scenario is that multiple maps are created in user_mem_maps,\nafter multiple map/unmap/remap sequences.\n\nFor an example,\nSteps:\n1. Map 3 pages together\n2. Un-map page1\n3. Re-map page 1\n4. Un-map page 2\n5. Re-map page 2\n6. Un-map page 3\n7. Re-map page 3\n8. Un-map all pages\n\nUnmap fails when there are duplicate entries in user_mem_maps.\n\nThe fix is to validate if the input VA, IOVA exists in\nuser_mem_maps before creating map.\n\nFixes: 73a63908 (\"vfio: allow to map other memory regions\")\nCc: stable@dpdk.org\n\nSigned-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>\n---\n lib/librte_eal/linux/eal/eal_vfio.c | 46 +++++++++++++++++++++++++++++\n 1 file changed, 46 insertions(+)", "diff": "diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c\nindex 501c74f23..104912077 100644\n--- a/lib/librte_eal/linux/eal/eal_vfio.c\n+++ b/lib/librte_eal/linux/eal/eal_vfio.c\n@@ -212,6 +212,41 @@ find_user_mem_map(struct user_mem_maps *user_mem_maps, uint64_t addr,\n \treturn NULL;\n }\n \n+static int\n+find_user_mem_map_overlap(struct user_mem_maps *user_mem_maps, uint64_t addr,\n+\t\tuint64_t iova, uint64_t len)\n+{\n+\tuint64_t va_end = addr + len;\n+\tuint64_t iova_end = iova + len;\n+\tint i;\n+\n+\tfor (i = 0; i < user_mem_maps->n_maps; i++) {\n+\t\tstruct user_mem_map *map = &user_mem_maps->maps[i];\n+\t\tuint64_t map_va_end = map->addr + map->len;\n+\t\tuint64_t map_iova_end = map->iova + map->len;\n+\n+\t\tbool no_lo_va_overlap = addr < map->addr && va_end <= map->addr;\n+\t\tbool no_hi_va_overlap = addr >= map_va_end &&\n+\t\t\tva_end > map_va_end;\n+\t\tbool no_lo_iova_overlap = iova < map->iova &&\n+\t\t\tiova_end <= map->iova;\n+\t\tbool no_hi_iova_overlap = iova >= map_iova_end &&\n+\t\t\tiova_end > map_iova_end;\n+\n+\t\t/* check input VA and iova is not within the\n+\t\t * existing map's range\n+\t\t */\n+\t\tif ((no_lo_va_overlap || no_hi_va_overlap) &&\n+\t\t\t\t(no_lo_iova_overlap || no_hi_iova_overlap))\n+\t\t\tcontinue;\n+\t\telse\n+\t\t\t/* map overlaps */\n+\t\t\treturn 1;\n+\t}\n+\t/* map doesn't overlap */\n+\treturn 0;\n+}\n+\n /* this will sort all user maps, and merge/compact any adjacent maps */\n static void\n compact_user_maps(struct user_mem_maps *user_mem_maps)\n@@ -1732,6 +1767,17 @@ container_dma_map(struct vfio_config *vfio_cfg, uint64_t vaddr, uint64_t iova,\n \t\tret = -1;\n \t\tgoto out;\n \t}\n+\n+\t/* check whether vaddr and iova exists in user_mem_maps */\n+\tret = find_user_mem_map_overlap(user_mem_maps, vaddr, iova, len);\n+\tif (ret) {\n+\t\tRTE_LOG(ERR, EAL, \"Mapping overlaps with a previously \"\n+\t\t\t\t\"existing mapping\\n\");\n+\t\trte_errno = EEXIST;\n+\t\tret = -1;\n+\t\tgoto out;\n+\t}\n+\n \t/* map the entry */\n \tif (vfio_dma_mem_map(vfio_cfg, vaddr, iova, len, 1)) {\n \t\t/* technically, this will fail if there are currently no devices\n", "prefixes": [ "1/3" ] }{ "id": 57774, "url": "