From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 30BAB1B3D2; Mon, 12 Feb 2018 16:46:46 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C31D040A0971; Mon, 12 Feb 2018 15:46:45 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33E402024CA2; Mon, 12 Feb 2018 15:46:43 +0000 (UTC) From: Maxime Coquelin To: tiwei.bie@intel.com, yliu@fridaylinux.org, ferruh.yigit@intel.com, victork@redhat.com, thomas@monjalon.net, olivier.matz@6wind.com, jianfeng.tan@intel.com Cc: dev@dpdk.org, stable@dpdk.org, zhihong.wang@intel.com, qian.q.xu@intel.com, lei.a.yao@intel.com, Maxime Coquelin Date: Mon, 12 Feb 2018 16:46:12 +0100 Message-Id: <20180212154612.5297-4-maxime.coquelin@redhat.com> In-Reply-To: <20180212154612.5297-1-maxime.coquelin@redhat.com> References: <20180212154612.5297-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Feb 2018 15:46:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Feb 2018 15:46:45 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: [dpdk-stable] [PATCH v2 3/3] vhost: don't take access_lock on VHOST_USER_RESET_OWNER X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 15:46:46 -0000 A deadlock happens when handling VHOST_USER_RESET_OWNER request for the same reason the lock is not taken for VHOST_USER_GET_VRING_BASE. It is safe not to take the lock, as the queues are no more used by the application when the virtqueues and the device are reset. Fixes: a3688046995f ("vhost: protect active rings from async ring changes") Cc: stable@dpdk.org Cc: Victor Kaplansky Reviewed-by: Tiwei Bie Reviewed-by: Jianfeng Tan Signed-off-by: Maxime Coquelin --- lib/librte_vhost/vhost_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 65ee33919..90ed2112e 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1348,16 +1348,16 @@ vhost_user_msg_handler(int vid, int fd) } /* - * Note: we don't lock all queues on VHOST_USER_GET_VRING_BASE, - * since it is sent when virtio stops and device is destroyed. - * destroy_device waits for queues to be inactive, so it is safe. - * Otherwise taking the access_lock would cause a dead lock. + * Note: we don't lock all queues on VHOST_USER_GET_VRING_BASE + * and VHOST_USER_RESET_OWNER, since it is sent when virtio stops + * and device is destroyed. destroy_device waits for queues to be + * inactive, so it is safe. Otherwise taking the access_lock + * would cause a dead lock. */ switch (msg.request.master) { case VHOST_USER_SET_FEATURES: case VHOST_USER_SET_PROTOCOL_FEATURES: case VHOST_USER_SET_OWNER: - case VHOST_USER_RESET_OWNER: case VHOST_USER_SET_MEM_TABLE: case VHOST_USER_SET_LOG_BASE: case VHOST_USER_SET_LOG_FD: -- 2.14.3