From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00, DATE_IN_FUTURE_06_12,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FF69C433ED for ; Fri, 2 Apr 2021 06:34:39 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 59A4360C3E for ; Fri, 2 Apr 2021 06:34:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59A4360C3E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C3A27140FE3; Fri, 2 Apr 2021 08:34:19 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 75016140FBB for ; Fri, 2 Apr 2021 08:34:18 +0200 (CEST) IronPort-SDR: E7+NrIa5THk+7MJBYCnCYm6n3Qn/Ra3L6zXNLYYzgqthdBIxgJG0t3SQg/W2efwWntR1WvEVVI q4/sKMQeqp5A== X-IronPort-AV: E=McAfee;i="6000,8403,9941"; a="189144954" X-IronPort-AV: E=Sophos;i="5.81,299,1610438400"; d="scan'208";a="189144954" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 23:34:18 -0700 IronPort-SDR: wBP9nTLHdgLdrQWCZB2jIRLaBSh3gOnQIugj0xf+YFzvFqkksUke3Bc1y/z1dmyRtApz5i1Ll0 n3W+1O6V7C4A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,299,1610438400"; d="scan'208";a="413042784" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.118.193]) by fmsmga008.fm.intel.com with ESMTP; 01 Apr 2021 23:34:16 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, yinan.wang@intel.com, sunil.pai.g@intel.com, cheng1.jiang@intel.com, Jiayu Hu Date: Fri, 2 Apr 2021 09:04:01 -0400 Message-Id: <1617368642-131298-4-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1617368642-131298-1-git-send-email-jiayu.hu@intel.com> References: <1615985773-406787-1-git-send-email-jiayu.hu@intel.com> <1617368642-131298-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-dev] [PATCH v2 3/4] vhost: avoid deadlock on async register X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Users can register async copy device in vring_state_changed(), when vhost queue is enabled. However, a deadlock occurs inside rte_vhost_async_channel_register(), if VHOST_USER_F_PROTOCOL_FEATURES is not supported, as vhost_user_msg_handler() takes vq->access_lock before calling vhost_user_set_vring_kick(). This patch avoids async register deadlock by removing calling vring_state_changed() in vhost_user_set_vring_kick(). It's safe as vhost_user_msg_handler() will call vring_state_changed() anyway. Signed-off-by: Jiayu Hu --- lib/librte_vhost/vhost_user.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 44c0452..8f0eba6 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1918,9 +1918,6 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg, */ if (!(dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) { vq->enabled = true; - if (dev->notify_ops->vring_state_changed) - dev->notify_ops->vring_state_changed( - dev->vid, file.index, 1); } if (vq->ready) { -- 2.7.4