All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost: fix wait for valid descriptor
@ 2018-02-09 17:34 Tomasz Kulasek
  2018-02-11  4:21 ` Tan, Jianfeng
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Kulasek @ 2018-02-09 17:34 UTC (permalink / raw)
  To: yliu; +Cc: dev, yuanhan.liu, stable, Changpeng Liu

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 <changpeng.liu@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-27  6:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 17:34 [PATCH] vhost: fix wait for valid descriptor Tomasz Kulasek
2018-02-11  4:21 ` Tan, Jianfeng
2018-07-26 15:48   ` Thomas Monjalon
2018-07-27  6:11     ` Tiwei Bie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.