DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
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 <maxime.coquelin@redhat.com>
Subject: [dpdk-dev] [PATCH v2 3/3] vhost: don't take access_lock on VHOST_USER_RESET_OWNER
Date: Mon, 12 Feb 2018 16:46:12 +0100	[thread overview]
Message-ID: <20180212154612.5297-4-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20180212154612.5297-1-maxime.coquelin@redhat.com>

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 <victork@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 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

  parent reply	other threads:[~2018-02-12 15:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 15:46 [dpdk-dev] [PATCH v2 0/3] Vhost & Virtio fixes for v18.02 Maxime Coquelin
2018-02-12 15:46 ` [dpdk-dev] [PATCH v2 1/3] net/virtio: fix mbuf data offset for simple Rx function Maxime Coquelin
2018-02-13  8:53   ` Maxime Coquelin
2018-02-12 15:46 ` [dpdk-dev] [PATCH v2 2/3] virtio: fix resuming port with rx vector path Maxime Coquelin
2018-02-12 15:46 ` Maxime Coquelin [this message]
2018-02-13 17:45 ` [dpdk-dev] [dpdk-stable] [PATCH v2 0/3] Vhost & Virtio fixes for v18.02 Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180212154612.5297-4-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jianfeng.tan@intel.com \
    --cc=lei.a.yao@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=qian.q.xu@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=tiwei.bie@intel.com \
    --cc=victork@redhat.com \
    --cc=yliu@fridaylinux.org \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).