From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Tomasz Kulasek <tomaszx.kulasek@intel.com>, yliu@fridaylinux.org
Cc: daniel.verkamp@intel.com, james.r.harris@intel.com,
pawelx.wodkowski@intel.com, dev@dpdk.org,
Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Subject: Re: [dpdk-dev] [PATCH] vhost: stop device before updating public vring data
Date: Tue, 6 Mar 2018 17:26:31 +0100 [thread overview]
Message-ID: <94395154-a1cb-486e-d03f-e42a8872fabb@redhat.com> (raw)
In-Reply-To: <20180305161108.8232-1-tomaszx.kulasek@intel.com>
Hi Tomasz,
On 03/05/2018 05:11 PM, Tomasz Kulasek wrote:
> For now DPDK assumes that callfd, kickfd and last_idx are being set just
> once during vring initialization and device cannot be running while DPDK
> receives SET_VRING_KICK, SET_VRING_CALL and SET_VRING_BASE messages.
> However, that assumption is wrong. For Vhost SCSI messages might arrive
> at any point of time, possibly multiple times, one after another.
>
> QEMU issues SET_VRING_CALL once during device initialization, then again
> during device start. The second message will close previous callfd,
> which is still being used by the user-implementation of vhost device.
> This results in writing to invalid (closed) callfd.
>
> Other messages like SET_FEATURES, SET_VRING_ADDR etc also will change
> internal state of VQ or device. To prevent race condition device should
> also be stopped before updateing vring data.
>
> Signed-off-by: Dariusz Stojaczyk<dariuszx.stojaczyk@intel.com>
> Signed-off-by: Pawel Wodkowski<pawelx.wodkowski@intel.com>
> Signed-off-by: Tomasz Kulasek<tomaszx.kulasek@intel.com>
> ---
> lib/librte_vhost/vhost_user.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
In last release, we have introduced a per-virtqueue lock to protect
vring handling against asynchronous device changes.
I think that would solve the issue you are facing, but you would need
to export the VQs locking functions to the vhost-user lib API to be
able to use it.
I don't think your current patch is the right solution anyway, because
it destroys the device in case we don't want it to remain alive, like
set_log_base, or set_features when only the logging feature gets
enabled.
Cheers,
Maxime
next prev parent reply other threads:[~2018-03-06 16:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 16:11 Tomasz Kulasek
2018-03-06 16:26 ` Maxime Coquelin [this message]
2018-03-07 9:16 ` Wodkowski, PawelX
2018-03-07 10:09 ` Maxime Coquelin
2018-03-07 10:59 ` Wodkowski, PawelX
2018-03-07 11:29 ` Maxime Coquelin
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=94395154-a1cb-486e-d03f-e42a8872fabb@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=daniel.verkamp@intel.com \
--cc=dariuszx.stojaczyk@intel.com \
--cc=dev@dpdk.org \
--cc=james.r.harris@intel.com \
--cc=pawelx.wodkowski@intel.com \
--cc=tomaszx.kulasek@intel.com \
--cc=yliu@fridaylinux.org \
/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).