Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/28139/?format=api
http://patches.dpdk.org/api/patches/28139/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20170831095023.21037-20-maxime.coquelin@redhat.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": "<20170831095023.21037-20-maxime.coquelin@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20170831095023.21037-20-maxime.coquelin@redhat.com", "date": "2017-08-31T09:50:21", "name": "[dpdk-dev,19/21] vhost: iommu: Invalidate vring in case of matching IOTLB invalidate", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "fbf8174263e4f584d92b931dde21ab2158dc23d5", "submitter": { "id": 512, "url": "http://patches.dpdk.org/api/people/512/?format=api", "name": "Maxime Coquelin", "email": "maxime.coquelin@redhat.com" }, "delegate": { "id": 355, "url": "http://patches.dpdk.org/api/users/355/?format=api", "username": "yliu", "first_name": "Yuanhan", "last_name": "Liu", "email": "yuanhan.liu@linux.intel.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20170831095023.21037-20-maxime.coquelin@redhat.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/28139/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/28139/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id DACD67CF6;\n\tThu, 31 Aug 2017 11:52:48 +0200 (CEST)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id A33EE7CE7\n\tfor <dev@dpdk.org>; Thu, 31 Aug 2017 11:52:47 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 02DFE46289;\n\tThu, 31 Aug 2017 09:52:47 +0000 (UTC)", "from localhost.localdomain (ovpn-112-32.ams2.redhat.com\n\t[10.36.112.32])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 20032841B0;\n\tThu, 31 Aug 2017 09:52:43 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 02DFE46289", "Authentication-Results": [ "ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=maxime.coquelin@redhat.com" ], "From": "Maxime Coquelin <maxime.coquelin@redhat.com>", "To": "dev@dpdk.org, yliu@fridaylinux.org, jfreiman@redhat.com,\n\ttiwei.bie@intel.com", "Cc": "mst@redhat.com, vkaplans@redhat.com, jasowang@redhat.com,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>", "Date": "Thu, 31 Aug 2017 11:50:21 +0200", "Message-Id": "<20170831095023.21037-20-maxime.coquelin@redhat.com>", "In-Reply-To": "<20170831095023.21037-1-maxime.coquelin@redhat.com>", "References": "<20170831095023.21037-1-maxime.coquelin@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]); Thu, 31 Aug 2017 09:52:47 +0000 (UTC)", "Subject": "[dpdk-dev] [PATCH 19/21] vhost: iommu: Invalidate vring in case of\n\tmatching IOTLB invalidate", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://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": "<http://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": "As soon as a page used by a ring is invalidated, the access_ok flag\nis cleared, so that processing threads try to map them again.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/vhost.c | 17 +++++++++++++++++\n lib/librte_vhost/vhost.h | 1 +\n lib/librte_vhost/vhost_user.c | 38 +++++++++++++++++++++++++++++++++-----\n 3 files changed, 51 insertions(+), 5 deletions(-)", "diff": "diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c\nindex ed9292313..4bf22d6e2 100644\n--- a/lib/librte_vhost/vhost.c\n+++ b/lib/librte_vhost/vhost.c\n@@ -261,6 +261,23 @@ vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq)\n \treturn 0;\n }\n \n+void vring_invalidate(struct virtio_net *dev, struct vhost_virtqueue *vq)\n+{\n+\tint vid = dev->vid;\n+\n+\t/* Ensure no thread is using the vrings */\n+\tput_device(vid);\n+\tdev = get_device_wr(vid);\n+\n+\tvq->access_ok = 0;\n+\tvq->desc = NULL;\n+\tvq->avail = NULL;\n+\tvq->used = NULL;\n+\n+\tput_device_wr(vid);\n+\tget_device(vid);\n+}\n+\n static void\n init_vring_queue(struct virtio_net *dev, uint32_t vring_idx)\n {\ndiff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex f84718ed1..98f9ccaf0 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -357,5 +357,6 @@ void vhost_backend_cleanup(struct virtio_net *dev);\n uint64_t vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\tuint64_t iova, uint64_t size, uint8_t perm);\n int vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq);\n+void vring_invalidate(struct virtio_net *dev, struct vhost_virtqueue *vq);\n \n #endif /* _VHOST_NET_CDEV_H_ */\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex 650981e2d..4df24ef82 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -351,11 +351,7 @@ vhost_user_set_vring_addr(struct virtio_net *dev, VhostUserMsg *msg)\n \t */\n \tmemcpy(&vq->ring_addrs, addr, sizeof(*addr));\n \n-\tvq->desc = NULL;\n-\tvq->avail = NULL;\n-\tvq->used = NULL;\n-\n-\tvq->access_ok = 0;\n+\tvring_invalidate(dev, vq);\n \n \treturn 0;\n }\n@@ -969,6 +965,35 @@ is_vring_iotlb_update(struct vhost_virtqueue *vq, struct vhost_iotlb_msg *imsg)\n }\n \n static int\n+is_vring_iotlb_invalidate(struct vhost_virtqueue *vq,\n+\t\t\t\tstruct vhost_iotlb_msg *imsg)\n+{\n+\tuint64_t istart, iend, vstart, vend;\n+\n+\tistart = imsg->iova;\n+\tiend = istart + imsg->size - 1;\n+\n+\tvstart = (uint64_t)vq->desc;\n+\tvend = vstart + sizeof(struct vring_desc) * vq->size - 1;\n+\tif (vstart <= iend && istart <= vend)\n+\t\treturn 1;\n+\n+\tvstart = (uint64_t)vq->avail;\n+\tvend = vstart + sizeof(struct vring_avail);\n+\tvend += sizeof(uint16_t) * vq->size - 1;\n+\tif (vstart <= iend && istart <= vend)\n+\t\treturn 1;\n+\n+\tvstart = (uint64_t)vq->used;\n+\tvend = vstart + sizeof(struct vring_used);\n+\tvend += sizeof(struct vring_used_elem) * vq->size - 1;\n+\tif (vstart <= iend && istart <= vend)\n+\t\treturn 1;\n+\n+\treturn 0;\n+}\n+\n+static int\n vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg)\n {\n \tstruct virtio_net *dev = *pdev;\n@@ -998,6 +1023,9 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg)\n \n \t\t\tvhost_user_iotlb_cache_remove(vq, imsg->iova,\n \t\t\t\t\timsg->size);\n+\n+\t\t\tif (is_vring_iotlb_invalidate(vq, imsg))\n+\t\t\t\tvring_invalidate(dev, vq);\n \t\t}\n \t\tbreak;\n \tdefault:\n", "prefixes": [ "dpdk-dev", "19/21" ] }{ "id": 28139, "url": "