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 BE9C9A0546; Thu, 16 Jul 2020 17:31:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F1AE41BEAA; Thu, 16 Jul 2020 17:31:29 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 5CA431BEA9 for ; Thu, 16 Jul 2020 17:31:27 +0200 (CEST) IronPort-SDR: DDMStqfLQbI92WC5XQz7i7WtRAfB98orNu9T4P5R63RhnwTH5pr9PCUtFq98kmniuF+1TjWIqF 3s6HUDgck3Pg== X-IronPort-AV: E=McAfee;i="6000,8403,9683"; a="147395533" X-IronPort-AV: E=Sophos;i="5.75,359,1589266800"; d="scan'208";a="147395533" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2020 08:31:25 -0700 IronPort-SDR: KJnYzhiJ3Ig26TAu4sxByEk0joOStDSCZ1DwJmuHSF/oynt1x8Vt7l9NsomQNdZ5zyg2ODxg7l asMmfR9C38sQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,359,1589266800"; d="scan'208";a="282488746" Received: from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92]) by orsmga003.jf.intel.com with ESMTP; 16 Jul 2020 08:31:24 -0700 From: patrick.fu@intel.com To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: patrick.fu@intel.com Date: Thu, 16 Jul 2020 23:30:10 +0800 Message-Id: <20200716153010.2894802-1-patrick.fu@intel.com> X-Mailer: git-send-email 2.18.4 Subject: [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll 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 --- 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