From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1A935A034F; Mon, 19 Jul 2021 10:33:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9318A4118B; Mon, 19 Jul 2021 10:33:37 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 5E53E4068B; Mon, 19 Jul 2021 10:33:35 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10049"; a="296577200" X-IronPort-AV: E=Sophos;i="5.84,251,1620716400"; d="scan'208";a="296577200" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 01:33:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,251,1620716400"; d="scan'208";a="468347517" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.119.25]) by fmsmga008.fm.intel.com with ESMTP; 19 Jul 2021 01:33:33 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, Jiayu Hu , stable@dpdk.org Date: Mon, 19 Jul 2021 11:00:45 -0400 Message-Id: <1626706847-276163-2-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1626706847-276163-1-git-send-email-jiayu.hu@intel.com> References: <1626465089-17052-2-git-send-email-jiayu.hu@intel.com> <1626706847-276163-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-dev] [PATCH v6 1/3] 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 Reviewed-by: Maxime Coquelin --- 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 031c578..31300e1 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2995,9 +2995,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, @@ -3032,6 +3029,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