From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Peng He <xnhp0320@gmail.com>, dev@dpdk.org, chenbo.xia@intel.com
Cc: stable@dpdk.org
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] vhost: fix vid allocation race
Date: Wed, 3 Feb 2021 18:21:34 +0100 [thread overview]
Message-ID: <879b35dd-d571-cc15-3b1a-087c6b2539a1@redhat.com> (raw)
In-Reply-To: <20210201084844.2434-1-hepeng.0320@bytedance.com>
On 2/1/21 9:48 AM, Peng He wrote:
> vhost_new_device might be called in different threads at the same time.
> thread 1(config thread)
> rte_vhost_driver_start
> ->vhost_user_start_client
> ->vhost_user_add_connection
> -> vhost_new_device
>
> thread 2(vhost-events)
> vhost_user_read_cb
> ->vhost_user_msg_handler (return value < 0)
> -> vhost_user_start_client
> -> vhost_new_device
>
> So there could be a case that a same vid has been allocated twice, or
> some vid might be lost in DPDK lib however still held by the upper
> applications.
>
> Another place where race would happen is at the func *vhost_destroy_device*,
> but after a detailed investigation, the race does not exist as long as
> no two devices have the same vid: Calling vhost_destroy_devices in
> different threads with different vids is actually safe.
>
> Fixes: a277c715987 ("vhost: refactor code structure")
> Reported-by: Peng He <hepeng.0320@bytedance.com>
> Signed-off-by: Fei Chen <chenwei.0515@bytedance.com>
> Reviewed-by: Zhihong Wang <wangzhihong.wzh@bytedance.com>
> ---
> lib/librte_vhost/vhost.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied to dpdk-next-virtio/main.
Thanks,
Maxime
prev parent reply other threads:[~2021-02-03 17:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <MN2PR11MB406353097EA1E6C1D051D24B9CB69@MN2PR11MB4063.namprd11.prod.outlook.com>
2021-02-01 8:48 ` [dpdk-stable] " Peng He
2021-02-03 2:44 ` Xia, Chenbo
2021-02-03 17:21 ` Maxime Coquelin [this message]
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=879b35dd-d571-cc15-3b1a-087c6b2539a1@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=xnhp0320@gmail.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).