From: Tomasz Kulasek Subject: [PATCH] vhost: fix wait for valid descriptor Date: Fri, 9 Feb 2018 18:34:55 +0100 Message-ID: <20180209173455.14116-1-tomaszx.kulasek@intel.com> Cc: dev@dpdk.org, yuanhan.liu@linux.intel.com, stable@dpdk.org, Changpeng Liu To: yliu@fridaylinux.org Return-path: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For each virt queue's kickfd and callfd, there are 2 invalid status: VIRTIO_UNINITIALIZED_EVENTFD and VIRTIO_INVALID_EVENTFD. Don't set the virt queue to ready status until got the valid descriptor. This is safe for polling mode drivers in Guest OS, the backend vhost process will not post notification to interrupt vector for PMD mode in guest, but the interrupt vector still valid. Fixes: e049ca6d10e0 ("vhost-user: prepare multiple queue setup") Cc: yuanhan.liu@linux.intel.com Cc: stable@dpdk.org Signed-off-by: Changpeng Liu Signed-off-by: Tomasz Kulasek --- lib/librte_vhost/vhost_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 65ee33919..4508f697b 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -766,7 +766,9 @@ vq_is_ready(struct vhost_virtqueue *vq) { return vq && vq->desc && vq->avail && vq->used && vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD && - vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD; + vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD && + vq->kickfd != VIRTIO_INVALID_EVENTFD && + vq->callfd != VIRTIO_INVALID_EVENTFD; } static int -- 2.14.1