From patchwork Fri Feb 9 17:34:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Kulasek X-Patchwork-Id: 35099 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 083E11B843; Fri, 9 Feb 2018 18:36:12 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 34F2E1B840; Fri, 9 Feb 2018 18:36:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Feb 2018 09:36:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,483,1511856000"; d="scan'208";a="29532142" Received: from unknown (HELO Sent) ([10.103.103.74]) by fmsmga001.fm.intel.com with SMTP; 09 Feb 2018 09:36:06 -0800 Received: by Sent (sSMTP sendmail emulation); Fri, 09 Feb 2018 18:35:02 +0100 From: Tomasz Kulasek To: yliu@fridaylinux.org Cc: dev@dpdk.org, yuanhan.liu@linux.intel.com, stable@dpdk.org, Changpeng Liu Date: Fri, 9 Feb 2018 18:34:55 +0100 Message-Id: <20180209173455.14116-1-tomaszx.kulasek@intel.com> X-Mailer: git-send-email 2.12.3 Subject: [dpdk-dev] [PATCH] vhost: fix wait for valid descriptor 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: , 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