From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: David Marchand <david.marchand@redhat.com>, dev@dpdk.org
Cc: chenbo.xia@intel.com, yanghliu@redhat.com
Subject: Re: [PATCH] vhost: fix deadlock with no multiqueue
Date: Thu, 23 Mar 2023 15:48:42 +0100 [thread overview]
Message-ID: <36444f7a-78b6-0874-9f16-39328f2d2ef8@redhat.com> (raw)
In-Reply-To: <20230323144433.3104768-1-david.marchand@redhat.com>
On 3/23/23 15:44, David Marchand wrote:
> 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);
> }
> }
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
next prev parent reply other threads:[~2023-03-23 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 14:44 David Marchand
2023-03-23 14:48 ` Maxime Coquelin [this message]
2023-03-26 15:51 ` David Marchand
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=36444f7a-78b6-0874-9f16-39328f2d2ef8@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=yanghliu@redhat.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).