DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vhost: fix deadlock with no multiqueue
@ 2023-03-23 14:44 David Marchand
  2023-03-23 14:48 ` Maxime Coquelin
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2023-03-23 14:44 UTC (permalink / raw)
  To: dev; +Cc: maxime.coquelin, chenbo.xia, yanghliu

This deadlock happens when a guest, that had virtio ports with multi
queues configured, does not announce the multi q feature in
SET_FEATURES.
In such a situation, all vq locks are already taken before calling
free_vq(), which itself takes the lock.

As mentioned in the code, in this situation, the virtio device is not
running yet and no datapath thread is using the vq. So we can
release the lock before calling free_vq().

Bugzilla ID: 1196
Fixes: 4b02c2673757 ("vhost: annotate async accesses")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/vhost/vhost_user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index f5edba8548..d60e39b6bc 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -397,6 +397,9 @@ vhost_user_set_features(struct virtio_net **pdev,
 			dev->virtqueue[dev->nr_vring] = NULL;
 			cleanup_vq(vq, 1);
 			cleanup_vq_inflight(dev, vq);
+			/* vhost_user_lock_all_queue_pairs locked all qps */
+			vq_assert_lock(dev, vq);
+			rte_spinlock_unlock(&vq->access_lock);
 			free_vq(dev, vq);
 		}
 	}
-- 
2.39.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-26 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 14:44 [PATCH] vhost: fix deadlock with no multiqueue David Marchand
2023-03-23 14:48 ` Maxime Coquelin
2023-03-26 15:51   ` David Marchand

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).