From patchwork Thu Jun 20 06:33:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noa Ezra X-Patchwork-Id: 55120 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 C2B981D07E; Thu, 20 Jun 2019 08:33:08 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 935E91D043; Thu, 20 Jun 2019 08:33:07 +0200 (CEST) From: Noa Ezra To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: matan@mellanox.com, dev@dpdk.org, noae@mellanox.com, stable@dpdk.org Date: Thu, 20 Jun 2019 06:33:03 +0000 Message-Id: <1561012383-306353-1-git-send-email-noae@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560924960-221163-1-git-send-email-noae@mellanox.com> References: <1560924960-221163-1-git-send-email-noae@mellanox.com> Subject: [dpdk-dev] [PATCH v2] net/vhost: fix redundant queue state event 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" In some situations, when a virtual machine is starting, vring_state_changed can be called while there was no change in the queue state. This fix makes sure that there was really a change in the queue state before calling the callback for EVENT_QUEUE_STATE. Fixes: ee584e9710b9 ("vhost: add driver on top of the library") Cc: stable@dpdk.org Signed-off-by: Noa Ezra Reviewed-by: Matan Azrad Reviewed-by: Maxime Coquelin --- v2 remove checkpatch warnings --- drivers/net/vhost/rte_eth_vhost.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index cad1e5c..fbe7a37 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -855,6 +855,10 @@ struct vhost_xstats_name_off { /* won't be NULL */ state = vring_states[eth_dev->data->port_id]; rte_spinlock_lock(&state->lock); + if (state->cur[vring] == enable) { + rte_spinlock_unlock(&state->lock); + return 0; + } state->cur[vring] = enable; state->max_vring = RTE_MAX(vring, state->max_vring);