From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 1C0191B89A; Mon, 29 Jan 2018 17:31:12 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7059562E83; Mon, 29 Jan 2018 16:31:11 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-21.ams2.redhat.com [10.36.112.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64F1C60C82; Mon, 29 Jan 2018 16:31:09 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, tiwei.bie@intel.com, yliu@fridaylinux.org, jfreimann@redhat.com, jianfeng.tan@intel.com Cc: stable@dpdk.org, Maxime Coquelin Date: Mon, 29 Jan 2018 17:30:40 +0100 Message-Id: <20180129163040.9560-3-maxime.coquelin@redhat.com> In-Reply-To: <20180129163040.9560-1-maxime.coquelin@redhat.com> References: <20180129163040.9560-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 (mx1.redhat.com [10.5.110.39]); Mon, 29 Jan 2018 16:31:11 +0000 (UTC) Subject: [dpdk-dev] [PATCH v3 2/2] vhost: remove pending IOTLB entry if IOTLB MISS request sending failed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2018 16:31:12 -0000 In case vhost_user_iotlb_miss returns an error, the pending IOTLB entry has to be removed from the list as no IOTLB update will be received. Fixes: fed67a20ac94 ("vhost: introduce guest IOVA to backend VA helper") Cc: stable@dpdk.org Suggested-by: Tiwei Bie Signed-off-by: Maxime Coquelin --- lib/librte_vhost/iotlb.c | 2 +- lib/librte_vhost/iotlb.h | 3 +++ lib/librte_vhost/vhost.c | 13 ++++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/iotlb.c b/lib/librte_vhost/iotlb.c index 72cd27df8..c11ebcaac 100644 --- a/lib/librte_vhost/iotlb.c +++ b/lib/librte_vhost/iotlb.c @@ -120,7 +120,7 @@ vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq, rte_rwlock_write_unlock(&vq->iotlb_pending_lock); } -static void +void vhost_user_iotlb_pending_remove(struct vhost_virtqueue *vq, uint64_t iova, uint64_t size, uint8_t perm) { diff --git a/lib/librte_vhost/iotlb.h b/lib/librte_vhost/iotlb.h index f1a050e44..e7083e37b 100644 --- a/lib/librte_vhost/iotlb.h +++ b/lib/librte_vhost/iotlb.h @@ -71,6 +71,9 @@ bool vhost_user_iotlb_pending_miss(struct vhost_virtqueue *vq, uint64_t iova, uint8_t perm); void vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq, uint64_t iova, uint8_t perm); +void vhost_user_iotlb_pending_remove(struct vhost_virtqueue *vq, uint64_t iova, + uint64_t size, uint8_t perm); + int vhost_user_iotlb_init(struct virtio_net *dev, int vq_index); #endif /* _VHOST_IOTLB_H_ */ diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 1dd9adbc7..6ac6cacff 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -42,7 +42,9 @@ __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq, if (tmp_size == size) return vva; - if (!vhost_user_iotlb_pending_miss(vq, iova + tmp_size, perm)) { + iova += tmp_size; + + if (!vhost_user_iotlb_pending_miss(vq, iova, perm)) { /* * iotlb_lock is read-locked for a full burst, * but it only protects the iotlb cache. @@ -52,8 +54,13 @@ __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq, */ vhost_user_iotlb_rd_unlock(vq); - vhost_user_iotlb_pending_insert(vq, iova + tmp_size, perm); - vhost_user_iotlb_miss(dev, iova + tmp_size, perm); + vhost_user_iotlb_pending_insert(vq, iova, perm); + if (vhost_user_iotlb_miss(dev, iova, perm)) { + RTE_LOG(ERR, VHOST_CONFIG, + "Failed to send IOTLB miss request for IOVA %lx\n", + iova); + vhost_user_iotlb_pending_remove(vq, iova, 1, perm); + } vhost_user_iotlb_rd_lock(vq); } -- 2.14.3