Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/43532/?format=api
https://patches.dpdk.org/api/patches/43532/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180802163727.5376-1-maxime.coquelin@redhat.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": "<20180802163727.5376-1-maxime.coquelin@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180802163727.5376-1-maxime.coquelin@redhat.com", "date": "2018-08-02T16:37:27", "name": "vhost: flush IOTLB cache on new mem table handling", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "1ef664678f4cdc4dbae1eb799585275640126374", "submitter": { "id": 512, "url": "https://patches.dpdk.org/api/people/512/?format=api", "name": "Maxime Coquelin", "email": "maxime.coquelin@redhat.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180802163727.5376-1-maxime.coquelin@redhat.com/mbox/", "series": [ { "id": 882, "url": "https://patches.dpdk.org/api/series/882/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=882", "date": "2018-08-02T16:37:27", "name": "vhost: flush IOTLB cache on new mem table handling", "version": 1, "mbox": "https://patches.dpdk.org/series/882/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/43532/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/43532/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 270EE1B4DF;\n\tThu, 2 Aug 2018 18:37:43 +0200 (CEST)", "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 1FD081B4DC;\n\tThu, 2 Aug 2018 18:37:41 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id CC4695BCD2;\n\tThu, 2 Aug 2018 16:37:39 +0000 (UTC)", "from localhost.localdomain (ovpn-112-34.ams2.redhat.com\n\t[10.36.112.34])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id C534D1C71B;\n\tThu, 2 Aug 2018 16:37:33 +0000 (UTC)" ], "From": "Maxime Coquelin <maxime.coquelin@redhat.com>", "To": "tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com,\n\tdev@dpdk.org", "Cc": "stable@dpdk.org,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>", "Date": "Thu, 2 Aug 2018 18:37:27 +0200", "Message-Id": "<20180802163727.5376-1-maxime.coquelin@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.11.54.5", "X-Greylist": [ "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.1]); Thu, 02 Aug 2018 16:37:39 +0000 (UTC)", "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.1]); \n\tThu, 02 Aug 2018 16:37:39 +0000 (UTC) for IP:'10.11.54.5'\n\tDOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''" ], "Subject": "[dpdk-dev] [PATCH] vhost: flush IOTLB cache on new mem table\n\thandling", "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": "IOTLB entries contain the host virtual address of the guest\npages. When receiving a new VHOST_USER_SET_MEM_TABLE request,\nthe previous regions get unmapped, so the IOTLB entries, if any,\nwill be invalid. It does cause the vhost-user process to\nsegfault.\n\nThis patch introduces a new function to flush the IOTLB cache,\nand call it as soon as the backend handles a VHOST_USER_SET_MEM\nrequest.\n\nFixes: 69c90e98f483 (\"vhost: enable IOMMU support\")\nCc: stable@dpdk.org\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/iotlb.c | 10 ++++++++--\n lib/librte_vhost/iotlb.h | 2 +-\n lib/librte_vhost/vhost_user.c | 11 +++++++++++\n 3 files changed, 20 insertions(+), 3 deletions(-)", "diff": "diff --git a/lib/librte_vhost/iotlb.c b/lib/librte_vhost/iotlb.c\nindex c11ebcaac..51beb110c 100644\n--- a/lib/librte_vhost/iotlb.c\n+++ b/lib/librte_vhost/iotlb.c\n@@ -303,6 +303,13 @@ vhost_user_iotlb_cache_find(struct vhost_virtqueue *vq, uint64_t iova,\n \treturn vva;\n }\n \n+void\n+vhost_user_iotlb_flush_all(struct vhost_virtqueue *vq)\n+{\n+\t\tvhost_user_iotlb_cache_remove_all(vq);\n+\t\tvhost_user_iotlb_pending_remove_all(vq);\n+}\n+\n int\n vhost_user_iotlb_init(struct virtio_net *dev, int vq_index)\n {\n@@ -315,8 +322,7 @@ vhost_user_iotlb_init(struct virtio_net *dev, int vq_index)\n \t\t * The cache has already been initialized,\n \t\t * just drop all cached and pending entries.\n \t\t */\n-\t\tvhost_user_iotlb_cache_remove_all(vq);\n-\t\tvhost_user_iotlb_pending_remove_all(vq);\n+\t\tvhost_user_iotlb_flush_all(vq);\n \t}\n \n #ifdef RTE_LIBRTE_VHOST_NUMA\ndiff --git a/lib/librte_vhost/iotlb.h b/lib/librte_vhost/iotlb.h\nindex e7083e37b..60b9e4c57 100644\n--- a/lib/librte_vhost/iotlb.h\n+++ b/lib/librte_vhost/iotlb.h\n@@ -73,7 +73,7 @@ void vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq, uint64_t iova,\n \t\t\t\t\t\tuint8_t perm);\n void vhost_user_iotlb_pending_remove(struct vhost_virtqueue *vq, uint64_t iova,\n \t\t\t\t\t\tuint64_t size, uint8_t perm);\n-\n+void vhost_user_iotlb_flush_all(struct vhost_virtqueue *vq);\n int vhost_user_iotlb_init(struct virtio_net *dev, int vq_index);\n \n #endif /* _VHOST_IOTLB_H_ */\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex dc53ff712..d8cf33cd4 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -813,6 +813,17 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg)\n \t\tdev->mem = NULL;\n \t}\n \n+\t/* Flush IOTLB cache as previous HVAs are now invalid */\n+\tif (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) {\n+\t\tfor (i = 0; i < dev->nr_vring; i++) {\n+\t\t\tstruct vhost_virtqueue *vq = dev->virtqueue[i];\n+\n+\t\t\tvhost_user_iotlb_wr_lock(vq);\n+\t\t\tvhost_user_iotlb_flush_all(vq);\n+\t\t\tvhost_user_iotlb_wr_unlock(vq);\n+\t\t}\n+\t}\n+\n \tdev->nr_guest_pages = 0;\n \tif (!dev->guest_pages) {\n \t\tdev->max_guest_pages = 8;\n", "prefixes": [] }{ "id": 43532, "url": "