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 33384C4708A for ; Fri, 28 May 2021 01:42:50 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id C8D14613B4 for ; Fri, 28 May 2021 01:42:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8D14613B4 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 BC0F9410F2; Fri, 28 May 2021 03:42:46 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 7912140040; Fri, 28 May 2021 03:42:43 +0200 (CEST) IronPort-SDR: ivxOOgJYXjlnf/4KJvZ4CTivdKcXdTV3+VQZJzKgLA8SptIYqKmZKrY5qo38quGawwSBS7y99c GO5a0lQiBCYg== X-IronPort-AV: E=McAfee;i="6200,9189,9997"; a="266760003" X-IronPort-AV: E=Sophos;i="5.83,228,1616482800"; d="scan'208";a="266760003" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2021 18:42:42 -0700 IronPort-SDR: i0Wdutpn4Sl4wttMIPYf09MS8UlwvEQT6epkblYSSSZ1bd2sgW7MVSlbeoDiblyszqUgHZzD11 cErRd7HKtOxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,228,1616482800"; d="scan'208";a="477732985" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.118.193]) by orsmga001.jf.intel.com with ESMTP; 27 May 2021 18:42:40 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, yinan.wang@intel.com, Jiayu Hu , stable@dpdk.org Date: Fri, 28 May 2021 04:11:02 -0400 Message-Id: <1622189463-392610-2-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1622189463-392610-1-git-send-email-jiayu.hu@intel.com> References: <1622189463-392610-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-dev] [PATCH 1/2] vhost: fix lock on device readiness notification 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" The vhost notifies the application of device readiness via vhost_user_notify_queue_state(), but calling this function is not protected by the lock. This patch is to make this function call lock protected. Fixes: d0fcc38f5fa4 ("vhost: improve device readiness notifications") Cc: stable@dpdk.org Signed-off-by: Jiayu Hu --- lib/vhost/vhost_user.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 8f0eba6..dabce26 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2915,9 +2915,6 @@ vhost_user_msg_handler(int vid, int fd) } } - if (unlock_required) - vhost_user_unlock_all_queue_pairs(dev); - /* If message was not handled at this stage, treat it as an error */ if (!handled) { VHOST_LOG_CONFIG(ERR, @@ -2952,6 +2949,8 @@ vhost_user_msg_handler(int vid, int fd) } } + if (unlock_required) + vhost_user_unlock_all_queue_pairs(dev); if (!virtio_is_ready(dev)) goto out; -- 2.7.4