From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 728DEA0526; Tue, 21 Jul 2020 05:38:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E6CEE1C012; Tue, 21 Jul 2020 05:37:59 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 930CF1C00D for ; Tue, 21 Jul 2020 05:37:58 +0200 (CEST) IronPort-SDR: xLdo/JvfiffLPSI5AbBrGOOWIt38QiwGu7FMQoTiOsB4BTUw7RROOnKUA8lyHe07W25LUVTh0S Lj8SZ0MP9h5g== X-IronPort-AV: E=McAfee;i="6000,8403,9688"; a="168196719" X-IronPort-AV: E=Sophos;i="5.75,377,1589266800"; d="scan'208";a="168196719" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2020 20:37:57 -0700 IronPort-SDR: oPRk03PgfeKDv/fGxn/NHBPFnLcjrJTH6tgXTE4pO24dVqsQShkGJTgdUrfALU8Ov/ppI3v1Ud kn1n1WqBBI/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,377,1589266800"; d="scan'208";a="487936819" Received: from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92]) by fmsmga005.fm.intel.com with ESMTP; 20 Jul 2020 20:37:56 -0700 From: patrick.fu@intel.com To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: Patrick Fu Date: Tue, 21 Jul 2020 11:35:57 +0800 Message-Id: <20200721033557.3372262-1-patrick.fu@intel.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200716153010.2894802-1-patrick.fu@intel.com> References: <20200716153010.2894802-1-patrick.fu@intel.com> Subject: [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path 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" From: Patrick Fu Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue. Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu --- v2: revise commit title lib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1d0be3dd4..b197d76d3 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; - __atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE); - - vhost_vring_call_split(dev, vq); + if (likely(vq->enabled && vq->access_ok)) { + __atomic_add_fetch(&vq->used->idx, + n_descs, __ATOMIC_RELEASE); + vhost_vring_call_split(dev, vq); + } } if (start_idx + n_pkts_put <= vq_size) { -- 2.18.4