From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: tiwei.bie@intel.com, yliu@fridaylinux.org,
ferruh.yigit@intel.com, victork@redhat.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 2/2] vhost: don't take access_lock on VHOST_USER_RESET_OWNER
Date: Fri, 9 Feb 2018 15:26:54 +0100 [thread overview]
Message-ID: <20180209142654.29409-3-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20180209142654.29409-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>
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
next prev parent reply other threads:[~2018-02-09 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 14:26 [dpdk-dev] [PATCH 0/2] Vhost & Virtio fixes for -rc4 Maxime Coquelin
2018-02-09 14:26 ` [dpdk-dev] [PATCH 1/2] virtio: fix resuming traffic with rx vector path Maxime Coquelin
2018-02-11 8:02 ` Yao, Lei A
2018-02-12 13:18 ` Olivier Matz
[not found] ` <b1a41802-4c87-c76d-a50c-3222df8845ef@intel.com>
2018-02-13 0:49 ` Tan, Jianfeng
2018-02-09 14:26 ` Maxime Coquelin [this message]
2018-02-12 9:40 ` [dpdk-dev] [PATCH 2/2] vhost: don't take access_lock on VHOST_USER_RESET_OWNER Tiwei Bie
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=20180209142654.29409-3-maxime.coquelin@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=lei.a.yao@intel.com \
--cc=qian.q.xu@intel.com \
--cc=stable@dpdk.org \
--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).